@next-bricks/diagram 0.68.0 → 0.68.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.
- package/dist/bricks.json +3 -3
- package/dist/chunks/551.b0963fe0.js +2 -0
- package/dist/chunks/551.b0963fe0.js.map +1 -0
- package/dist/chunks/editable-label.aa7a3018.js +3 -0
- package/dist/chunks/editable-label.aa7a3018.js.map +1 -0
- package/dist/chunks/{main.3bf9aa13.js → main.54aa1373.js} +2 -2
- package/dist/chunks/{main.3bf9aa13.js.map → main.54aa1373.js.map} +1 -1
- package/dist/examples.json +3 -3
- package/dist/index.71cff42f.js +2 -0
- package/dist/{index.907aefdb.js.map → index.71cff42f.js.map} +1 -1
- package/dist/manifest.json +139 -139
- package/dist/types.json +5745 -5745
- package/package.json +2 -2
- package/dist/chunks/551.057ed6cd.js +0 -2
- package/dist/chunks/551.057ed6cd.js.map +0 -1
- package/dist/chunks/editable-label.3c0d8497.js +0 -3
- package/dist/chunks/editable-label.3c0d8497.js.map +0 -1
- package/dist/index.907aefdb.js +0 -2
- /package/dist/chunks/{editable-label.3c0d8497.js.LICENSE.txt → editable-label.aa7a3018.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunks/551.b0963fe0.js","mappings":"qKAGO,SAASA,EACdC,EACAC,EACAC,EACAC,GAEA,MAAMC,EAAoB,GAC1B,GAAIH,EAAkB,CACpB,MAAMI,EAAiB,IAAIC,IAC3B,IAAK,MAAMC,KAAQP,EACC,SAAdO,EAAKC,MAAmBD,EAAKE,SAAWR,EAAiBQ,OAAOC,IAClEL,EAAeM,IAAIJ,EAAKK,QAG5B,IAAK,MAAML,KAAQP,EACjB,OAAQO,EAAKC,MACX,IAAK,OACCH,EAAeQ,IAAIN,EAAKG,KAC1BN,EAAUU,KAAKP,GAEjB,MACF,IAAK,YAEAJ,GACiB,QAAlBI,EAAKQ,YACLV,EAAeQ,IAAIN,EAAK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AQ,SAAU,SAAU,UACxCkU,EAAAA,EAAAA,MAAKlU,EAAM,CAAC,OAAQ,KAAM,QAChC,C,0DCHO,SAASkW,EACdzW,EACA6I,GAEA,IAAI+8B,EAAO92B,IACT+2B,EAAO/2B,IACLg3B,GAAO,IACTC,GAAO,IAQT,GAPA/lC,EAAMyV,SAASlV,IACb,MAAM,EAAEqC,EAAC,EAAEC,EAAC,MAAEL,EAAK,OAAEC,GAAWlC,EAAKgC,KACjCK,EAAIgjC,IAAMA,EAAOhjC,GACjBC,EAAIgjC,IAAMA,EAAOhjC,GACjBD,EAAIJ,EAAQsjC,IAAMA,EAAOljC,EAAIJ,GAC7BK,EAAIJ,EAASsjC,IAAMA,EAAOljC,EAAIJ,EAAM,KAErC,CAACmjC,EAAME,EAAMD,EAAME,GAAMt4B,MAAMu4B,GAAMC,SAASD,KAAK,MAAO,CAAC,EAChE,MAAM7iC,GAAU6I,EAAAA,EAAAA,KAAInD,EAAS,UAAWuN,EAAAA,IAGxC,MAAO,CACLxT,EAAGgjC,EAAOziC,EACVN,EAAGgjC,EAAO1iC,EACVX,MALYsjC,EAAOF,EAAiB,EAAVziC,EAM1BV,OALasjC,EAAOF,EAAiB,EAAV1iC,EAO/B,C,iECPO,MAAM+iC,EAAoB/6B,IAAAA,cA8B9B,CACDsB,QAAS,CAAEa,QAAS,MACpBpE,sBAAuB,KACvB4S,0BAA2B,CAAExO,QAAS,MACtCrE,WAAY,KACZk9B,oBAAqB,GACrB1zB,gBAAiB,KACjBM,mBAAoBA,OACpBgJ,cAAeA,OACf5S,yBAA0BA,SAGrB,SAASC,IACd,OAAO+B,IAAAA,WAAiB+6B,EAC1B,C","sources":["webpack:///./src/draw-canvas/processors/getUnrelatedCells.ts","webpack:///./src/draw-canvas/processors/asserts.ts","webpack:///./src/shared/canvas/processors/nodeViewToNodeRect.ts","webpack:///./src/shared/canvas/processors/getSmartLinePoints.ts","webpack:///./src/draw-canvas/SmartConnectLineComponent.tsx","webpack:///./src/shared/canvas/processors/getConnectLinePoints.ts","webpack:///./src/draw-canvas/processors/normalizeAlignOrigin.ts","webpack:///./src/shared/canvas/useLayout.ts","webpack:///./src/shared/canvas/useAutoCenter.ts","webpack:///./src/shared/canvas/processors/getTransformToCenter.ts","webpack:///./src/shared/canvas/useActiveTarget.ts","webpack:///./src/shared/canvas/processors/getEditingLinePoints.ts","webpack:///./src/draw-canvas/EditingLineComponent.tsx","webpack:///./src/draw-canvas/processors/initialGroupLayout.ts","webpack:///./src/draw-canvas/processors/handleNodeContainedChange.ts","webpack:///./src/draw-canvas/LineEditorComponent.tsx","webpack:///./src/draw-canvas/processors/handleLasso.ts","webpack:///./src/draw-canvas/LineConnectorComponent.tsx","webpack:///./src/draw-canvas/processors/handleKeyboard.ts","webpack:///./src/draw-canvas/processors/toggleLock.ts","webpack:///./src/shared/canvas/styles.shadow.css","webpack:///./src/draw-canvas/constants.ts","webpack:///./src/draw-canvas/processors/generateNewPointsWithLayout.ts","webpack:///./src/draw-canvas/processors/updateCells.ts","webpack:///./src/draw-canvas/processors/transformToCenter.ts","webpack:///./src/draw-canvas/ConnectLineComponent.tsx","webpack:///./src/draw-canvas/processors/initializeCells.ts","webpack:///./src/draw-canvas/processors/staggeredLayout.ts","webpack:///./src/draw-canvas/processors/findNodeOrAreaDecorator.ts","webpack:///./src/shared/canvas/collectLineJumpsFactory.ts","webpack:///./src/shared/canvas/useEditableLineMap.ts","webpack:///./src/draw-canvas/processors/targetIsActive.ts","webpack:///./src/shared/canvas/processors/getCellsRect.ts","webpack:///../../src/mergeRects.ts","webpack:///./src/draw-canvas/reducers/cells.ts","webpack:///./src/draw-canvas/reducers/index.ts","webpack:///./src/draw-canvas/reducers/layoutKey.ts","webpack:///./src/shared/canvas/forceLayout.ts","webpack:///./src/shared/canvas/ZoomBarComponent.shadow.css","webpack:///./src/draw-canvas/processors/initialContainerLayout.ts","webpack:///./src/shared/canvas/icons/center.svg","webpack:///./src/shared/canvas/icons/zoom-in.svg","webpack:///./src/shared/canvas/icons/zoom-out.svg","webpack:///./src/shared/canvas/ZoomBarComponent.tsx","webpack:///./src/shared/canvas/useLineMarkers.ts","webpack:///./src/draw-canvas/LineLabelComponent.tsx","webpack:///./src/draw-canvas/EdgeComponent.tsx","webpack:///./src/draw-canvas/processors/getLabelMaskAndOffset.ts","webpack:///./src/draw-canvas/LockIcon.tsx","webpack:///./src/draw-canvas/NodeComponent.tsx","webpack:///./src/draw-canvas/processors/getSnapPositions.ts","webpack:///./src/draw-canvas/processors/handleMouseDown.ts","webpack:///./src/draw-canvas/processors/normalizeSnapOptions.ts","webpack:///./src/draw-canvas/processors/getContentEditable.ts","webpack:///./src/draw-canvas/decorators/DecoratorText.tsx","webpack:///./src/draw-canvas/decorators/index.tsx","webpack:///./src/draw-canvas/decorators/DecoratorGroup.tsx","webpack:///./src/draw-canvas/decorators/DecoratorContainer.tsx","webpack:///./src/draw-canvas/decorators/DecoratorArea.tsx","webpack:///./src/draw-canvas/decorators/DecoratorRect.tsx","webpack:///./src/draw-canvas/decorators/DecoratorLine.tsx","webpack:///./src/draw-canvas/processors/getLineLockIconPosition.ts","webpack:///./src/draw-canvas/CellComponent.tsx","webpack:///./src/shared/canvas/useZoom.ts","webpack:///./src/draw-canvas/processors/sameTarget.ts","webpack:///./src/shared/canvas/useReady.ts","webpack:///./src/shared/canvas/shapes/Rectangle.ts","webpack:///./src/draw-canvas/processors/isLocked.ts","webpack:///./src/shared/canvas/dagreLayout.ts","webpack:///./src/draw-canvas/processors/cellToTarget.ts","webpack:///./src/draw-canvas/processors/computeBoundingBox.ts","webpack:///./src/draw-canvas/HoverStateContext.ts"],"sourcesContent":["import type { ActiveTarget, Cell, ConnectLineState } from \"../interfaces\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport function getUnrelatedCells(\n cells: Cell[],\n connectLineState: ConnectLineState | null,\n activeTarget: ActiveTarget | null,\n allowEdgeToArea?: boolean\n): Cell[] {\n const unrelated: Cell[] = [];\n if (connectLineState) {\n const existedTargets = new Set<string>();\n for (const cell of cells) {\n if (cell.type === \"edge\" && cell.source === connectLineState.source.id) {\n existedTargets.add(cell.target);\n }\n }\n for (const cell of cells) {\n switch (cell.type) {\n case \"node\":\n if (existedTargets.has(cell.id)) {\n unrelated.push(cell);\n }\n break;\n case \"decorator\":\n if (\n !allowEdgeToArea ||\n cell.decorator == \"text\" ||\n existedTargets.has(cell.id)\n ) {\n unrelated.push(cell);\n }\n break;\n default:\n unrelated.push(cell);\n }\n }\n } else {\n switch (activeTarget?.type) {\n case \"multi\": {\n const nodesMap = new Map<string, Cell>();\n const activeNodeIds = new Set<string>();\n const relatedNodeIds = new Set<string>();\n for (const active of activeTarget.targets) {\n if (active.type === \"node\") {\n activeNodeIds.add(active.id);\n relatedNodeIds.add(active.id);\n }\n }\n for (const cell of cells) {\n if (cell.type === \"node\") {\n nodesMap.set(cell.id, cell);\n } else if (cell.type === \"edge\") {\n if (activeNodeIds.has(cell.source)) {\n relatedNodeIds.add(cell.target);\n } else if (activeNodeIds.has(cell.target)) {\n relatedNodeIds.add(cell.source);\n } else if (!targetIsActive(cell, activeTarget)) {\n unrelated.push(cell);\n }\n } else if (!targetIsActive(cell, activeTarget)) {\n unrelated.push(cell);\n }\n }\n for (const [id, cell] of nodesMap) {\n if (!relatedNodeIds.has(id)) {\n unrelated.push(cell);\n }\n }\n break;\n }\n\n case \"node\": {\n const nodesMap = new Map<string, Cell>();\n const relatedNodeIds = new Set<string>([activeTarget.id]);\n for (const cell of cells) {\n if (cell.type === \"node\") {\n nodesMap.set(cell.id, cell);\n } else if (cell.type === \"edge\") {\n if (cell.source === activeTarget.id) {\n relatedNodeIds.add(cell.target);\n } else if (cell.target === activeTarget.id) {\n relatedNodeIds.add(cell.source);\n } else {\n unrelated.push(cell);\n }\n } else {\n unrelated.push(cell);\n }\n }\n for (const [id, cell] of nodesMap) {\n if (!relatedNodeIds.has(id)) {\n unrelated.push(cell);\n }\n }\n break;\n }\n\n case \"edge\":\n for (const cell of cells) {\n if (\n !(cell.type === \"edge\"\n ? targetIsActive(cell, activeTarget)\n : cell.type === \"node\" &&\n (cell.id === activeTarget.source ||\n cell.id === activeTarget.target))\n ) {\n unrelated.push(cell);\n }\n }\n break;\n }\n }\n\n return unrelated;\n}\n","import { isNil } from \"lodash\";\nimport type {\n Cell,\n DecoratorCell,\n EdgeCell,\n EditableEdgeLine,\n EditableLine,\n InitialCell,\n InitialNodeCell,\n InitialNodeView,\n LayoutType,\n LineDecoratorCell,\n LineType,\n NodeCell,\n} from \"../interfaces\";\nimport { MoveCellPayload } from \"../reducers/interfaces\";\n\nexport function isNodeCell(cell: Cell | MoveCellPayload): cell is NodeCell {\n return cell.type === \"node\";\n}\n\nexport function isDecoratorCell(\n cell: Cell | InitialCell\n): 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: InitialCell): cell is EdgeCell {\n return cell.type === \"edge\";\n}\n\nexport function isNodeOrEdgeCell(cell: Cell): cell is NodeCell | EdgeCell {\n return cell.type === \"node\" || cell.type === \"edge\";\n}\n\nexport function isNodeOrAreaDecoratorCell(\n cell: Cell\n): cell is NodeCell | DecoratorCell {\n return (\n cell.type === \"node\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n}\n\nexport function isEdgeSide(\n cell: Cell,\n allowEdgeToArea: boolean | undefined\n): cell is NodeCell | DecoratorCell {\n return (\n cell.type === \"node\" ||\n (!!allowEdgeToArea &&\n cell.type === \"decorator\" &&\n cell.decorator === \"area\")\n );\n}\n\nexport function isNodeOrTextDecoratorCell(\n cell: Cell | MoveCellPayload\n): cell is NodeCell | DecoratorCell {\n return (\n cell.type === \"node\" ||\n (cell.type === \"decorator\" && cell.decorator === \"text\")\n );\n}\n\nexport function isTextDecoratorCell(cell: Cell): cell is DecoratorCell {\n return cell.type === \"decorator\" && cell.decorator === \"text\";\n}\nexport function isContainerDecoratorCell(\n cell: InitialCell | MoveCellPayload\n): cell is DecoratorCell {\n return cell.type === \"decorator\" && cell.decorator === \"container\";\n}\n\nexport function isGroupDecoratorCell(\n cell: InitialCell | MoveCellPayload\n): cell is DecoratorCell {\n return cell.type === \"decorator\" && cell.decorator === \"group\";\n}\n\nexport function isLineDecoratorCell(\n cell: Cell | LineDecoratorCell | MoveCellPayload\n): cell is LineDecoratorCell {\n return cell.type === \"decorator\" && cell.decorator === \"line\";\n}\n\nexport function isNoManualLayout(layout: LayoutType) {\n return ![\"manual\", undefined].includes(layout!);\n}\n\nexport function isNoSize(view: InitialNodeView) {\n return !(view?.width && view?.height);\n}\n\nexport function isNoPoint(view: InitialNodeView) {\n return isNil(view?.x) || isNil(view?.y);\n}\n\nexport function isStraightType(type: LineType | undefined) {\n return !(type === \"polyline\" || type === \"curve\");\n}\n\nexport function isEditableEdgeLine(\n line: EditableLine\n): line is EditableEdgeLine {\n return !!(line as EditableEdgeLine).edge;\n}\n","import type { NodeRect } from \"../../../diagram/interfaces\";\nimport type { NodeView } from \"../../../draw-canvas/interfaces\";\n\nexport function 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 { pull } from \"lodash\";\nimport type { NodePosition } from \"../../../diagram/interfaces\";\nimport { getConnectPointsOfRectangleWithDirection } from \"../shapes/Rectangle\";\nimport type {\n BiDirection,\n EditableLineView,\n NodeView,\n} from \"../../../draw-canvas/interfaces\";\nimport { getPolyLinePoints } from \"../../../diagram/lines/getPolyLinePoints\";\nimport { nodeViewToNodeRect } from \"./nodeViewToNodeRect\";\nimport {\n DEFAULT_NODE_PADDING_FOR_LINES,\n DEFAULT_NODE_PADDING_FOR_SMART_LINES,\n} from \"../../../draw-canvas/constants\";\nimport { getDirectLinePoints } from \"../../../diagram/lines/getDirectLinePoints\";\nimport { isStraightType } from \"../../../draw-canvas/processors/asserts\";\n\nconst DEFAULT_DIRECTIONS = [\"right\", \"top\", \"left\", \"bottom\"] as const;\n\nexport function getSmartLinePoints(\n sourceView: NodeView,\n targetView: NodeView,\n lineView: EditableLineView | undefined,\n parallelGap?: number,\n /** @default \"edge\" */\n cellType?: \"edge\" | \"decorator\"\n): NodePosition[] | null {\n const {\n type,\n vertices,\n exitPosition: originalExit,\n entryPosition: originalEntry,\n } = lineView ?? {};\n\n if (isStraightType(type)) {\n if (cellType === \"decorator\") {\n return [\n { x: sourceView.x, y: sourceView.y },\n ...(vertices ?? []),\n { x: targetView.x, y: targetView.y },\n ];\n }\n\n return getDirectLinePoints(\n nodeViewToNodeRect(\n sourceView,\n originalExit\n ? DEFAULT_NODE_PADDING_FOR_SMART_LINES\n : DEFAULT_NODE_PADDING_FOR_LINES\n ),\n nodeViewToNodeRect(\n targetView,\n originalEntry\n ? DEFAULT_NODE_PADDING_FOR_SMART_LINES\n : DEFAULT_NODE_PADDING_FOR_LINES\n ),\n parallelGap,\n lineView\n );\n }\n\n if (vertices?.length) {\n const firstVertex = vertices[0];\n const lastVertex = vertices[vertices.length - 1];\n\n let exitPoint: NodePosition;\n let entryPoint: NodePosition;\n let exitDirection: BiDirection | undefined;\n let entryDirection: BiDirection | undefined;\n\n // Auto decide the exit and entry position.\n if (originalExit) {\n exitPoint = getAbsolutePosition(sourceView, originalExit);\n } else {\n let possibleFirstNextPoint: NodePosition | undefined;\n if (vertices.length > 1) {\n // Decide exit point by the first two vertices.\n possibleFirstNextPoint = vertices[1];\n } else if (originalEntry) {\n // Decide exit point by the entry position.\n possibleFirstNextPoint = getAbsolutePosition(targetView, originalEntry);\n }\n if (possibleFirstNextPoint) {\n exitPoint = getDefaultAbsolutePosition(\n firstVertex,\n sourceView,\n firstVertex.y === possibleFirstNextPoint.y\n );\n } else {\n // No other vertices nor the entry position, decide exit point by the\n // relative position between the last vertex and the target node.\n const prefer =\n lastVertex.y < targetView.y ||\n lastVertex.y > targetView.y + targetView.height\n ? \"ns\"\n : \"ew\";\n ({ point: exitPoint, direction: exitDirection } =\n fitEndpointAndDirection(sourceView, targetView, vertices, prefer));\n }\n }\n\n if (originalEntry) {\n entryPoint = getAbsolutePosition(targetView, originalEntry);\n } else {\n let possibleLastPreviousPoint: NodePosition | undefined;\n if (vertices.length > 1) {\n // Decide entry point by the last two vertices.\n possibleLastPreviousPoint = vertices[vertices.length - 2];\n } else if (originalExit) {\n // Decide entry point by the exit position.\n possibleLastPreviousPoint = getAbsolutePosition(\n sourceView,\n originalExit\n );\n }\n if (possibleLastPreviousPoint) {\n entryPoint = getDefaultAbsolutePosition(\n lastVertex,\n targetView,\n lastVertex.y === possibleLastPreviousPoint.y\n );\n } else {\n // No other vertices nor the exit position, decide entry point by the\n // relative position between the first vertex and the source node.\n const prefer =\n firstVertex.x < sourceView.x ||\n firstVertex.x > sourceView.x + sourceView.width\n ? \"ew\"\n : \"ns\";\n ({ point: entryPoint, direction: entryDirection } =\n fitEndpointAndDirection(\n targetView,\n sourceView,\n vertices.slice().reverse(),\n prefer\n ));\n }\n }\n\n const { x: sourceX, y: sourceY } = exitPoint;\n const { x: targetX, y: targetY } = entryPoint;\n\n const newLinePoints = [exitPoint, ...vertices, entryPoint];\n\n const newVertices = [...vertices];\n\n // If the first vertex is not on any axis of the source exit point,\n // add a vertex to connect them.\n if (firstVertex && firstVertex.x !== sourceX && firstVertex.y !== sourceY) {\n newVertices.unshift(\n exitDirection === \"ns\"\n ? { x: sourceX, y: firstVertex.y }\n : exitDirection === \"ew\"\n ? { x: firstVertex.x, y: sourceY }\n : firstVertex.x === newLinePoints[2].x\n ? { x: sourceX, y: firstVertex.y }\n : { x: firstVertex.x, y: sourceY }\n );\n }\n\n // If the last vertex is not on any axis of the target entry point,\n // add a vertex to connect them.\n if (lastVertex && lastVertex.x !== targetX && lastVertex.y !== targetY) {\n newVertices.push(\n entryDirection === \"ns\"\n ? { x: targetX, y: lastVertex.y }\n : entryDirection === \"ew\"\n ? { x: lastVertex.x, y: targetY }\n : lastVertex.x === newLinePoints[newLinePoints.length - 3].x\n ? { x: targetX, y: lastVertex.y }\n : { x: lastVertex.x, y: targetY }\n );\n }\n\n return [\n exitPoint,\n ...simplifyVertices(exitPoint, newVertices, entryPoint),\n entryPoint,\n ];\n }\n\n const exitPosition =\n originalExit ?? getDefaultPosition(targetView, sourceView);\n const entryPosition =\n originalEntry ?? getDefaultPosition(sourceView, targetView);\n\n const { x: sourceX, y: sourceY } = getAbsolutePosition(\n sourceView,\n exitPosition\n );\n const { x: targetX, y: targetY } = getAbsolutePosition(\n targetView,\n entryPosition\n );\n\n const connectPoints = getConnectPointsOfRectangleWithDirection();\n const originalSourceDirections =\n connectPoints.find((p) => p.x === exitPosition.x && p.y === exitPosition.y)\n ?.d ?? DEFAULT_DIRECTIONS;\n const originalTargetDirections =\n connectPoints.find(\n (p) => p.x === entryPosition.x && p.y === entryPosition.y\n )?.d ?? DEFAULT_DIRECTIONS;\n const sourceDirections = [...originalSourceDirections];\n const targetDirections = [...originalTargetDirections];\n\n if (sourceX < targetX) {\n pull(sourceDirections, \"left\");\n pull(targetDirections, \"right\");\n } else {\n pull(sourceDirections, \"right\");\n pull(targetDirections, \"left\");\n }\n\n if (sourceY < targetY) {\n pull(sourceDirections, \"top\");\n pull(targetDirections, \"bottom\");\n } else {\n pull(sourceDirections, \"bottom\");\n pull(targetDirections, \"top\");\n }\n\n const sourceDirection = sourceDirections[0] ?? originalSourceDirections[0];\n const targetDirection = targetDirections[0] ?? originalTargetDirections[0];\n\n const sourcePosition =\n sourceDirection === \"left\" || sourceDirection === \"right\"\n ? exitPosition.y\n : exitPosition.x;\n const targetPosition =\n targetDirection === \"left\" || targetDirection === \"right\"\n ? entryPosition.y\n : entryPosition.x;\n\n return getPolyLinePoints(\n nodeViewToNodeRect(sourceView, DEFAULT_NODE_PADDING_FOR_SMART_LINES),\n nodeViewToNodeRect(targetView, DEFAULT_NODE_PADDING_FOR_SMART_LINES),\n sourceDirection,\n targetDirection,\n sourcePosition,\n targetPosition\n );\n}\n\nexport function simplifyVertices(\n exitPoint: NodePosition,\n vertices: NodePosition[],\n entryPoint: NodePosition\n): NodePosition[] {\n // Simplify the vertices, ignore all vertices that its previous and next points are on the same axis\n // E.g, ignore two vertices of index 1 and index 3 for the following line.\n // 0---1---2\n // |\n // 3\n // |\n // 4\n const simplifiedVertices: NodePosition[] = [];\n let prev = exitPoint;\n let prevDirection: \"ns\" | \"ew\" | undefined;\n let index = 0;\n while (index < vertices.length) {\n const vertex = vertices[index];\n const isHorizontal = vertex.x !== prev.x;\n const isVertical = vertex.y !== prev.y;\n if (isHorizontal || isVertical) {\n const direction = isHorizontal ? \"ew\" : \"ns\";\n if (direction !== prevDirection) {\n const next =\n index === vertices.length - 1 ? entryPoint : vertices[index + 1];\n const isHorizontalNext = next.x !== vertex.x;\n const isVerticalNext = next.y !== vertex.y;\n if (isHorizontalNext || isVerticalNext) {\n const nextDirection = isHorizontalNext ? \"ew\" : \"ns\";\n if (direction !== nextDirection) {\n prevDirection = direction;\n simplifiedVertices.push(vertex);\n prev = vertex;\n }\n }\n }\n }\n index++;\n }\n\n return simplifiedVertices;\n}\n\nfunction getDefaultPosition(\n sourceView: NodeView,\n targetView: NodeView\n): NodePosition {\n if (targetView.y + targetView.height < sourceView.y) {\n return { x: 0.5, y: 1 };\n }\n if (targetView.y > sourceView.y + sourceView.height) {\n return { x: 0.5, y: 0 };\n }\n return targetView.x < sourceView.x ? { x: 1, y: 0.5 } : { x: 0, y: 0.5 };\n}\n\nfunction getAbsolutePosition(view: NodeView, position: NodePosition) {\n const halfPadding = DEFAULT_NODE_PADDING_FOR_SMART_LINES / 2;\n return {\n x:\n view.x -\n halfPadding +\n position.x * (view.width + DEFAULT_NODE_PADDING_FOR_SMART_LINES),\n y:\n view.y -\n halfPadding +\n position.y * (view.height + DEFAULT_NODE_PADDING_FOR_SMART_LINES),\n };\n}\n\nfunction getDefaultAbsolutePosition(\n sourceView: NodePosition,\n targetView: NodeView,\n flip?: boolean\n): NodePosition {\n let xAxis: \"x\" | \"y\";\n let yAxis: \"x\" | \"y\";\n let xSize: \"width\" | \"height\";\n let ySize: \"width\" | \"height\";\n if (flip) {\n xAxis = \"y\";\n yAxis = \"x\";\n xSize = \"height\";\n ySize = \"width\";\n } else {\n xAxis = \"x\";\n yAxis = \"y\";\n xSize = \"width\";\n ySize = \"height\";\n }\n let position: NodePosition | undefined;\n if (targetView[yAxis] + targetView[ySize] < sourceView[yAxis]) {\n position = { [xAxis]: 0.5, [yAxis]: 1 } as unknown as NodePosition;\n }\n if (targetView[yAxis] > sourceView[yAxis]) {\n position = { [xAxis]: 0.5, [yAxis]: 0 } as unknown as NodePosition;\n }\n if (position) {\n return getAbsolutePosition(targetView, position);\n }\n\n const xPosition = targetView[xAxis] < sourceView[xAxis] ? 1 : 0;\n\n return {\n [xAxis]:\n targetView[xAxis] -\n DEFAULT_NODE_PADDING_FOR_SMART_LINES / 2 +\n xPosition * (targetView[xSize] + DEFAULT_NODE_PADDING_FOR_SMART_LINES),\n [yAxis]: sourceView[yAxis],\n } as unknown as NodePosition;\n}\n\nfunction fitEndpointAndDirection(\n view: NodeView,\n oppositeView: NodeView,\n vertices: NodePosition[],\n prefer: BiDirection\n): { point: NodePosition; direction: BiDirection } {\n let point: NodePosition;\n let direction: BiDirection;\n\n let xAxis: \"x\" | \"y\";\n let yAxis: \"x\" | \"y\";\n let xSize: \"width\" | \"height\";\n let ySize: \"width\" | \"height\";\n let nsDirection: BiDirection;\n let ewDirection: BiDirection;\n if (prefer === \"ns\") {\n xAxis = \"x\";\n yAxis = \"y\";\n xSize = \"width\";\n ySize = \"height\";\n nsDirection = \"ns\";\n ewDirection = \"ew\";\n } else {\n xAxis = \"y\";\n yAxis = \"x\";\n xSize = \"height\";\n ySize = \"width\";\n nsDirection = \"ew\";\n ewDirection = \"ns\";\n }\n const vertex = vertices[0];\n\n if (\n vertex[xAxis] >= view[xAxis] &&\n vertex[xAxis] <= view[xAxis] + view[xSize]\n ) {\n if (vertex[yAxis] > view[yAxis] + view[ySize]) {\n point = {\n [xAxis]: vertex[xAxis],\n [yAxis]: view[yAxis] + view[ySize],\n } as unknown as NodePosition;\n direction = nsDirection;\n } else if (vertex[yAxis] < view[yAxis]) {\n point = {\n [xAxis]: vertex[xAxis],\n [yAxis]: view[yAxis],\n } as unknown as NodePosition;\n direction = nsDirection;\n } else {\n const nextVertex = vertices[1] ?? oppositeView;\n point = {\n [xAxis]: vertex[xAxis],\n [yAxis]:\n nextVertex[yAxis] < vertex[yAxis]\n ? vertex[yAxis]\n : view[yAxis] + view[ySize],\n } as unknown as NodePosition;\n direction = nsDirection;\n }\n } else {\n if (vertex[yAxis] < view[yAxis]) {\n point = {\n [xAxis]: view[xAxis] + view[xSize] / 2,\n [yAxis]: view[yAxis],\n } as unknown as NodePosition;\n direction = nsDirection;\n } else if (vertex[yAxis] > view[yAxis] + view[ySize]) {\n point = {\n [xAxis]: view[xAxis] + view[xSize] / 2,\n [yAxis]: view[yAxis] + view[ySize],\n } as unknown as NodePosition;\n direction = nsDirection;\n } else if (vertex[xAxis] < view[xAxis]) {\n point = {\n [xAxis]: view[xAxis],\n [yAxis]: vertex[yAxis],\n } as unknown as NodePosition;\n direction = ewDirection;\n } else {\n point = {\n [xAxis]: view[xAxis] + view[xSize],\n [yAxis]: vertex[yAxis],\n } as unknown as NodePosition;\n direction = ewDirection;\n }\n }\n return { point, direction: direction };\n}\n","// istanbul ignore file: experimental\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type { ComputedLineConnecterConf, LineSettings } from \"./interfaces\";\nimport type {\n LineMarkerConf,\n PositionTuple,\n TransformLiteral,\n} from \"../diagram/interfaces\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport { getConnectLinePoints } from \"../shared/canvas/processors/getConnectLinePoints\";\nimport { getMarkers } from \"../shared/canvas/useLineMarkers\";\n\nexport interface SmartConnectLineComponentProps {\n transform: TransformLiteral;\n lineSettings?: LineSettings;\n options: ComputedLineConnecterConf;\n}\n\nexport function SmartConnectLineComponent({\n transform,\n lineSettings,\n options,\n}: SmartConnectLineComponentProps): JSX.Element {\n const [connectLineTo, setConnectLineTo] = useState<PositionTuple | null>(\n null\n );\n const { hoverState, smartConnectLineState, setSmartConnectLineState } =\n useHoverStateContext();\n\n useEffect(() => {\n if (!smartConnectLineState) {\n return;\n }\n function onMouseMove(e: MouseEvent) {\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo([\n (e.clientX - transform.x - smartConnectLineState!.offset[0]) /\n transform.k,\n (e.clientY - transform.y - smartConnectLineState!.offset[1]) /\n transform.k,\n ]);\n }\n function onMouseUp(e: MouseEvent) {\n e.preventDefault();\n reset();\n }\n function reset() {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n setConnectLineTo(null);\n setSmartConnectLineState(null);\n }\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n\n return reset;\n }, [setSmartConnectLineState, smartConnectLineState, transform]);\n\n const line = useMemo(() => {\n const points = getConnectLinePoints(\n smartConnectLineState,\n connectLineTo,\n hoverState,\n lineSettings\n );\n return curveLine(\n points,\n lineSettings?.type === \"curve\" ? lineSettings.curveType : \"curveLinear\",\n 0,\n 1\n );\n }, [connectLineTo, hoverState, smartConnectLineState, lineSettings]);\n\n let markerStart: string | undefined;\n let markerEnd: string | undefined;\n const lineMarkers: LineMarkerConf[] = getMarkers(options);\n for (const marker of lineMarkers) {\n if (marker.placement === \"start\") {\n markerStart = options.$markerStartUrl;\n } else {\n markerEnd = options.$markerEndUrl;\n }\n }\n\n return (\n <path\n className={classNames(\"connect-line\", {\n connecting: !!(smartConnectLineState && connectLineTo),\n })}\n d={line}\n fill=\"none\"\n stroke={options.strokeColor}\n strokeWidth={options.strokeWidth}\n markerStart={markerStart}\n markerEnd={markerEnd}\n />\n );\n}\n","import type { NodePosition, PositionTuple } from \"../../../diagram/interfaces\";\nimport type { HoverState } from \"../../../draw-canvas/HoverStateContext\";\nimport type {\n LineSettings,\n SmartConnectLineState,\n} from \"../../../draw-canvas/interfaces\";\nimport { getSmartLinePoints } from \"./getSmartLinePoints\";\n\nexport function getConnectLinePoints(\n smartConnectLineState: SmartConnectLineState | null,\n connectLineTo: PositionTuple | null,\n hoverState: HoverState | null,\n lineSettings?: LineSettings\n): NodePosition[] | null {\n if (\n !smartConnectLineState ||\n !(connectLineTo || hoverState?.activePointIndex !== undefined)\n ) {\n return null;\n }\n\n const sourceView = smartConnectLineState.source.view;\n if (hoverState?.activePointIndex !== undefined) {\n return getSmartLinePoints(sourceView, hoverState.cell.view, {\n ...lineSettings,\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: hoverState.relativePoints[hoverState.activePointIndex],\n });\n }\n\n const [x1, y1] = connectLineTo!;\n\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n {\n ...lineSettings,\n exitPosition: smartConnectLineState.exitPosition,\n }\n );\n}\n","import type { AlignOrigin, NormalizedAlignOrigin } from \"../interfaces\";\n\nconst KeywordMap = new Map([\n [\"center\", 0.5],\n [\"left\", 0],\n [\"right\", 1],\n [\"top\", 0],\n [\"bottom\", 1],\n]);\n\nexport function normalizeAlignOrigin(\n alignOrigin: AlignOrigin | undefined\n): NormalizedAlignOrigin {\n const origin = alignOrigin ?? [0.5, 0.5];\n return [\n normalizeAlignAxis(origin[0], \"x\"),\n normalizeAlignAxis(origin[1], \"y\"),\n ];\n}\n\nfunction normalizeAlignAxis(value: string | number, axis: \"x\" | \"y\"): number {\n if (typeof value === \"string\") {\n const newX = KeywordMap.get(value);\n if (newX !== undefined) {\n return newX;\n }\n const matches = value.match(/^(-?\\d+(?:\\.\\d+)?)%$/);\n if (matches) {\n return Number(matches[1]) / 100;\n }\n // eslint-disable-next-line no-console\n console.error(\"Unexpected align origin %s:\", axis, value);\n } else if (typeof value === \"number\") {\n return value;\n } else {\n // eslint-disable-next-line no-console\n console.error(\n \"Unexpected align origin %s, expected %s, received %s:\",\n axis,\n \"string | number\",\n typeof value,\n value\n );\n }\n\n return 0.5;\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { ZoomBehavior } from \"d3-zoom\";\nimport type {\n Cell,\n LayoutOptions,\n LayoutOptionsForce,\n LayoutOptionsDagre,\n LayoutType,\n NodeId,\n NodeView,\n AutoSize,\n} from \"../../draw-canvas/interfaces\";\nimport type { FullRectTuple, RangeTuple } from \"../../diagram/interfaces\";\nimport { useAutoCenter } from \"./useAutoCenter\";\nimport {\n isNodeCell,\n isNodeOrAreaDecoratorCell,\n isNodeOrEdgeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport {\n SYMBOL_FOR_LAYOUT_INITIALIZED,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\nimport type { DrawCanvasAction } from \"../../draw-canvas/reducers/interfaces\";\nimport { forceLayout } from \"./forceLayout\";\nimport { dagreLayout } from \"./dagreLayout\";\nimport { normalizeAlignOrigin } from \"../../draw-canvas/processors/normalizeAlignOrigin\";\n\nexport interface UseLayoutOptions {\n layout: LayoutType;\n layoutOptions?: LayoutOptions;\n autoSize?: AutoSize;\n rootRef: React.RefObject<SVGSVGElement>;\n cells: Cell[];\n zoomable?: boolean;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n scaleRange: RangeTuple;\n layoutKey: number;\n allowEdgeToArea?: boolean;\n autoCenterWhenCellsChange?: boolean;\n dispatch: (value: DrawCanvasAction) => void;\n}\n\nexport function useLayout({\n layout,\n layoutOptions,\n autoSize,\n rootRef,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n layoutKey,\n allowEdgeToArea,\n autoCenterWhenCellsChange,\n dispatch,\n}: UseLayoutOptions) {\n const [layoutInitialized, setLayoutInitialized] = useState(\n layout !== \"force\" && layout !== \"dagre\"\n );\n\n const layoutKeyRef = useRef(layoutKey);\n\n const getNextLayoutKey = useCallback(() => {\n return ++layoutKeyRef.current;\n }, []);\n\n const [centered, setCentered] = useAutoCenter({\n rootRef,\n layoutInitialized,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n autoCenterWhenCellsChange,\n autoSize,\n padding: layoutOptions?.padding,\n });\n\n const previousLayoutRef = useRef<Cell[] | null>(null);\n\n useEffect(() => {\n // Wait for all nodes to be size-initialized before layout.\n if (\n cells.some(\n (cell) => isNodeCell(cell) && !cell[SYMBOL_FOR_SIZE_INITIALIZED]\n ) ||\n // Skip layout if no cells.\n cells.length === 0\n ) {\n return;\n }\n\n if (layout !== \"force\" && layout !== \"dagre\") {\n setLayoutInitialized(true);\n return;\n }\n\n // DO NOT re-layout if layout key mismatched.\n // DO NOT re-layout if nodes and edges not changed.\n if (\n layoutKeyRef.current !== layoutKey ||\n isSameArray(previousLayoutRef.current, cells.filter(isNodeOrEdgeCell))\n ) {\n // Layout key mismatch happens when this effect is performed after\n // update-node-size dispatched but not yet applied.\n // If didn't ignore mismatched layout, it will cause the update-cells\n // action overwrites those update-node-size actions.\n return;\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n let nodePaddings: FullRectTuple;\n\n if (layout === \"force\") {\n ({ getNodeView, nodePaddings } = forceLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsForce,\n allowEdgeToArea,\n }));\n } else {\n ({ getNodeView, nodePaddings } = dagreLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsDagre,\n allowEdgeToArea,\n }));\n }\n\n const alignOrigin = normalizeAlignOrigin(\n (layoutOptions as LayoutOptionsForce | LayoutOptionsDagre)?.alignOrigin\n );\n\n const newCells: Cell[] = cells.map((cell) => {\n if (\n (allowEdgeToArea && isNodeOrAreaDecoratorCell(cell)) ||\n isNodeCell(cell)\n ) {\n const nodeView = getNodeView(cell.id);\n return {\n ...cell,\n view: {\n ...cell.view,\n x: nodeView.x! - nodeView.width * alignOrigin[0] + nodePaddings[3],\n y: nodeView.y! - nodeView.height * alignOrigin[1] + nodePaddings[0],\n },\n [SYMBOL_FOR_LAYOUT_INITIALIZED]: true,\n };\n }\n return cell;\n });\n previousLayoutRef.current = newCells.filter(isNodeOrEdgeCell);\n\n dispatch({ type: \"update-cells\", payload: newCells });\n // setCentered(false);\n setLayoutInitialized(true);\n }, [\n cells,\n dispatch,\n layout,\n layoutKey,\n layoutOptions,\n allowEdgeToArea /* , setCentered */,\n ]);\n\n return { centered, setCentered, getNextLayoutKey };\n}\n\nfunction isSameArray<T = unknown>(a: T[] | null, b: T[]): boolean {\n return a?.length === b.length && a.every((v, i) => v === b[i]);\n}\n","import React, { useEffect, useState } from \"react\";\nimport { select } from \"d3-selection\";\nimport { ZoomTransform, type ZoomBehavior } from \"d3-zoom\";\nimport type { PartialRectTuple, RangeTuple } from \"../../diagram/interfaces\";\nimport {\n DEFAULT_CANVAS_PADDING,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\nimport type { AutoSize, Cell } from \"../../draw-canvas/interfaces\";\nimport {\n isDecoratorCell,\n isNodeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport { getCellsRect } from \"./processors/getCellsRect\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport { getTransformToCenter } from \"./processors/getTransformToCenter\";\n\nexport interface UseAutoCenterOptions {\n rootRef: React.RefObject<SVGSVGElement>;\n cells: Cell[];\n layoutInitialized: boolean;\n zoomable?: boolean;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n scaleRange: RangeTuple;\n autoCenterWhenCellsChange?: boolean;\n autoSize?: AutoSize;\n padding?: PartialRectTuple;\n}\n\nexport type UseAutoCenterResult = [\n centered: boolean,\n setCentered: React.Dispatch<React.SetStateAction<boolean>>,\n];\n\nexport function useAutoCenter({\n rootRef,\n cells,\n layoutInitialized,\n zoomable,\n zoomer,\n scaleRange,\n autoCenterWhenCellsChange,\n autoSize,\n padding,\n}: UseAutoCenterOptions): UseAutoCenterResult {\n const [centered, setCentered] = useState(false);\n\n useEffect(() => {\n // Reset auto centering when nodes and decorators are all removed,\n // or when cells change and autoCenterWhenCellsChange is enabled.\n if (\n !cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell)) ||\n autoCenterWhenCellsChange\n ) {\n setCentered(false);\n }\n }, [cells, autoCenterWhenCellsChange]);\n\n useEffect(() => {\n const root = rootRef.current;\n if (\n !root ||\n !layoutInitialized ||\n centered ||\n !cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell)) ||\n cells.some(\n (cell) => isNodeCell(cell) && !cell[SYMBOL_FOR_SIZE_INITIALIZED]\n )\n ) {\n return;\n }\n\n const rect = getCellsRect(cells);\n let width = root.clientWidth;\n let height = root.clientHeight;\n const fitWidth = !!autoSize?.width;\n const fitHeight = !!autoSize?.height;\n const fullPadding = extractPartialRectTuple(\n padding ?? DEFAULT_CANVAS_PADDING\n );\n\n // Todo: handle ratio\n if (fitWidth) {\n width = Math.min(\n Math.max(\n rect.width + fullPadding![1] + fullPadding![3],\n autoSize.minWidth ?? 0\n ),\n autoSize.maxWidth ?? Infinity\n );\n root.style.minWidth = `${width}px`;\n }\n if (fitHeight) {\n height = Math.min(\n Math.max(\n rect.height + fullPadding![0] + fullPadding![2],\n autoSize.minHeight ?? 0\n ),\n autoSize.maxHeight ?? Infinity\n );\n root.style.minHeight = `${height}px`;\n }\n\n const { k, x, y } = getTransformToCenter(rect, {\n canvasWidth: width,\n canvasHeight: height,\n canvasPadding: fullPadding,\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 }, [\n cells,\n centered,\n layoutInitialized,\n rootRef,\n scaleRange,\n zoomable,\n zoomer,\n autoSize,\n padding,\n ]);\n\n return [centered, setCentered];\n}\n","import type {\n FullRectTuple,\n TransformLiteral,\n} from \"../../../diagram/interfaces\";\nimport type { CellsRect } from \"../../../draw-canvas/interfaces\";\n\nexport interface TransformToCenterOptions {\n canvasWidth: number;\n canvasHeight: number;\n canvasPadding?: FullRectTuple | null;\n scaleRange?: [min: number, max: number];\n}\n\nexport function getTransformToCenter(\n rect: CellsRect,\n {\n canvasWidth,\n canvasHeight,\n canvasPadding,\n scaleRange,\n }: TransformToCenterOptions\n): TransformLiteral {\n const { left, top, width, height, empty } = rect;\n\n // Apply padding to available canvas dimensions\n const [paddingTop, paddingRight, paddingBottom, paddingLeft] =\n canvasPadding ?? [0, 0, 0, 0];\n const availableWidth = canvasWidth - paddingLeft - paddingRight;\n const availableHeight = canvasHeight - paddingTop - paddingBottom;\n\n const scale =\n scaleRange && !empty && (width > availableWidth || height > availableHeight)\n ? Math.max(\n Math.min(\n availableWidth / width,\n availableHeight / height,\n scaleRange[1]\n ),\n scaleRange[0]\n )\n : 1;\n\n // Adjust center calculation to account for padding\n const x = empty\n ? 0\n : (availableWidth - width * scale) / 2 + paddingLeft - left * scale;\n const y = empty\n ? 0\n : (availableHeight - height * scale) / 2 + paddingTop - top * scale;\n\n return { x, y, k: scale };\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\nimport { sameTarget } from \"../../draw-canvas/processors/sameTarget\";\n\nexport interface UseActiveTargetOptions {\n rootRef: React.RefObject<SVGGElement>;\n activeTarget?: ActiveTarget | null;\n doNotResetActiveTargetForSelector?: string;\n doNotResetActiveTargetOutsideCanvas?: boolean;\n onActiveTargetChange(target: ActiveTarget | null): void;\n}\n\nexport type UseActiveTargetResult = ActiveTarget | null;\n\nexport function useActiveTarget({\n rootRef,\n activeTarget: _activeTarget,\n doNotResetActiveTargetForSelector,\n doNotResetActiveTargetOutsideCanvas,\n onActiveTargetChange,\n}: UseActiveTargetOptions): UseActiveTargetResult {\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 useEffect(() => {\n if (!activeTarget) {\n return;\n }\n const resetActiveTarget = (e: MouseEvent) => {\n const path = e.composedPath();\n const rootIndex = path.indexOf(rootRef.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 (\n doNotResetActiveTargetOutsideCanvas\n ? rootIndex === 0\n : rootIndex <= 0 &&\n !(\n doNotResetActiveTargetForSelector &&\n path.some(\n (el) =>\n el instanceof Element &&\n el.matches(doNotResetActiveTargetForSelector)\n )\n )\n ) {\n setActiveTarget(null);\n }\n };\n document.addEventListener(\"click\", resetActiveTarget);\n return () => {\n document.removeEventListener(\"click\", resetActiveTarget);\n };\n }, [\n activeTarget,\n doNotResetActiveTargetOutsideCanvas,\n doNotResetActiveTargetForSelector,\n rootRef,\n ]);\n\n return activeTarget;\n}\n","import { pick } from \"lodash\";\nimport type { NodePosition, PositionTuple } from \"../../../diagram/interfaces\";\nimport type { HoverState } from \"../../../draw-canvas/HoverStateContext\";\nimport type {\n LineEditorState,\n LineEditorStateOfControl,\n EditableLine,\n EditableLineCell,\n EditableLineView,\n DecoratorLineView,\n NodeView,\n} from \"../../../draw-canvas/interfaces\";\nimport { getSmartLinePoints, simplifyVertices } from \"./getSmartLinePoints\";\nimport { isEditableEdgeLine } from \"../../../draw-canvas/processors/asserts\";\n\nexport function getEditingLinePoints(\n activeEditableLine: EditableLineCell | null,\n lineEditorState: LineEditorState | null,\n editableLineMap: WeakMap<EditableLineCell, EditableLine>,\n connectLineTo: PositionTuple | null,\n hoverState: HoverState | null\n): NodePosition[] | null {\n if (\n !activeEditableLine ||\n !lineEditorState ||\n !(\n connectLineTo ||\n (lineEditorState.type !== \"control\" &&\n hoverState?.activePointIndex !== undefined)\n )\n ) {\n return null;\n }\n\n const editableLine = editableLineMap.get(activeEditableLine);\n if (!editableLine) {\n return null;\n }\n\n const { type } = lineEditorState;\n let sourceView: NodeView;\n let targetView: NodeView;\n\n const cellType = activeEditableLine.type;\n if (isEditableEdgeLine(editableLine)) {\n sourceView = editableLine.source.view;\n targetView = editableLine.target.view;\n } else {\n const view = editableLine.decorator.view as DecoratorLineView;\n sourceView = { ...view.source, width: 0, height: 0 };\n targetView = { ...view.target, width: 0, height: 0 };\n }\n const view = activeEditableLine.view as EditableLineView;\n const { exitPosition, entryPosition, vertices } = view ?? {};\n const lineSettings = pick(view, [\"type\", \"curveType\"]);\n\n if (type === \"control\") {\n const newVertices = getNewLineVertices(\n activeEditableLine,\n lineEditorState,\n editableLineMap,\n connectLineTo!\n );\n\n return getSmartLinePoints(\n sourceView,\n targetView,\n {\n ...lineSettings,\n exitPosition,\n entryPosition,\n vertices: newVertices,\n },\n 0,\n cellType\n );\n }\n\n if (type === \"corner\") {\n const newVertices = [...vertices!];\n newVertices.splice(lineEditorState.control.index, 1, {\n x: connectLineTo![0],\n y: connectLineTo![1],\n });\n\n return getSmartLinePoints(\n sourceView,\n targetView,\n {\n ...lineSettings,\n exitPosition,\n entryPosition,\n vertices: newVertices,\n },\n 0,\n cellType\n );\n }\n\n if (type === \"break\") {\n const newVertices = [...(vertices ?? [])];\n newVertices.splice(lineEditorState.control.index, 0, {\n x: connectLineTo![0],\n y: connectLineTo![1],\n });\n\n return getSmartLinePoints(\n sourceView,\n targetView,\n {\n ...lineSettings,\n exitPosition,\n entryPosition,\n vertices: newVertices,\n },\n 0,\n cellType\n );\n }\n\n if (cellType === \"edge\" && hoverState?.activePointIndex !== undefined) {\n const position = hoverState.relativePoints[hoverState.activePointIndex];\n // Assert `hoverState.cell` is `target`\n return getSmartLinePoints(\n sourceView,\n targetView,\n {\n ...lineSettings,\n ...(type === \"entry\"\n ? {\n exitPosition,\n entryPosition: position,\n }\n : {\n exitPosition: position,\n entryPosition,\n }),\n vertices,\n },\n 0,\n cellType\n );\n }\n\n const [x1, y1] = connectLineTo!;\n\n if (type === \"entry\") {\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n { ...lineSettings, exitPosition, vertices },\n 0,\n cellType\n );\n }\n\n return getSmartLinePoints(\n { x: x1, y: y1, width: 0, height: 0 },\n targetView,\n { ...lineSettings, entryPosition, vertices },\n 0,\n cellType\n );\n}\n\nexport function getNewLineVertices(\n activeEditableLine: EditableLineCell,\n lineEditorState: LineEditorStateOfControl,\n editableLineMap: WeakMap<EditableLineCell, EditableLine>,\n connectLineTo: PositionTuple\n) {\n const { control } = lineEditorState;\n const { points: linePoints } = editableLineMap.get(activeEditableLine)!;\n const newVertices: NodePosition[] = [];\n const [x1, y1] = connectLineTo!;\n const exitPoint = linePoints[0];\n const entryPoint = linePoints[linePoints.length - 1];\n\n // If moving the first control, prepend a vertex to connect the control to the source\n if (control.index === 0) {\n newVertices.push(\n control.direction === \"ns\"\n ? { x: exitPoint.x, y: y1 }\n : { x: x1, y: exitPoint.y }\n );\n }\n\n // Adjust the related two controls, and leave other controls unchanged\n for (let i = 1; i < linePoints.length - 1; i++) {\n const vertex = linePoints[i];\n newVertices.push(\n i === control.index || i === control.index + 1\n ? control.direction === \"ns\"\n ? { x: vertex.x, y: y1 }\n : { x: x1, y: vertex.y }\n : vertex\n );\n }\n\n // If moving the last control, append a vertex to connect the control to the target\n if (control.index === linePoints.length - 2) {\n newVertices.push(\n control.direction === \"ns\"\n ? { x: entryPoint.x, y: y1 }\n : { x: x1, y: entryPoint.y }\n );\n }\n\n return simplifyVertices(exitPoint, newVertices, entryPoint);\n}\n","// istanbul ignore file: experimental\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n Cell,\n ComputedLineConnecterConf,\n EditableEdgeLine,\n EditableLine,\n EditableLineCell,\n EditableLineView,\n LineEditorState,\n LineEditorStateOfControl,\n} from \"./interfaces\";\nimport type {\n LineMarkerConf,\n NodePosition,\n PositionTuple,\n TransformLiteral,\n} from \"../diagram/interfaces\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport {\n getEditingLinePoints,\n getNewLineVertices,\n} from \"../shared/canvas/processors/getEditingLinePoints\";\nimport { getMarkers } from \"../shared/canvas/useLineMarkers\";\nimport { isEdgeCell, isLineDecoratorCell } from \"./processors/asserts\";\n\nconst LOOSE_CONTROL_TYPES = [\n \"control\",\n \"corner\",\n \"break\",\n] as LineEditorState[\"type\"][];\n\nexport interface EditingLineComponentProps {\n cells: Cell[];\n editableLineMap: WeakMap<EditableLineCell, EditableLine>;\n transform: TransformLiteral;\n options: ComputedLineConnecterConf;\n activeEditableLine: EditableLineCell | null;\n}\n\nexport function EditingLineComponent({\n cells,\n editableLineMap,\n transform,\n options,\n activeEditableLine,\n}: EditingLineComponentProps): JSX.Element {\n const [connectLineTo, setConnectLineTo] = useState<PositionTuple | null>(\n null\n );\n const {\n hoverState,\n lineEditorState,\n setLineEditorState,\n onChangeEdgeView,\n onChangeDecoratorView,\n } = useHoverStateContext();\n const movedRef = useRef(false);\n\n useEffect(() => {\n if (!lineEditorState) {\n setTimeout(() => {\n movedRef.current = false;\n }, 0);\n }\n }, [lineEditorState]);\n\n useEffect(() => {\n if (!activeEditableLine || !lineEditorState) {\n return;\n }\n movedRef.current = false;\n const { type, offset, from } = lineEditorState;\n // Set connect line to based on the mouse position and the transform\n const getConnectTo = (e: MouseEvent): PositionTuple => {\n const position: NodePosition = {\n x: (e.clientX - transform.x - offset[0]) / transform.k,\n y: (e.clientY - transform.y - offset[1]) / transform.k,\n };\n const linePoints = editableLineMap.get(activeEditableLine)!.points;\n const snapDistance = 5;\n const diff: NodePosition = { x: Infinity, y: Infinity };\n let otherPoints: NodePosition[];\n let axises: (\"x\" | \"y\")[];\n\n const getFinalPosition = (): PositionTuple => {\n if (!movedRef.current) {\n const movementX = (e.clientX - from[0]) / transform.k;\n const movementY = (e.clientY - from[1]) / transform.k;\n movedRef.current = movementX ** 2 + movementY ** 2 >= 9;\n }\n\n return [position.x, position.y];\n };\n\n if (LOOSE_CONTROL_TYPES.includes(type) && !e.altKey) {\n // Snap to other points\n const control = (lineEditorState as LineEditorStateOfControl).control;\n axises =\n type === \"control\"\n ? [control.direction === \"ns\" ? \"y\" : \"x\"]\n : [\"x\", \"y\"];\n otherPoints = linePoints.filter(\n (_, i) =>\n i === 0 ||\n i === linePoints.length - 1 ||\n (type === \"control\"\n ? i !== control.index && i !== control.index + 1\n : type !== \"corner\" || i !== control.index + 1)\n );\n } else if (\n isLineDecoratorCell(activeEditableLine) &&\n (type === \"exit\" || type === \"entry\") &&\n !e.altKey\n ) {\n const endpoint =\n type === \"exit\" ? linePoints[0] : linePoints[linePoints.length - 1];\n otherPoints = linePoints.filter((p) => p !== endpoint);\n axises = [\"x\", \"y\"];\n } else {\n return getFinalPosition();\n }\n\n // Snap to control points of other lines\n for (const cell of cells) {\n if (\n !(isEdgeCell(cell) || isLineDecoratorCell(cell)) ||\n cell === activeEditableLine\n ) {\n continue;\n }\n const editableLine = editableLineMap.get(cell);\n if (editableLine) {\n otherPoints.push(...editableLine.points.slice(1, -1));\n }\n }\n\n for (const point of otherPoints) {\n for (const axis of axises) {\n const newDiff = Math.abs(point[axis] - position[axis]);\n if (newDiff <= snapDistance && newDiff < diff[axis]) {\n position[axis] = point[axis];\n diff[axis] = newDiff;\n }\n }\n }\n\n return getFinalPosition();\n };\n const onMouseMove = (e: MouseEvent) => {\n const newConnectTo = getConnectTo(e);\n if (movedRef.current) {\n setConnectLineTo(newConnectTo);\n }\n };\n function onMouseUp(e: MouseEvent) {\n e.preventDefault();\n reset();\n\n if (!movedRef.current) {\n return;\n }\n\n const newConnectTo = getConnectTo(e);\n const isEdge = isEdgeCell(activeEditableLine!);\n\n if (lineEditorState?.type === \"control\") {\n if (isEdge) {\n const editableLine = editableLineMap.get(\n activeEditableLine!\n ) as EditableEdgeLine;\n const { source, target } = editableLine;\n onChangeEdgeView?.(source, target, {\n ...activeEditableLine!.view,\n vertices: getNewLineVertices(\n activeEditableLine!,\n lineEditorState,\n editableLineMap,\n newConnectTo\n ),\n });\n } else {\n onChangeDecoratorView?.(activeEditableLine!, {\n ...activeEditableLine!.view,\n vertices: getNewLineVertices(\n activeEditableLine!,\n lineEditorState,\n editableLineMap,\n newConnectTo\n ),\n });\n }\n return;\n }\n\n if (isEdge) {\n return;\n }\n\n switch (lineEditorState?.type) {\n case \"entry\":\n case \"exit\":\n onChangeDecoratorView?.(activeEditableLine!, {\n ...activeEditableLine!.view,\n [lineEditorState.type === \"entry\" ? \"target\" : \"source\"]: {\n x: newConnectTo[0],\n y: newConnectTo[1],\n },\n });\n break;\n case \"corner\":\n onChangeDecoratorView?.(activeEditableLine!, {\n ...activeEditableLine!.view,\n vertices: activeEditableLine!.view.vertices!.map((point, i) =>\n i === lineEditorState.control.index\n ? { x: newConnectTo[0], y: newConnectTo[1] }\n : point\n ),\n });\n break;\n case \"break\": {\n const newVertices = [...(activeEditableLine!.view.vertices ?? [])];\n newVertices.splice(lineEditorState.control.index, 0, {\n x: newConnectTo[0],\n y: newConnectTo[1],\n });\n onChangeDecoratorView?.(activeEditableLine!, {\n ...activeEditableLine!.view,\n vertices: newVertices,\n });\n break;\n }\n }\n }\n function reset() {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n setConnectLineTo(null);\n setLineEditorState(null);\n }\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n\n return reset;\n }, [\n activeEditableLine,\n editableLineMap,\n lineEditorState,\n transform,\n setLineEditorState,\n onChangeEdgeView,\n cells,\n onChangeDecoratorView,\n ]);\n\n useEffect(() => {\n if (!activeEditableLine) {\n return;\n }\n const handleBodyClick = (e: MouseEvent) => {\n if (movedRef.current) {\n e.stopPropagation();\n e.preventDefault();\n }\n };\n document.body.addEventListener(\"click\", handleBodyClick);\n return () => {\n document.body.removeEventListener(\"click\", handleBodyClick);\n };\n }, [activeEditableLine]);\n\n const line = useMemo(() => {\n const points = getEditingLinePoints(\n activeEditableLine,\n lineEditorState,\n editableLineMap,\n connectLineTo,\n hoverState\n );\n const view = activeEditableLine?.view as EditableLineView | undefined;\n return curveLine(\n points,\n view?.type === \"curve\" ? view.curveType : \"curveLinear\",\n 0,\n 1\n );\n }, [\n connectLineTo,\n hoverState,\n activeEditableLine,\n lineEditorState,\n editableLineMap,\n ]);\n let markerStart: string | undefined;\n let markerEnd: string | undefined;\n const lineMarkers: LineMarkerConf[] = getMarkers(options);\n for (const marker of lineMarkers) {\n if (marker.placement === \"start\") {\n markerStart = options.$editingStartMarkerUrl;\n } else {\n markerEnd = options.$editingEndMarkerUrl;\n }\n }\n\n return (\n <path\n className={classNames(\"editing-line\", {\n editing: !!(lineEditorState && connectLineTo),\n })}\n d={line}\n fill=\"none\"\n stroke={options.editingStrokeColor}\n markerStart={markerStart}\n markerEnd={markerEnd}\n />\n );\n}\n","import { get, orderBy } from \"lodash\";\nimport {\n ActiveTarget,\n BaseNodeCell,\n Cell,\n DecoratorCell,\n InitialCell,\n NodeCell,\n} from \"../interfaces\";\nimport { LayoutOptions } from \"./initialContainerLayout\";\nimport {\n isEdgeCell,\n isGroupDecoratorCell,\n isNodeCell,\n isNoPoint,\n isNoSize,\n} from \"./asserts\";\nimport { dagreLayout } from \"../../shared/canvas/dagreLayout\";\nimport { staggeredLayout } from \"./staggeredLayout\";\nimport { computeBoundingBox } from \"./computeBoundingBox\";\nimport { CONTAINERGAP } from \"../constants\";\nexport const GROUPPADDING = 12;\n\nexport function initialGroupLayout(\n cells: InitialCell[],\n options: LayoutOptions = {}\n) {\n const groupMap: Record<string, Omit<Cell, \"DecoratorCell\">[]> = {};\n const decoratorCells = cells.filter(\n (c) => isGroupDecoratorCell(c) && isNoPoint(c.view)\n ) as DecoratorCell[];\n\n if (!decoratorCells.length) return { groupMap };\n const { nodeLayout = \"dagre\" } = options;\n const nodeCells = cells.filter((c) => c.type === \"node\") as NodeCell[];\n const edgeCells = cells.filter(isEdgeCell);\n\n // 预处理 decoratorCells,以便后续查找更高效\n const containerCellMap = new Map<string, DecoratorCell>();\n decoratorCells.forEach((cell) => {\n containerCellMap.set(cell.id, cell);\n });\n\n const groupNameMap: Record<string, Set<string>> = {};\n\n // 分组节点并构建 groupNameMap\n nodeCells.forEach((node) => {\n const { groupId } = node;\n if (groupId) {\n if (!groupMap[groupId]) {\n groupMap[groupId] = [];\n groupNameMap[groupId] = new Set();\n }\n groupMap[groupId].push(node);\n groupNameMap[groupId].add(node.id);\n }\n });\n\n // 把边加入所属组\n edgeCells.forEach((edge) => {\n for (const [groupId, idSet] of Object.entries(groupNameMap)) {\n if (idSet.has(edge.source) && idSet.has(edge.target)) {\n groupMap[groupId].push(edge);\n break;\n }\n }\n });\n\n const containerGap = 0;\n // 排序组层级,level越大越后面;没有大小都排后面\n const sortedGroupIds = orderBy(\n decoratorCells.filter((cell) => groupMap[cell.id]),\n [(o) => (isNoSize(o.view) ? 1 : 0), (o) => get(o, \"view.level\", 1)],\n [\"asc\", \"asc\"]\n ).map((cell) => cell.id);\n processSortedGroups(\n sortedGroupIds,\n groupMap,\n containerCellMap,\n nodeLayout,\n containerGap\n );\n return { groupMap };\n}\n\nfunction processSortedGroups(\n sortedGroupIds: string[],\n containerGroup: Record<string, Omit<Cell, \"DecoratorCell\">[]>,\n containerCellMap: Map<string, DecoratorCell>,\n nodeLayout: string,\n containerGap: number\n) {\n let currentContainerGap = containerGap;\n sortedGroupIds.forEach((groupId) => {\n const groupCell = containerCellMap.get(groupId)!;\n const groupedCells = containerGroup[groupId] as Cell[];\n const nodeCells = groupedCells.filter(\n (cell) => cell.type === \"node\"\n ) as NodeCell[];\n\n currentContainerGap += +(GROUPPADDING + CONTAINERGAP * 2); //加上容器的间距,分组间距后面会在initialContainerLayout调整减掉一个GROUPPADDING\n\n let nodeViews: (NodeCell | DecoratorCell)[] = [];\n if (nodeLayout === \"dagre\") {\n const { getNodeView } = dagreLayout({ cells: nodeCells });\n nodeViews = nodeCells.map((node: NodeCell) => {\n if (isNoPoint(node.view)) {\n const view = getNodeView(node.id);\n node.view = {\n ...node.view,\n x: view.x,\n y: view.y + currentContainerGap,\n width: view.width,\n height: view.height,\n };\n }\n return node;\n });\n } else if (nodeLayout === \"staggered\") {\n nodeViews = staggeredLayout(nodeCells, {\n offsetY: currentContainerGap,\n });\n }\n\n const containerRect = computeBoundingBox(nodeViews as BaseNodeCell[], {\n padding: GROUPPADDING,\n });\n groupCell.view = { ...groupCell.view, ...containerRect };\n currentContainerGap += get(containerRect, \"height\", 0) + CONTAINERGAP;\n });\n return {\n updatedGap: currentContainerGap,\n };\n}\n\nexport function highlightGroupCell(\n cell: DecoratorCell,\n activeTarget: ActiveTarget | null | undefined,\n cells: Cell[]\n) {\n let activeTargetCells = [],\n active = false;\n // istanbul ignore next\n if (activeTarget?.type === \"multi\") {\n activeTargetCells = activeTarget.targets;\n } else if (activeTarget?.type === \"node\") {\n activeTargetCells.push(activeTarget);\n } else if (activeTarget?.type === \"decorator\") {\n active = activeTarget.id === cell.id;\n return active;\n }\n active = activeTargetCells.some(\n (item) =>\n item?.type === \"node\" &&\n (cells.find((c) => isNodeCell(c) && c.id === item.id) as NodeCell)\n ?.groupId === cell.id\n );\n return active;\n}\n","import { Cell, DecoratorCell, NodeCell } from \"../interfaces\";\nimport { MoveCellPayload } from \"../reducers/interfaces\";\nimport {\n isContainerDecoratorCell,\n isGroupDecoratorCell,\n isNodeCell,\n} from \"./asserts\";\n\nexport function handleNodeContainedChange(\n payloads: MoveCellPayload[],\n cells: Cell[],\n onContainerContainerChange?: (detail: MoveCellPayload[]) => void\n) {\n const nodeAndGroupCells = cells.filter(\n (c): c is NodeCell => isNodeCell(c) || isGroupDecoratorCell(c)\n );\n const containerIds = payloads\n .filter((p) => isContainerDecoratorCell(p))\n .map((v) => v.id);\n const cellPayloads = payloads.filter((p) => {\n const cell = nodeAndGroupCells.find((v) => v.id === p.id)!;\n const includeNodeFlag =\n cell?.containerId && containerIds.includes(cell.containerId);\n return (\n ((isNodeCell(p) && !p.groupId) || isGroupDecoratorCell(p)) &&\n !includeNodeFlag\n );\n });\n const containerDecoratorCells = cells.filter(\n (cell): cell is DecoratorCell =>\n isContainerDecoratorCell(cell) && !cell.view?.locked\n );\n cellPayloads.forEach((payload) => {\n const left = payload.x;\n const right = payload.x + payload.width!;\n const top = payload.y;\n const bottom = payload.y + payload!.height!;\n\n for (const containerCell of containerDecoratorCells) {\n const containerLeft = containerCell.view.x;\n const containerRight = containerCell.view.x + containerCell.view.width;\n const containerTop = containerCell.view.y;\n const containerBottom = containerCell.view.y + containerCell.view.height;\n if (\n left >= containerLeft &&\n right <= containerRight &&\n top >= containerTop &&\n bottom <= containerBottom\n ) {\n payload.containerCell = containerCell;\n break; //A node can be associated with only one container\n }\n }\n });\n let containedChanges = [];\n containedChanges = cellPayloads.filter((payload) => {\n const cell = nodeAndGroupCells.find((c) => c.id === payload.id);\n const containerId = cell?.containerId;\n const containerCellId = payload.containerCell?.id;\n //过滤掉一直没有关系或者关系没有改变的\n return containerId !== containerCellId;\n });\n if (containedChanges.length > 0) {\n onContainerContainerChange?.(containedChanges);\n }\n return containedChanges;\n}\n","// istanbul ignore file: experimental\nimport React, { useEffect, useMemo, useRef } from \"react\";\nimport type { NodePosition } from \"../diagram/interfaces\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport type {\n ControlPoint,\n EditableLine,\n EditableLineCell,\n EditableLineView,\n} from \"./interfaces\";\nimport { isLineDecoratorCell, isStraightType } from \"./processors/asserts\";\n\nconst POINT_HELPER_IMAGE =\n \"data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOI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EuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIyMnB4IiBoZWlnaHQ9IjIycHgiIHZlcnNpb249IjEuMSI+PGNpcmNsZSBjeD0iMTEiIGN5PSIxMSIgcj0iNyIgc3Ryb2tlPSIjZmZmIiBmaWxsPSIjMDFiZDIyIi8+PHBhdGggZD0ibSA4IDggTCAxNCAxNE0gOCAxNCBMIDE0IDgiIHN0cm9rZT0iI2ZmZiIvPjwvc3ZnPg==\";\nconst VERTEX_HELPER_IMAGE =\n \"data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIxOHB4IiBoZWlnaHQ9IjE4cHgiIHZlcnNpb249IjEuMSI+PGNpcmNsZSBjeD0iOSIgY3k9IjkiIHI9IjUiIHN0cm9rZT0iI2ZmZiIgZmlsbD0iIzI5YjZmMiIvPjwvc3ZnPg==\";\nconst POINT_HELPER_BG_SIZE = 22;\n\nexport interface LineEditorComponentProps {\n scale: number;\n editableLineMap: WeakMap<EditableLineCell, EditableLine>;\n activeEditableLine: EditableLineCell;\n updateCurActiveEditableLine?: (\n activeEditableLine: EditableLineCell | null\n ) => void;\n}\n\nexport function LineEditorComponent({\n scale,\n editableLineMap,\n activeEditableLine,\n updateCurActiveEditableLine,\n}: LineEditorComponentProps): JSX.Element | null {\n const { rootRef, movingCells, lineEditorState, setLineEditorState } =\n useHoverStateContext();\n const exitRef = useRef<SVGImageElement>(null);\n const entryRef = useRef<SVGImageElement>(null);\n const controlPointsRef = useRef<(SVGImageElement | null)[]>([]);\n const isLineDecorator = isLineDecoratorCell(activeEditableLine);\n\n useEffect(() => {\n const exit = exitRef.current;\n const entry = entryRef.current;\n if (!exit || !entry || !activeEditableLine) {\n return;\n }\n const handleMouseDownFactory = (type: \"exit\" | \"entry\") => {\n return (e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n const rect = rootRef.current!.getBoundingClientRect();\n setLineEditorState({\n offset: [rect.left, rect.top],\n from: [e.clientX, e.clientY],\n type,\n });\n updateCurActiveEditableLine?.(activeEditableLine);\n };\n };\n const handleStartMouseDown = handleMouseDownFactory(\"exit\");\n const handleEndMouseDown = handleMouseDownFactory(\"entry\");\n exit.addEventListener(\"mousedown\", handleStartMouseDown);\n entry.addEventListener(\"mousedown\", handleEndMouseDown);\n return () => {\n exit.removeEventListener(\"mousedown\", handleStartMouseDown);\n entry.removeEventListener(\"mousedown\", handleEndMouseDown);\n };\n }, [\n activeEditableLine,\n rootRef,\n setLineEditorState,\n updateCurActiveEditableLine,\n ]);\n\n const controlPoints = useMemo(() => {\n if (!activeEditableLine) {\n return [];\n }\n\n const points = editableLineMap.get(activeEditableLine)!.points!;\n\n if (isStraightType((activeEditableLine.view as EditableLineView)?.type)) {\n return isLineDecorator ? getStraightControlPoints(points) : [];\n }\n\n return getControlPoints(points);\n }, [activeEditableLine, editableLineMap, isLineDecorator]);\n\n useEffect(() => {\n if (!activeEditableLine) {\n return;\n }\n const controlElements = controlPointsRef.current;\n const handleMouseDownFactory = (control: ControlPoint) => {\n return (e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n updateCurActiveEditableLine?.(activeEditableLine);\n const rect = rootRef.current!.getBoundingClientRect();\n setLineEditorState({\n offset: [rect.left, rect.top],\n from: [e.clientX, e.clientY],\n type: control.type,\n control,\n });\n };\n };\n const handlers = controlPoints.map((control) =>\n handleMouseDownFactory(control)\n );\n controlElements.forEach((el, i) => {\n el?.addEventListener(\"mousedown\", handlers[i]);\n });\n return () => {\n controlElements.forEach((el, i) => {\n el?.removeEventListener(\"mousedown\", handlers[i]);\n });\n };\n }, [\n activeEditableLine,\n controlPoints,\n rootRef,\n setLineEditorState,\n updateCurActiveEditableLine,\n ]);\n\n const gRef = useRef<SVGGElement>(null);\n useEffect(() => {\n const g = gRef.current;\n const onClick = (e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n };\n g?.addEventListener(\"click\", onClick);\n return () => {\n g?.removeEventListener(\"click\", onClick);\n };\n }, []);\n\n if (movingCells) {\n return null;\n }\n\n const view = activeEditableLine.view as EditableLineView;\n const linePoints = editableLineMap.get(activeEditableLine)!.points!;\n const { exitPosition, entryPosition } = view ?? {};\n\n const commonProps: React.SVGAttributes<SVGImageElement> = {\n width: POINT_HELPER_BG_SIZE / scale,\n height: POINT_HELPER_BG_SIZE / scale,\n preserveAspectRatio: \"none\",\n cursor: \"pointer\",\n pointerEvents: \"fill\",\n };\n const exitPoint = linePoints[0];\n const entryPoint = linePoints[linePoints.length - 1];\n const offset = POINT_HELPER_BG_SIZE / scale / 2;\n\n return (\n <g ref={gRef}>\n <image\n ref={exitRef}\n {...commonProps}\n x={exitPoint.x - offset}\n y={exitPoint.y - offset}\n xlinkHref={\n isLineDecorator\n ? VERTEX_HELPER_IMAGE\n : exitPosition\n ? ANCHORED_POINT_HELPER_IMAGE\n : POINT_HELPER_IMAGE\n }\n />\n {controlPoints.map((point, i) => (\n <image\n key={i}\n ref={(el) => {\n controlPointsRef.current[i] = el;\n }}\n {...commonProps}\n x={point.x - offset}\n y={point.y - offset}\n opacity={\n point.type === \"break\" &&\n !(\n lineEditorState?.type === \"break\" &&\n lineEditorState.control === point\n )\n ? 0.4\n : 1\n }\n xlinkHref={VERTEX_HELPER_IMAGE}\n cursor={\n isLineDecorator\n ? \"crosshair\"\n : point.direction === \"ns\"\n ? \"row-resize\"\n : \"col-resize\"\n }\n />\n ))}\n <image\n ref={entryRef}\n {...commonProps}\n x={entryPoint.x - offset}\n y={entryPoint.y - offset}\n xlinkHref={\n isLineDecorator\n ? END_POINT_HELPER_IMAGE\n : entryPosition\n ? ANCHORED_POINT_HELPER_IMAGE\n : POINT_HELPER_IMAGE\n }\n />\n </g>\n );\n}\n\nfunction getControlPoints(linePoints: NodePosition[]): ControlPoint[] {\n const controlPoints: ControlPoint[] = [];\n let prev = linePoints[0];\n let cursor = 1;\n while (cursor < linePoints.length) {\n const next = linePoints[cursor];\n const ns = prev.y === next.y;\n const ew = prev.x === next.x;\n if (!(ns && ew)) {\n const direction = ns ? \"ns\" : \"ew\";\n controlPoints.push({\n type: \"control\",\n direction,\n index: cursor - 1,\n x: (prev.x + next.x) / 2,\n y: (prev.y + next.y) / 2,\n });\n }\n prev = next;\n cursor++;\n }\n\n return controlPoints;\n}\n\nfunction getStraightControlPoints(linePoints: NodePosition[]): ControlPoint[] {\n const controlPoints: ControlPoint[] = [];\n let prev = linePoints[0];\n let cursor = 1;\n while (cursor < linePoints.length) {\n const next = linePoints[cursor];\n controlPoints.push({\n type: \"break\",\n index: cursor - 1,\n x: (prev.x + next.x) / 2,\n y: (prev.y + next.y) / 2,\n });\n if (cursor < linePoints.length - 1) {\n controlPoints.push({\n ...next,\n type: \"corner\",\n index: cursor - 1,\n });\n }\n prev = next;\n cursor++;\n }\n\n return controlPoints;\n}\n","import type { PositionTuple, TransformLiteral } from \"../../diagram/interfaces\";\nimport type { NodeView } from \"../interfaces\";\n\nexport interface HandleLassoOptions {\n transform: TransformLiteral;\n offset: PositionTuple;\n onLassoing(rect: NodeView): void;\n onLassoed(rect: NodeView): void;\n}\n\nexport function handleLasso(\n event: MouseEvent,\n { transform, offset, onLassoing, onLassoed }: HandleLassoOptions\n) {\n if (event.ctrlKey || event.button) {\n return;\n }\n\n event.stopPropagation();\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const x0 = (event.clientX - offset[0] - transform.x) / transform.k;\n const y0 = (event.clientY - offset[1] - transform.y) / transform.k;\n\n function getMovement(e: MouseEvent): PositionTuple {\n return [\n (e.clientX - from[0]) / transform.k,\n (e.clientY - from[1]) / transform.k,\n ];\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 if (moved) {\n let [width, height] = movement;\n let x = x0;\n let y = y0;\n if (width < 0) {\n x = x0 + width;\n width = -width;\n }\n if (height < 0) {\n y = y0 + height;\n height = -height;\n }\n (finished ? onLassoed : onLassoing)({\n x,\n y,\n width,\n height,\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","// istanbul ignore file: experimental\nimport React, { useCallback, useEffect, useRef } from \"react\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport type {\n ActiveTarget,\n Cell,\n EditableEdgeLine,\n EditableLine,\n EditableLineCell,\n NodeCell,\n} from \"./interfaces\";\nimport { targetIsActive } from \"./processors/targetIsActive\";\nimport type { NodePosition } from \"../diagram/interfaces\";\nimport { DEFAULT_NODE_PADDING_FOR_SMART_LINES } from \"./constants\";\nimport { isEditableEdgeLine } from \"./processors/asserts\";\n\nconst HELPER_IMAGE =\n \"data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSI1cHgiIGhlaWdodD0iNXB4IiB2ZXJzaW9uPSIxLjEiPjxwYXRoIGQ9Im0gMCAwIEwgNSA1IE0gMCA1IEwgNSAwIiBzdHJva2Utd2lkdGg9IjIiIHN0eWxlPSJzdHJva2Utb3BhY2l0eTowLjQiIHN0cm9rZT0iI2ZmZmZmZiIvPjxwYXRoIGQ9Im0gMCAwIEwgNSA1IE0gMCA1IEwgNSAwIiBzdHJva2U9IiMyOWI2ZjIiLz48L3N2Zz4=\";\nconst HELPER_RADIUS = 5;\nconst HELPER_BG_RADIUS = 8;\nconst HALF_HELPER_RADIUS = HELPER_RADIUS / 2;\n\nexport interface LineConnectorComponentProps {\n activeTarget: ActiveTarget | null;\n editableLineMap: WeakMap<EditableLineCell, EditableLine>;\n scale: number;\n activeEditableLine: EditableLineCell | null;\n disabled?: boolean;\n}\n\nexport function LineConnectorComponent({\n activeTarget,\n editableLineMap,\n scale,\n activeEditableLine,\n disabled,\n}: LineConnectorComponentProps): JSX.Element | null {\n const {\n unsetHoverStateTimeoutRef,\n hoverState,\n setHoverState,\n smartConnectLineState,\n lineEditorState,\n } = useHoverStateContext();\n\n const unsetTimeout = useCallback(() => {\n if (unsetHoverStateTimeoutRef.current !== null) {\n clearTimeout(unsetHoverStateTimeoutRef.current);\n unsetHoverStateTimeoutRef.current = null;\n }\n }, [unsetHoverStateTimeoutRef]);\n\n const unsetActivePointIndex = useCallback(() => {\n unsetTimeout();\n setHoverState((prev) =>\n prev?.activePointIndex === undefined\n ? prev\n : { ...hoverState!, activePointIndex: undefined }\n );\n }, [hoverState, setHoverState, unsetTimeout]);\n\n const unsetHoverState = useCallback(() => {\n unsetHoverStateTimeoutRef.current = setTimeout(() => {\n setHoverState(null);\n }) as unknown as number;\n }, [setHoverState, unsetHoverStateTimeoutRef]);\n\n let source: Cell | undefined;\n let target: Cell | undefined;\n let editableLine: EditableLine | undefined;\n\n const available =\n !disabled &&\n hoverState &&\n (!!smartConnectLineState ||\n (activeEditableLine && lineEditorState\n ? (editableLine = editableLineMap.get(activeEditableLine)) &&\n (isEditableEdgeLine(editableLine)\n ? (({ source, target } = editableLine),\n lineEditorState.type === \"entry\")\n ? hoverState.cell === target\n : lineEditorState.type === \"exit\" && hoverState.cell === source\n : // TODO(steve): decorator line\n false)\n : !targetIsActive(hoverState.cell, activeTarget) &&\n !hasActiveEdge(activeTarget)));\n\n const padding = DEFAULT_NODE_PADDING_FOR_SMART_LINES;\n const halfPadding = padding / 2;\n\n return (\n <g onMouseEnter={unsetActivePointIndex} onMouseLeave={unsetHoverState}>\n {available && (\n <>\n <rect\n x={hoverState.cell.view.x - halfPadding}\n y={hoverState.cell.view.y - halfPadding}\n width={hoverState.cell.view.width + padding}\n height={hoverState.cell.view.height + padding}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={(HELPER_BG_RADIUS * 2) / scale}\n pointerEvents=\"stroke\"\n />\n {hoverState.activePointIndex !== undefined && (\n <circle\n cx={hoverState.points[hoverState.activePointIndex].x}\n cy={hoverState.points[hoverState.activePointIndex].y}\n r={HELPER_BG_RADIUS / scale}\n fill=\"lightgreen\"\n fillOpacity={0.5}\n pointerEvents=\"none\"\n />\n )}\n {hoverState.points.map((point, index) => (\n <ConnectPointComponent\n key={index}\n editableLineMap={editableLineMap}\n index={index}\n point={point}\n scale={scale}\n activeEditableLine={activeEditableLine}\n unsetActivePointIndex={unsetActivePointIndex}\n unsetTimeout={unsetTimeout}\n />\n ))}\n </>\n )}\n </g>\n );\n}\n\ninterface ConnectPointComponentProps {\n editableLineMap: WeakMap<EditableLineCell, EditableLine>;\n index: number;\n point: NodePosition;\n scale: number;\n activeEditableLine: EditableLineCell | null;\n unsetTimeout: () => void;\n unsetActivePointIndex: () => void;\n}\n\nfunction ConnectPointComponent({\n editableLineMap,\n index,\n point,\n scale,\n activeEditableLine,\n unsetTimeout,\n unsetActivePointIndex,\n}: ConnectPointComponentProps): JSX.Element {\n const {\n rootRef,\n smartConnectLineState,\n hoverState,\n setHoverState,\n setSmartConnectLineState,\n onConnect,\n lineEditorState,\n setLineEditorState,\n onChangeEdgeView,\n } = useHoverStateContext();\n const ref = useRef<SVGGElement>(null);\n\n useEffect(() => {\n const g = ref.current;\n const handleMouseEnter = (e: MouseEvent) => {\n // There is a chance that mouseenter will not be triggered when the element is shown aync.\n // So we also listen to the mousemove event, but only once.\n if (e.type === \"mousemove\") {\n g?.removeEventListener(e.type, handleMouseEnter);\n }\n unsetTimeout();\n setHoverState((prev) =>\n prev && prev.activePointIndex !== index\n ? { ...hoverState!, activePointIndex: index }\n : prev\n );\n };\n g?.addEventListener(\"mouseenter\", handleMouseEnter);\n g?.addEventListener(\"mousemove\", handleMouseEnter);\n return () => {\n g?.removeEventListener(\"mouseenter\", handleMouseEnter);\n g?.removeEventListener(\"mousemove\", handleMouseEnter);\n };\n }, [hoverState, index, setHoverState, unsetTimeout]);\n\n useEffect(() => {\n if (lineEditorState) {\n return;\n }\n const handleMouseDown = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n const rect = rootRef.current!.getBoundingClientRect();\n const originalPoint = hoverState!.points[index];\n setSmartConnectLineState({\n source: hoverState!.cell as NodeCell,\n from: [originalPoint.x, originalPoint.y],\n offset: [rect.left, rect.top],\n exitPosition: hoverState!.relativePoints[index],\n });\n };\n const g = ref.current;\n g?.addEventListener(\"mousedown\", handleMouseDown);\n return () => {\n g?.removeEventListener(\"mousedown\", handleMouseDown);\n };\n }, [hoverState, index, lineEditorState, rootRef, setSmartConnectLineState]);\n\n useEffect(() => {\n const handleMouseUp = (e: MouseEvent) => {\n if (\n activeEditableLine &&\n lineEditorState &&\n activeEditableLine.type === \"decorator\"\n ) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n if (smartConnectLineState) {\n if (smartConnectLineState.source !== hoverState?.cell) {\n onConnect?.(\n smartConnectLineState.source,\n hoverState!.cell,\n smartConnectLineState.exitPosition,\n hoverState!.relativePoints[hoverState!.activePointIndex!]\n );\n }\n setSmartConnectLineState(null);\n } else if (activeEditableLine && lineEditorState) {\n const position =\n hoverState!.relativePoints[hoverState!.activePointIndex!];\n const { type } = lineEditorState;\n const { source, target } = editableLineMap.get(\n activeEditableLine!\n ) as EditableEdgeLine;\n const { view } = activeEditableLine!;\n if (type === \"entry\") {\n onChangeEdgeView?.(source, target, {\n ...view,\n entryPosition: position,\n });\n } else {\n onChangeEdgeView?.(source, target, {\n ...view,\n exitPosition: position,\n });\n }\n setLineEditorState(null);\n }\n };\n const g = ref.current;\n g?.addEventListener(\"mouseup\", handleMouseUp);\n return () => {\n g?.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [\n smartConnectLineState,\n hoverState,\n onConnect,\n setSmartConnectLineState,\n activeEditableLine,\n lineEditorState,\n editableLineMap,\n onChangeEdgeView,\n setLineEditorState,\n ]);\n\n return (\n <g ref={ref} onMouseLeave={unsetActivePointIndex}>\n <circle\n cx={point.x}\n cy={point.y}\n r={HELPER_BG_RADIUS}\n fill=\"transparent\"\n />\n <image\n x={point.x - HALF_HELPER_RADIUS / scale}\n y={point.y - HALF_HELPER_RADIUS / scale}\n width={HELPER_RADIUS / scale}\n height={HELPER_RADIUS / scale}\n xlinkHref={HELPER_IMAGE}\n preserveAspectRatio=\"none\"\n />\n </g>\n );\n}\n\nfunction hasActiveEdge(activeTarget: ActiveTarget | null) {\n return (\n activeTarget &&\n (activeTarget.type === \"edge\" ||\n (activeTarget.type === \"multi\" &&\n activeTarget.targets.some((target) => target.type === \"edge\")))\n );\n}\n","import type { ActiveTarget, Cell } from \"../interfaces\";\nimport { isLocked } from \"./isLocked\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport type KeyboardAction = KeyboardActionDeleteCells;\n\nexport interface KeyboardActionDeleteCells {\n action: \"delete-cells\";\n cells: Cell[];\n}\n\nexport function handleKeyboard(\n event: KeyboardEvent,\n {\n cells,\n activeTarget,\n lockedIds,\n }: {\n cells: Cell[];\n activeTarget: ActiveTarget | null | undefined;\n lockedIds?: string[];\n }\n): KeyboardAction | undefined {\n const activeCells = cells.filter(\n (cell) => targetIsActive(cell, activeTarget) && !isLocked(cell, lockedIds)\n );\n\n if (activeCells.length === 0) {\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-cells\",\n cells: activeCells,\n };\n }\n }\n}\n","import type { ActiveTarget, Cell } from \"../interfaces\";\nimport { isNodeCell } from \"./asserts\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport function toggleLock(\n target: ActiveTarget,\n type: \"toggle\" | \"lock\" | \"unlock\",\n cells: Cell[],\n lockedContainerIds: string[]\n): { newCells: Cell[] | null; updates: Cell[] } {\n const previousLocked: Cell[] = [];\n const previousUnlocked: Cell[] = [];\n for (const cell of cells) {\n if (targetIsActive(cell, target)) {\n // 如果容器已锁定,禁止其子节点的锁定状态改变\n if (\n isNodeCell(cell) &&\n cell.containerId &&\n lockedContainerIds.includes(cell.containerId)\n ) {\n continue;\n }\n (cell.view?.locked ? previousLocked : previousUnlocked).push(cell);\n }\n }\n\n let newCells: Cell[] | null = null;\n const updates: Cell[] = [];\n\n if (type !== \"unlock\" && previousUnlocked.length > 0) {\n // Lock all unlocked targets\n newCells = cells.map((cell) => {\n if (previousUnlocked.includes(cell)) {\n const update = {\n ...cell,\n view: { ...cell.view, locked: true },\n } as Cell;\n updates.push(update);\n return update;\n }\n return cell;\n });\n } else if (type !== \"lock\" && previousLocked.length > 0) {\n // Unlock all locked targets\n newCells = cells.map((cell) => {\n if (previousLocked.includes(cell)) {\n const update = {\n ...cell,\n view: { ...cell.view, locked: false },\n } as Cell;\n updates.push(update);\n return update;\n }\n return cell;\n });\n }\n\n return { newCells, updates };\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;--animation-dasharray:48;--stroke-dashedoffset:96;--stroke-dottedoffset:24;--dasharray:4;--dotted:1;--area-bg-color:rgba(119,141,195,0.1)}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}@keyframes solidAnimation{to{stroke-dashoffset:0}}@keyframes dashedAnimation{0%{stroke-dashoffset:var(--stroke-dashedoffset)}to{stroke-dashoffset:0}}@keyframes dottedAnimation{0%{stroke-dashoffset:var(--stroke-dottedoffset)}to{stroke-dashoffset:0}}.solid-animation{stroke-dasharray:var(--solid-length);stroke-dashoffset:var(--solid-length);animation:solidAnimation var(--time) linear infinite}.dashed-animation{animation:dashedAnimation var(--time) linear infinite}.dotted-animation{animation:dottedAnimation var(--time) linear infinite}.decorator-area .area,\n.container-wrapper .container{background-color:var(--area-bg-color);border:1px solid transparent}.decorator-text .text-container{border:1px solid transparent}.decorator-rect-container .rect-container{border:1px solid rgba(73,126,255,0.7)}.decorator-group .lock-icon,.decorator-group .plus-wrapper,.decorator-group .plus-icon{opacity:0}.decorator-group .group{position:relative}.decorator-group .group .plus-icon{position:absolute;left:50%;bottom:0;transform:translate(-50%,50%);padding:2px;background:var(--color-fill-bg-base-1);border-radius:2px;cursor:pointer}.decorator-group .group .plus-icon:hover{color:rgba(33,212,243,1)}.decorator-group.active-group:not(.does-not-exist) .group,.cell.active .decorator-group .group{border:1px dashed rgba(33,212,243,1)}.decorator-group.active-group:not(.does-not-exist) .resize-handle,.cell.active .decorator-group .resize-handle,.decorator-group.active-group:not(.does-not-exist) .lock-icon,.cell.active .decorator-group .lock-icon,.decorator-group.active-group:not(.does-not-exist) .plus-wrapper,.cell.active .decorator-group .plus-wrapper,.decorator-group.active-group:not(.does-not-exist) .plus-icon,.cell.active .decorator-group .plus-icon{opacity:1}.cell:has(.decorator-group.active-group),\n.cell:has(.container.active-container){opacity:1}.cell.active .decorator-area .area,\n.cell.active .decorator-rect-container .rect-container,\n.cell.active .decorator-text .text-container,\n.cell.active .container-wrapper .container,\n.cell.active .group-wrapper .group,\n.container-dragover .decorator-container .container,\n.active-container.container{border-style:dashed;border-color:rgba(73,126,255,0.7)}.node,\n.container-wrapper{overflow:visible}.decorator-text,\n.decorator-rect,\n.decorator-area{overflow:visible;pointer-events:none}.lock-icon,\n.decorator-text > *,\n.decorator-rect > *,\n.decorator-area > *{pointer-events:auto}.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:var(--dasharray);stroke-width:1}.cell:not(.read-only){-webkit-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}.decorator-area-container:hover .resize-handle,\n.decorator-rect-container:hover .resize-handle,\n.decorator-container:hover .resize-handle{opacity:1}.connect-line{pointer-events:none}.connect-line:not(.connecting){display:none}.editing-line{pointer-events:none;stroke-dasharray:var(--dasharray);stroke-width:1}.editing-line:not(.editing){display:none}.line.dashed{stroke-dasharray:var(--dasharray)}.line.dotted{stroke-dasharray:var(--dotted)}.decorator-text .text-container{width:max-content;padding:0.5em;white-space:pre}.cell:not(.read-only) .decorator-text .text-container:hover{color:#497eff}.decorator-text .text:focus{outline:none}.cell.faded{opacity:0.3}.cell.container-dragover{opacity:1}.cell .node{pointer-events:none}.cell .node > *{position:fixed;pointer-events:auto}.degraded{pointer-events:bounding-box}.degraded circle{fill:rgb(119,141,195)}.degraded text{text-anchor:middle;fill:var(--antd-text-color)}.cell.active .degraded circle,\n.cell.active .degraded text,\n.degraded:hover circle,\n.degraded:hover text{fill:var(--color-brand)}.decorator-container{--defaultSize:24px}.decorator-container .text-container{display:flex;align-items:center;justify-content:center;padding:0.5em;text-align:center;font-size:16px;color:#262626;background-color:rgba(119,141,195,0.25);overflow:hidden}.decorator-container .horizontal{height:max-content;width:100%}.decorator-container .horizontal .text{min-height:var(--defaultSize)}.decorator-container .vertical{width:max-content;height:100%;writing-mode:vertical-lr;-webkit-text-orientation:upright;text-orientation:upright;letter-spacing:4px}.decorator-container .vertical .text{min-width:var(--defaultSize)}.line-label-container{overflow:visible;opacity:0}.line-label-container.ready{opacity:1}.line-label{position:absolute;display:block;transform:translate(-50%,-50%);white-space:pre-line;width:max-content;text-align:center}.line-label.text{font-size:11px;color:var(--color-secondary-text);font-weight:400;line-height:1.63636364}.motion:not(.visible){opacity:0}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","export const SYMBOL_FOR_SIZE_INITIALIZED = Symbol.for(\"size-initialized\");\nexport const SYMBOL_FOR_LAYOUT_INITIALIZED = Symbol.for(\"layout-initialized\");\nexport const DEFAULT_NODE_SIZE = 20;\nexport const DEFAULT_NODE_GAP_H = 36;\nexport const DEFAULT_NODE_GAP_V = 50;\nexport const DEFAULT_AREA_WIDTH = 180;\nexport const DEFAULT_AREA_HEIGHT = 120;\nexport const DEFAULT_SCALE_RANGE_MIN = 0.5;\nexport const DEFAULT_SCALE_RANGE_MAX = 2;\nexport const DEFAULT_LINE_STROKE_COLOR = \"gray\";\nexport const DEFAULT_LINE_STROKE_WIDTH = 1;\nexport const DEFAULT_DECORATOR_LINE_STROKE_COLOR = \"rgba(73, 126, 255, 0.7)\";\nexport const DEFAULT_LINE_INTERACT_STROKE_WIDTH = 15;\nexport const DEFAULT_LINE_INTERACT_SHOW_START_ARROW = false;\nexport const DEFAULT_LINE_INTERACT_SHOW_END_ARROW = true;\nexport const DEFAULT_LINE_INTERACT_ANIMATE_DURATION = 1;\nexport const DEFAULT_DEGRADED_THRESHOLD = 500;\nexport const DEFAULT_SNAP_GRID_SIZE = 10;\nexport const DEFAULT_SNAP_OBJECT_DISTANCE = 5;\nexport const DEFAULT_SNAP_OBJECT_POSITIONS = \"all\";\n/** Padding left + padding right, as well as top + bottom */\nexport const DEFAULT_NODE_PADDING_FOR_LINES = 5;\n/** Padding left + padding right, as well as top + bottom */\nexport const DEFAULT_NODE_PADDING_FOR_SMART_LINES = 0;\nexport const DEFAULT_CANVAS_PADDING = 0;\n\nexport const POINT_HELPER_RADIUS = 5;\nexport const DEFAULT_MOTION_SPEED = 50;\nexport const CONTAINERGAP = 40;\nexport const MAXPERROW = 12;\n","import { forEach, groupBy, isNil } from \"lodash\";\nimport { DecoratorCell, InitialCell, NodeCell, NodeView } from \"../interfaces\";\nimport {\n isContainerDecoratorCell,\n isGroupDecoratorCell,\n isNoPoint,\n} from \"./asserts\";\nimport { SizeTuple } from \"../../diagram/interfaces\";\nimport { CONTAINERGAP } from \"../constants\";\nimport { computeBoundingBox } from \"./computeBoundingBox\";\nimport { GROUPPADDING } from \"./initialGroupLayout\";\ninterface Point {\n x: number;\n y: number;\n}\n\n/**\n * 在容器内新加节点时,计算新节点的点按位置\n * 按网格排布避免重叠\n * @param cells\n * @param defaultNodeSize 默认节点大小\n * @returns void\n */\nexport function generateNewPointsWithLayout(\n cells: InitialCell[],\n { defaultNodeSize }: { defaultNodeSize: SizeTuple }\n) {\n const newContainerChildCells = cells.filter(\n (c) => c.type === \"node\" && isNoPoint(c.view!) && !isNil(c.containerId)\n ) as NodeCell[];\n const newGroupChildCells = cells.filter(\n (c) => c.type === \"node\" && isNoPoint(c.view!) && !isNil(c.groupId)\n ) as NodeCell[];\n if (newGroupChildCells.length) {\n const groupMap: Record<string, NodeCell[]> = {};\n forEach(\n groupBy(newGroupChildCells, \"groupId\"),\n (groupedNodes, containerId) => {\n groupMap[containerId] = groupedNodes;\n }\n );\n\n const groupCells = cells.filter(\n (c) => isGroupDecoratorCell(c) && groupMap[c.id]\n ) as DecoratorCell[];\n groupCells.forEach((group) => {\n const groupId = group.id;\n const newNodes = groupMap[groupId];\n const groupView = !isNoPoint(group.view)\n ? group.view\n : (computeBoundingBox(\n cells.filter(\n (c) => c.type === \"node\" && c.groupId === groupId\n ) as NodeCell[],\n {\n padding: GROUPPADDING,\n }\n ) as NodeView);\n const existingPoints = cells\n .filter(\n (c) =>\n (c as NodeCell)?.groupId === groupId &&\n !isNoPoint((c as NodeCell).view)\n )\n .map((node) => ({ x: node.view!.x, y: node.view!.y })) as Point[];\n newNodes.forEach((node) => {\n const nodeWidth = node.view?.width || defaultNodeSize[0];\n const nodeHeight = node.view?.height || defaultNodeSize[1];\n const gap = 10; // 间距\n const padding = CONTAINERGAP; // 内边距\n\n const newPoint = computeNodePoints(\n groupView,\n existingPoints,\n nodeWidth,\n nodeHeight,\n gap,\n padding\n );\n if (newPoint) {\n node.view = {\n ...node.view,\n x: newPoint.x,\n y: newPoint.y,\n };\n existingPoints.push(newPoint);\n }\n });\n });\n }\n if (newContainerChildCells.length) {\n const containerGroup: Record<string, NodeCell[]> = {};\n forEach(\n groupBy(newContainerChildCells, \"containerId\"),\n (groupedNodes, containerId) => {\n containerGroup[containerId] = groupedNodes;\n }\n );\n\n const containerCells = cells.filter(\n (c) => isContainerDecoratorCell(c) && containerGroup[c.id]\n ) as DecoratorCell[];\n containerCells.forEach((container) => {\n const containerId = container.id;\n const containerView = container.view;\n\n const existingPoints = cells\n .filter(\n (c) =>\n (c as NodeCell)?.containerId === containerId &&\n !isNoPoint((c as NodeCell).view)\n )\n .map((node) => ({ x: node.view!.x, y: node.view!.y })) as Point[];\n const newNodes = containerGroup[containerId];\n newNodes.forEach((node) => {\n const nodeWidth = node.view?.width || defaultNodeSize[0];\n const nodeHeight = node.view?.height || defaultNodeSize[1];\n const gap = 10; // 间距\n const padding = CONTAINERGAP; // 内边距\n\n const newPoint = computeNodePoints(\n containerView,\n existingPoints,\n nodeWidth,\n nodeHeight,\n gap,\n padding\n );\n if (newPoint) {\n node.view = {\n ...node.view,\n x: newPoint.x,\n y: newPoint.y,\n };\n existingPoints.push(newPoint);\n }\n });\n });\n }\n}\n\nfunction computeNodePoints(\n containerView: NodeView,\n existingPoints: Point[],\n nodeWidth: number,\n nodeHeight: number,\n gap = 0,\n padding = 0\n) {\n const { x: left, y: top, width } = containerView;\n const stepX = nodeWidth + gap;\n const stepY = nodeHeight + gap;\n const cols = Math.max(Math.floor((width - padding * 2) / stepX), 1);\n let row = 0;\n\n while (true) {\n for (let col = 0; col < cols; col++) {\n const x = left + padding + col * stepX;\n const y = top + padding + row * stepY;\n\n const overlapping = existingPoints.some((p) =>\n isOverlapping(\n x,\n y,\n nodeWidth,\n nodeHeight,\n p.x,\n p.y,\n nodeWidth,\n nodeHeight\n )\n );\n\n if (!overlapping) {\n return { x, y };\n }\n }\n row++;\n }\n}\n/**\n * 判断两个矩形中心点是否重叠(简单矩形碰撞判断)\n */\nfunction isOverlapping(\n x1: number,\n y1: number,\n w1: number,\n h1: number,\n x2: number,\n y2: number,\n w2: number,\n h2: number\n) {\n const cx1 = x1 + w1 / 2;\n const cy1 = y1 + h1 / 2;\n const cx2 = x2 + w2 / 2;\n const cy2 = y2 + h2 / 2;\n\n const minDistX = (w1 + w2) / 2;\n const minDistY = (h1 + h2) / 2;\n\n return Math.abs(cx1 - cx2) < minDistX && Math.abs(cy1 - cy2) < minDistY;\n}\n","import { get, without } from \"lodash\";\nimport type {\n RangeTuple,\n SizeTuple,\n TransformLiteral,\n} from \"../../diagram/interfaces\";\nimport {\n DEFAULT_NODE_GAP_H,\n DEFAULT_NODE_GAP_V,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../constants\";\nimport type {\n Cell,\n DecoratorCell,\n InitialCell,\n LayoutOptions,\n LayoutType,\n NodeCell,\n NodeId,\n NodeView,\n} from \"../interfaces\";\nimport {\n isContainerDecoratorCell,\n isDecoratorCell,\n isEdgeCell,\n isGroupDecoratorCell,\n isNodeCell,\n isNoPoint,\n isNoSize,\n} from \"./asserts\";\nimport { initializeCells } from \"./initializeCells\";\nimport { transformToCenter } from \"./transformToCenter\";\nimport { forceLayout } from \"../../shared/canvas/forceLayout\";\nimport { dagreLayout } from \"../../shared/canvas/dagreLayout\";\nimport { sameTarget } from \"./sameTarget\";\nimport { generateNewPointsWithLayout } from \"./generateNewPointsWithLayout\";\nimport { initialContainerLayout } from \"./initialContainerLayout\";\n\nexport function updateCells({\n cells,\n layout,\n previousCells,\n defaultNodeSize,\n canvasWidth,\n canvasHeight,\n scaleRange,\n transform,\n reason,\n parent,\n parentNode,\n allowEdgeToArea,\n layoutOptions,\n}: {\n cells: InitialCell[] | undefined;\n layout?: LayoutType;\n previousCells: Cell[];\n defaultNodeSize: SizeTuple;\n canvasWidth: number;\n canvasHeight: number;\n scaleRange: RangeTuple;\n transform: TransformLiteral;\n reason?: \"add-related-nodes\";\n parent?: NodeId;\n parentNode?: NodeCell;\n allowEdgeToArea?: boolean;\n layoutOptions?: LayoutOptions;\n}): {\n cells: Cell[];\n updated: Cell[];\n shouldReCenter: boolean;\n} {\n const isManualLayout = layout !== \"force\" && layout !== \"dagre\";\n\n // --- Step 1: 初始化 ---\n const newCells = initializeCells(cells, {\n defaultNodeSize,\n layoutOptions,\n isInitialize: false,\n });\n const updateCandidates: (NodeCell | DecoratorCell)[] = [];\n let shouldReCenter = false;\n\n // 记录已存在的节点尺寸,避免丢失\n const prevSizeNodes = new Map<string, NodeCell>();\n let prevShouldCentered = false;\n for (const c of previousCells) {\n if (isDecoratorCell(c) || isNodeCell(c)) {\n prevShouldCentered = true;\n if (isNodeCell(c) && c[SYMBOL_FOR_SIZE_INITIALIZED]) {\n prevSizeNodes.set(c.id, c);\n }\n }\n }\n\n // 构建 id -> node 映射,复用尺寸\n const nodesMap = new Map<string, NodeCell>();\n for (const c of newCells) {\n if (isNodeCell(c)) {\n nodesMap.set(c.id, c);\n const prevNode = prevSizeNodes.get(c.id);\n if (prevNode) {\n Object.assign(c.view, {\n width: prevNode.view.width,\n height: prevNode.view.height,\n });\n c[SYMBOL_FOR_SIZE_INITIALIZED] = true;\n }\n }\n }\n\n // --- Step 2: 特殊场景 - add-related-nodes ---\n let handled = false;\n if (reason === \"add-related-nodes\") {\n handled = layoutRelatedNodes({\n newCells,\n nodesMap,\n parent,\n parentNode,\n isManualLayout,\n updateCandidates,\n handled,\n });\n }\n\n // --- Step 3: 常规布局 ---\n if (!handled) {\n const positioned: NodeCell[] = [];\n let hasDecorators = false;\n\n for (const c of newCells) {\n if (isNodeCell(c)) {\n if (isNoPoint(c.view)) updateCandidates.push(c);\n else positioned.push(c);\n } else if (isDecoratorCell(c)) {\n hasDecorators = true;\n }\n }\n\n if (isManualLayout) {\n // 没有居中过,执行一次居中变换\n if (!prevShouldCentered) {\n transform = transformToCenter(without(newCells, ...updateCandidates), {\n canvasWidth,\n canvasHeight,\n scaleRange,\n });\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n if (\n positioned.length === 0 ||\n (positioned.length === 1 &&\n !hasDecorators &&\n updateCandidates.length > 0)\n ) {\n // 使用 dagre 初始布局\n updateCandidates.push(...positioned);\n ({ getNodeView } = dagreLayout({ cells: newCells, allowEdgeToArea }));\n shouldReCenter =\n previousCells.length === 0 ||\n (previousCells.length === newCells.length &&\n previousCells.every((cell, i) => sameTarget(cell, newCells[i])));\n } else {\n // 使用 force layout 固定已存在位置\n ({ getNodeView } = forceLayout({\n cells: newCells,\n fixedPosition: true,\n allowEdgeToArea,\n center: [\n (canvasWidth / 2 - transform.x) / transform.k,\n (canvasHeight / 2 - transform.y) / transform.k,\n ],\n }));\n }\n\n // --- Step 4: 容器、分组布局 ---\n const containerCells = newCells.filter(\n (cell) => isContainerDecoratorCell(cell) && isNoSize(cell.view)\n ) as DecoratorCell[];\n const groupCells = newCells.filter(\n (cell) => isGroupDecoratorCell(cell) && isNoSize(cell.view)\n ) as DecoratorCell[];\n\n const containerAndGroupCells = [...containerCells, ...groupCells];\n const nodeLayout =\n get(layoutOptions, \"initialLayout\") === \"layered-staggered\"\n ? \"staggered\"\n : \"dagre\";\n if (containerAndGroupCells.length > 0) {\n initialContainerLayout(newCells, { nodeLayout });\n updateCandidates.push(...containerAndGroupCells);\n } else {\n generateNewPointsWithLayout(newCells, { defaultNodeSize });\n }\n\n // --- Step 5: 更新未定位节点 ---\n for (const c of newCells) {\n if (isNodeCell(c) && isNoPoint(c.view)) {\n const v = getNodeView(c.id);\n c.view.x = v.x;\n c.view.y = v.y;\n }\n }\n }\n }\n\n return { cells: newCells, updated: updateCandidates, shouldReCenter };\n}\n\n/**\n * 布局 add-related-nodes 的子节点\n */\nfunction layoutRelatedNodes({\n newCells,\n nodesMap,\n parent,\n parentNode,\n isManualLayout,\n updateCandidates,\n handled,\n}: {\n newCells: Cell[];\n nodesMap: Map<string, NodeCell>;\n parent?: NodeId;\n parentNode?: NodeCell;\n isManualLayout: boolean;\n updateCandidates: (NodeCell | DecoratorCell)[];\n handled: boolean;\n}): boolean {\n const parentNodeCell = parent ? nodesMap.get(parent) : parentNode;\n\n if (!parentNodeCell || isNoPoint(parentNodeCell.view)) return handled;\n\n // 构建父->子[]\n const adjacency = new Map<string, string[]>();\n const queue: { id: string; parentId: string }[] = [];\n\n for (const c of newCells) {\n if (isEdgeCell(c) && c.source && c.target) {\n if (!adjacency.has(c.source)) adjacency.set(c.source, []);\n adjacency.get(c.source)!.push(c.target);\n queue.push({ id: c.target, parentId: c.source });\n }\n }\n\n while (queue.length > 0) {\n const { id, parentId } = queue.shift()!;\n const node = nodesMap.get(id);\n const parent = nodesMap.get(parentId);\n if (!node || !parent) continue;\n\n if (isNoPoint(node.view)) {\n if (isManualLayout) {\n const siblings = adjacency.get(parentId)!;\n const index = siblings.indexOf(id);\n const baseX =\n parent.view.x + parent.view.width / 2 - node.view.width / 2;\n const baseY = parent.view.y + parent.view.height + DEFAULT_NODE_GAP_V;\n\n let offsetX = 0;\n if (index > 0) {\n const step = Math.ceil(index / 2);\n const dir = 1 - 2 * (index % 2);\n offsetX = dir * step * (node.view.width + DEFAULT_NODE_GAP_H);\n }\n\n node.view.x = baseX + offsetX;\n node.view.y = baseY;\n }\n\n updateCandidates.push(node);\n }\n\n (adjacency.get(id) || []).forEach((cid) =>\n queue.push({ id: cid, parentId: id })\n );\n }\n\n return !newCells.some((c) => c.type === \"decorator\" && isNoPoint(c.view));\n}\n","import type { TransformLiteral } from \"../../diagram/interfaces\";\nimport { getCellsRect } from \"../../shared/canvas/processors/getCellsRect\";\nimport {\n getTransformToCenter,\n type TransformToCenterOptions,\n} from \"../../shared/canvas/processors/getTransformToCenter\";\nimport type { Cell } from \"../interfaces\";\n\nexport function transformToCenter(\n cells: Cell[],\n options: TransformToCenterOptions\n): TransformLiteral {\n const rect = getCellsRect(cells);\n return getTransformToCenter(rect, options);\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 getConnectTo = (e: MouseEvent): PositionTuple => [\n (e.clientX - transform.x - connectLineState.offset[0]) / transform.k,\n (e.clientY - transform.y - connectLineState.offset[1]) / transform.k,\n ];\n const onMouseMove = (e: MouseEvent) => {\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo(getConnectTo(e));\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, getConnectTo(e));\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 { get } from \"lodash\";\nimport type { SizeTuple } from \"../../diagram/interfaces\";\nimport type { Cell, InitialCell, LayoutOptions, NodeCell } from \"../interfaces\";\nimport { isInitialNodeCell } from \"./asserts\";\nimport { initialContainerLayout } from \"./initialContainerLayout\";\n\ninterface initializeConfig {\n defaultNodeSize: SizeTuple;\n layoutOptions?: LayoutOptions;\n isInitialize?: boolean;\n}\n\nexport function initializeCells(\n initialCells: InitialCell[] | undefined,\n { defaultNodeSize, layoutOptions, isInitialize }: initializeConfig\n): Cell[] {\n const originalCells = initialCells ?? [];\n if (isInitialize) {\n if (get(layoutOptions, \"initialLayout\") === \"layered-architecture\") {\n initialContainerLayout(originalCells, { nodeLayout: \"dagre\" });\n } else if (get(layoutOptions, \"initialLayout\") === \"layered-staggered\") {\n initialContainerLayout(originalCells, { nodeLayout: \"staggered\" });\n }\n }\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 { get } from \"lodash\";\nimport { CONTAINERGAP, DEFAULT_NODE_SIZE, MAXPERROW } from \"../constants\";\nimport { DecoratorCell, NodeCell } from \"../interfaces\";\nimport { isGroupDecoratorCell, isNoPoint } from \"./asserts\";\n\n/**\n * 交错排列的网格布局\n * [●][●][●][●]\n * [●][●][●]\n * [●][●][●][●]\n * @param nodes\n * @param options\n * @returns\n */\nexport function staggeredLayout(\n nodes: (NodeCell | DecoratorCell)[],\n options: {\n gapX?: number;\n gapY?: number;\n offsetY?: number;\n maxPerRow?: number;\n } = {}\n): (NodeCell | DecoratorCell)[] {\n const {\n gapX = 50,\n gapY = 50,\n offsetY = CONTAINERGAP,\n maxPerRow = MAXPERROW,\n } = options;\n /**\n * 满行数量(例如4个)\n * 短行数量(例如3个)\n */\n const fullRowCount = maxPerRow;\n const shortRowCount = maxPerRow - 1;\n const layoutedNodes = [];\n let index = 0,\n row = 0,\n preRowOffsetY = offsetY;\n\n while (index < nodes.length) {\n const isOddRow = row % 2 === 1;\n const nodesInRow = isOddRow ? shortRowCount : fullRowCount;\n let nodeX = isOddRow ? CONTAINERGAP : 0,\n maxNodeHeight = 0;\n for (let i = 0; i < nodesInRow && index < nodes.length; i++, index++) {\n const node = nodes[index];\n const nodeWidth = get(node, \"view.width\", DEFAULT_NODE_SIZE);\n const nodeHeight = get(node, \"view.height\", DEFAULT_NODE_SIZE);\n const x = nodeX;\n const y = preRowOffsetY;\n if (isNoPoint(nodes[index].view) || isGroupDecoratorCell(nodes[index])) {\n nodes[index].view = {\n ...nodes[index].view,\n x,\n y,\n width: nodeWidth,\n height: nodeHeight,\n };\n }\n nodeX = x + (nodeWidth + gapX);\n maxNodeHeight = Math.max(maxNodeHeight, nodeHeight);\n layoutedNodes.push(nodes[index]);\n }\n preRowOffsetY = preRowOffsetY + maxNodeHeight + gapY;\n row++;\n }\n return layoutedNodes;\n}\n","import type { Cell, NodeCell, DecoratorCell, NodeId } from \"../interfaces\";\nimport { isNodeOrAreaDecoratorCell } from \"./asserts\";\n\nexport function findNodeOrAreaDecorator(\n cells: Cell[],\n id: NodeId\n): NodeCell | DecoratorCell | undefined {\n return cells.find(\n (cell) => isNodeOrAreaDecoratorCell(cell) && cell.id === id\n ) as NodeCell | DecoratorCell | undefined;\n}\n","import { sortBy } from \"lodash\";\nimport type {\n ComputedEdgeLineConf,\n LineSegmentJumps,\n} from \"../../draw-canvas/interfaces\";\nimport type { NodePosition } from \"../../diagram/interfaces\";\nimport { intersect } from \"../../diagram/lines/intersect\";\n\ninterface LineSegment {\n start: NodePosition;\n end: NodePosition;\n}\n\nconst LINE_JUMP_BASE_SIZE = 6;\n\nexport function collectLineJumpsFactory() {\n const allJumps: LineSegmentJumps[] = [];\n const allLineSegments: LineSegment[] = [];\n\n return function collectLineJumps(\n points: NodePosition[],\n lineConf: ComputedEdgeLineConf\n ): Map<number, LineSegmentJumps> | null {\n const lineJumps: LineSegmentJumps[] = [];\n const lineSegments: LineSegment[] = [];\n\n // Line jumps for curved lines are not supported.\n if (lineConf.type !== \"curve\" || lineConf.curveType === \"curveLinear\") {\n for (let i = 0; i < points.length - 1; i++) {\n const start = points[i];\n const end = points[i + 1];\n const jumpPoints: NodePosition[] = [];\n const radius = LINE_JUMP_BASE_SIZE / 2 + lineConf.strokeWidth - 1;\n if (lineConf.jumps) {\n jumpLoop: for (const item of allLineSegments) {\n const point = lineJumpIntersect(\n start,\n end,\n item.start,\n item.end,\n radius\n );\n if (point) {\n for (const jump of allJumps) {\n for (const p of jump.jumpPoints) {\n const distance = Math.sqrt(\n Math.pow(point.x - p.x, 2) + Math.pow(point.y - p.y, 2)\n );\n if (distance < radius + jump.radius) {\n // Ignore this jump point if it's too close to an existing one\n continue jumpLoop;\n }\n }\n }\n\n jumpPoints.push(point);\n }\n }\n }\n\n if (jumpPoints.length > 0) {\n // 将交叉点按其在连线上的顺序排列\n const sortedJumpPoints = sortBy(\n jumpPoints,\n (p) => (p.x - points[0].x) ** 2 + (p.y - points[0].y) ** 2\n );\n\n const segJumps: LineSegmentJumps = {\n jumpPoints: sortedJumpPoints,\n index: i,\n radius,\n };\n allJumps.push(segJumps);\n lineJumps.push(segJumps);\n }\n\n lineSegments.push({ start, end });\n }\n\n // 同一连线上的不同线段交叉时,不产生跨线\n allLineSegments.push(...lineSegments);\n }\n\n return lineJumps.length > 0\n ? new Map(lineJumps.map((j) => [j.index, j]))\n : null;\n };\n}\n\nfunction lineJumpIntersect(\n p1: NodePosition,\n p2: NodePosition,\n p3: NodePosition,\n p4: NodePosition,\n radius: number\n): NodePosition | null {\n const point = intersect(\n [p1.x, p1.y],\n [p2.x, p2.y],\n [p3.x, p3.y],\n [p4.x, p4.y]\n );\n if (point) {\n // Check if the intersection point is too close to the line ends\n const r2 = radius * radius;\n for (const p of [p1, p2, p3, p4]) {\n const dx = point[0] - p.x;\n const dy = point[1] - p.y;\n if (dx * dx + dy * dy < r2) {\n return null;\n }\n }\n return { x: point[0], y: point[1] };\n }\n return null;\n}\n","import { useMemo } from \"react\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n DecoratorCell,\n DecoratorLineView,\n EdgeCell,\n EditableLine,\n} from \"../../draw-canvas/interfaces\";\nimport {\n isEdgeCell,\n isLineDecoratorCell,\n isStraightType,\n} from \"../../draw-canvas/processors/asserts\";\nimport { findNodeOrAreaDecorator } from \"../../draw-canvas/processors/findNodeOrAreaDecorator\";\nimport { getSmartLinePoints } from \"./processors/getSmartLinePoints\";\nimport { collectLineJumpsFactory } from \"./collectLineJumpsFactory\";\n\nexport function useEditableLineMap({\n cells,\n lineConfMap,\n}: {\n cells: Cell[];\n lineConfMap: WeakMap<EdgeCell | DecoratorCell, ComputedEdgeLineConf>;\n}): WeakMap<EdgeCell | DecoratorCell, EditableLine> {\n return useMemo(() => {\n const map = new WeakMap<EdgeCell | DecoratorCell, EditableLine>();\n\n const collectLineJumps = collectLineJumpsFactory();\n\n for (const cell of cells) {\n if (isEdgeCell(cell)) {\n const lineConf = lineConfMap.get(cell);\n // istanbul ignore next: defensive check\n if (!lineConf) {\n continue;\n }\n\n const sourceNode = findNodeOrAreaDecorator(cells, cell.source);\n const targetNode = findNodeOrAreaDecorator(cells, cell.target);\n\n const hasOppositeEdge =\n isStraightType(cell.view?.type) &&\n cells.some(\n (c) =>\n isEdgeCell(c) &&\n cell.source === c.target &&\n cell.target === c.source &&\n isStraightType(c.view?.type)\n );\n const parallelGap = hasOppositeEdge ? lineConf.parallelGap : 0;\n\n const points =\n sourceNode &&\n targetNode &&\n sourceNode.view.x != null &&\n targetNode.view.x != null\n ? getSmartLinePoints(\n sourceNode.view,\n targetNode.view,\n cell.view,\n parallelGap,\n cell.type\n )\n : null;\n\n if (points) {\n const jumpsMap = collectLineJumps(points, lineConf);\n\n map.set(cell, {\n edge: cell,\n points,\n source: sourceNode!,\n target: targetNode!,\n parallelGap,\n jumpsMap,\n });\n }\n } else if (isLineDecoratorCell(cell)) {\n const lineConf = lineConfMap.get(cell);\n // istanbul ignore next: defensive check\n if (!lineConf) {\n continue;\n }\n\n const { source, target } = cell.view as DecoratorLineView;\n\n const points =\n source && target\n ? getSmartLinePoints(\n { ...source, width: 0, height: 0 },\n { ...target, width: 0, height: 0 },\n cell.view,\n 0,\n cell.type\n )\n : null;\n\n if (points) {\n const jumpsMap = collectLineJumps(points, lineConf);\n\n map.set(cell, {\n decorator: cell,\n points,\n parallelGap: 0,\n jumpsMap,\n });\n }\n }\n }\n return map;\n }, [cells, lineConfMap]);\n}\n","import type { ActiveTarget, ActiveTargetOfSingular } from \"../interfaces\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport function targetIsActive(\n target: ActiveTargetOfSingular,\n activeTarget: ActiveTarget | null | undefined\n): boolean {\n return (\n !!activeTarget &&\n (activeTarget.type === \"multi\"\n ? activeTarget.targets\n : [activeTarget]\n ).some((active) => sameTarget(active, target))\n );\n}\n","import { mergeRects, type Rect } from \"@next-shared/diagram\";\nimport type { Cell, CellsRect } from \"../../../draw-canvas/interfaces\";\nimport { isEdgeCell } from \"../../../draw-canvas/processors/asserts\";\n\nexport function getCellsRect(cells: Cell[]): CellsRect {\n const rects: Rect[] = [];\n let empty = true;\n for (const cell of cells) {\n if (!isEdgeCell(cell)) {\n empty = false;\n rects.push(cell.view);\n }\n }\n const { x: left, y: top, width, height } = mergeRects(rects);\n return { left, top, width, height, empty };\n}\n","export interface Rect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/**\n * Merges multiple rectangles into a single bounding rectangle.\n */\nexport function mergeRects(rects: Rect[]): Rect {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n for (const rect of rects) {\n const r = rect.x + rect.width;\n const b = rect.y + rect.height;\n if (rect.x < left) {\n left = rect.x;\n }\n if (r > right) {\n right = r;\n }\n if (rect.y < top) {\n top = rect.y;\n }\n if (b > bottom) {\n bottom = b;\n }\n }\n\n const width = right - left;\n const height = bottom - top;\n\n return { x: left, y: top, width, height };\n}\n","import type { Reducer } from \"react\";\nimport { pick } from \"lodash\";\nimport type { DrawCanvasAction } from \"./interfaces\";\nimport type {\n Cell,\n DecoratorCell,\n DecoratorType,\n EdgeCell,\n NodeCell,\n} from \"../interfaces\";\nimport { isNodeCell } from \"../processors/asserts\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\n\ntype CellOrder = CellOrderOfDecorator | CellOrderOfOthers;\n\ninterface CellOrderOfDecorator {\n type: \"decorator\";\n decorators: DecoratorType[];\n}\n\ninterface CellOrderOfOthers {\n type: \"node\" | \"edge\";\n}\n\n// NOTE: keep the cells in the following order by default, when adding new cells:\n// 1. decorators other than text\n// 2. edges\n// 3. nodes\n// 4. decorators of text\nconst DEFAULT_CELL_ORDERS: CellOrder[] = [\n {\n type: \"decorator\",\n decorators: [\"line\", \"area\", \"container\", \"rect\"],\n },\n { type: \"edge\" },\n { type: \"node\" },\n { type: \"decorator\", decorators: [\"text\"] },\n];\n\nexport const cells: Reducer<Cell[], DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"drop-node\":\n case \"drop-decorator\":\n return insertCell(state, action.payload);\n case \"add-nodes\":\n return insertCells(state, action.payload);\n case \"add-edge\": {\n // If the new edge between the source and target already exists, override the old one.\n const existedEdgeIndex = state.findIndex(\n (cell) =>\n cell.type === \"edge\" &&\n cell.source === action.payload.source &&\n cell.target === action.payload.target\n );\n if (existedEdgeIndex === -1) {\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 insertCell(state, action.payload);\n }\n return [\n ...state.slice(0, existedEdgeIndex),\n action.payload,\n ...state.slice(existedEdgeIndex + 1),\n ];\n }\n case \"change-edge-view\": {\n const existedEdgeIndex = state.findIndex(\n (cell) =>\n cell.type === \"edge\" &&\n cell.source === action.payload.source &&\n cell.target === action.payload.target\n );\n return existedEdgeIndex === -1\n ? state\n : [\n ...state.slice(0, existedEdgeIndex),\n {\n ...(state[existedEdgeIndex] as EdgeCell),\n view: action.payload.view,\n },\n ...state.slice(existedEdgeIndex + 1),\n ];\n }\n case \"change-decorator-view\": {\n const existedDecoratorIndex = state.findIndex(\n (cell) => cell.type === \"decorator\" && cell.id === action.payload.id\n );\n return existedDecoratorIndex === -1\n ? state\n : [\n ...state.slice(0, existedDecoratorIndex),\n {\n ...(state[existedDecoratorIndex] as EdgeCell),\n view: action.payload.view,\n },\n ...state.slice(existedDecoratorIndex + 1),\n ];\n }\n case \"move-cells\": {\n let matched = false;\n const newState = state.map((cell) => {\n const newCell = action.payload.find(\n (move) => cell.type === move.type && cell.id === move.id\n );\n if (newCell) {\n matched = true;\n return {\n ...(cell as NodeCell),\n view: {\n ...(cell as NodeCell).view,\n x: newCell.x,\n y: newCell.y,\n ...pick(newCell, \"source\", \"target\", \"vertices\"),\n },\n };\n }\n return cell;\n });\n return matched ? newState : 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 case \"update-node-size\":\n return state.map((cell) =>\n isNodeCell(cell) && cell.id === action.payload.id\n ? {\n ...cell,\n [SYMBOL_FOR_SIZE_INITIALIZED]: true,\n view: action.payload.size\n ? {\n ...cell.view,\n width: action.payload.size[0],\n height: action.payload.size[1],\n }\n : cell.view,\n }\n : cell\n );\n }\n return state;\n};\n\nfunction insertCell(cells: Cell[], newCell: Cell): Cell[] {\n return insertCells(cells, [newCell]);\n}\n\n/**\n * Insert new cells (with same types and some decorators) to the cells.\n */\nfunction insertCells(cells: Cell[], newCells: Cell[]): Cell[] {\n if (newCells.length === 0) {\n return cells;\n }\n const index = DEFAULT_CELL_ORDERS.findIndex((order) =>\n matchCellOrder(newCells[0], order)\n );\n\n // istanbul ignore next\n if (index === -1) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Default order index unhandled for the cell: %o.\\n%s\",\n newCells[0],\n \"This is a bug of diagram-NB, please report it.\"\n );\n }\n\n const lastIndex = cells.findLastIndex(\n (cell) =>\n DEFAULT_CELL_ORDERS.findIndex((order) => matchCellOrder(cell, order)) <=\n index\n );\n const targetIndex = lastIndex + 1;\n return [\n ...cells.slice(0, targetIndex),\n ...newCells,\n ...cells.slice(targetIndex),\n ];\n}\n\nfunction matchCellOrder(cell: Cell, order: CellOrder) {\n return (\n cell.type === order.type &&\n (order.type !== \"decorator\" ||\n order.decorators.includes((cell as DecoratorCell).decorator))\n );\n}\n","import { Reducer } from \"react\";\nimport type { DrawCanvasAction, DrawCanvasState } from \"./interfaces\";\nimport { cells } from \"./cells\";\nimport { layoutKey } from \"./layoutKey\";\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 layoutKey,\n});\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\n\nexport const layoutKey: Reducer<number, DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"update-node-size\":\n return action.layoutKey;\n default:\n return state;\n }\n};\n","import { pick } from \"lodash\";\nimport {\n forceCollide,\n forceLink,\n forceManyBody,\n forceSimulation,\n forceX,\n forceY,\n type Simulation,\n} from \"d3-force\";\nimport type {\n Cell,\n ForceCollideOptions,\n ForceLink,\n ForceNode,\n LayoutOptionsForce,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport {\n isEdgeCell,\n isNodeCell,\n isNodeOrAreaDecoratorCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport type { FullRectTuple, PositionTuple } from \"../../diagram/interfaces\";\n\nexport interface ForceLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsForce;\n center?: PositionTuple;\n fixedPosition?: boolean;\n allowEdgeToArea?: boolean;\n}\n\nexport function forceLayout({\n cells,\n layoutOptions,\n center,\n fixedPosition,\n allowEdgeToArea,\n}: ForceLayoutOptions): {\n getNodeView: (id: NodeId) => NodeView;\n nodePaddings: FullRectTuple;\n} {\n const { nodePadding, collide } = {\n nodePadding: 0,\n ...pick(layoutOptions, [\"nodePadding\"]),\n collide:\n layoutOptions?.collide !== false\n ? ({\n radiusDiff: 18,\n strength: 1,\n iterations: 1,\n ...(layoutOptions?.collide === true\n ? null\n : (layoutOptions?.collide as ForceCollideOptions)),\n } as Required<ForceCollideOptions>)\n : (false as const),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n const forceNodes: ForceNode[] = [];\n const forceLinks: ForceLink[] = [];\n const nodesMap = new Map<NodeId, ForceNode>();\n for (const cell of cells) {\n if (\n (allowEdgeToArea && isNodeOrAreaDecoratorCell(cell)) ||\n isNodeCell(cell)\n ) {\n const node: ForceNode = {\n id: cell.id,\n width: cell.view.width + nodePaddings[1] + nodePaddings[3],\n height: cell.view.height + nodePaddings[0] + nodePaddings[2],\n ...(fixedPosition ? { fx: cell.view.x, fy: cell.view.y } : null),\n };\n forceNodes.push(node);\n nodesMap.set(node.id, node);\n } else if (isEdgeCell(cell)) {\n forceLinks.push({ source: cell.source, target: cell.target });\n }\n }\n\n const linkSimulation = forceLink<ForceNode, ForceLink>(forceLinks).id(\n (d) => d.id\n );\n const simulation = forceSimulation<ForceNode, ForceLink>(forceNodes)\n .force(\"link\", linkSimulation)\n .force(\"x\", forceX(center?.[0]))\n .force(\"y\", forceY(center?.[1]))\n .force(\"charge\", forceManyBody());\n\n if (collide) {\n simulation.force(\n \"collide\",\n forceCollide<ForceNode>()\n .radius(\n (d) =>\n Math.sqrt(d.width ** 2 + d.height ** 2) / 2 + collide.radiusDiff\n )\n .strength(collide.strength)\n .iterations(collide.iterations)\n );\n }\n\n simulation.stop();\n manuallyTickToTheEnd(simulation);\n\n return {\n getNodeView: (id: NodeId) => nodesMap.get(id) as NodeView,\n nodePaddings,\n };\n}\n\nfunction manuallyTickToTheEnd(\n simulation: Simulation<ForceNode, ForceLink>\n): void {\n // Manually tick to the end.\n simulation.tick(\n Math.ceil(\n Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay())\n )\n );\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, `.zoom-bar{position:absolute;bottom:20px;right:20px;width:40px;scale:0.8}.zoom-slider,\n.center-button{width:100%;display:flex;align-items:center;border:1px solid var(--antd-background-color-base);border-radius:var(--larger-border-radius);box-shadow:var(--connected-overlay-shadow);background-color:var(--color-fill-bg-container-4)}.zoom-slider{height:140px;padding:8px 0;flex-direction:column}[role=\"button\"]{cursor:pointer}.center-button{justify-content:center;margin-bottom:8px;height:40px}.center-button:hover{border-color:var(--antd-btn-default-hover-border-color)}.center-button path{fill:var(--antd-link-hover-color)}.center-button:hover path{fill:var(--palette-blue-7)}.zoom-button{font-size:16px;line-height:0}.zoom-button svg{width:1em;height:1em;fill:var(--antd-link-hover-color)}.zoom-slider .ant-slider-vertical{padding-left:5px;padding-right:5px}.zoom-slider .ant-slider-vertical .ant-slider-rail{width:2px}.zoom-slider .ant-slider-vertical .ant-slider-handle{width:6px;height:6px;left:3px}.zoom-slider .ant-slider .ant-slider-handle:hover::before,\n.zoom-slider .ant-slider .ant-slider-handle:focus::before,\n.zoom-slider .ant-slider .ant-slider-handle::before{width:10px;height:10px;left:-2px}.zoom-slider .ant-slider .ant-slider-handle:hover::after,\n.zoom-slider .ant-slider .ant-slider-handle:focus::after,\n.zoom-slider .ant-slider .ant-slider-handle::after{width:6px;height:6px;top:0;left:0}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","import { forEach, get, groupBy, isNil, orderBy } from \"lodash\";\nimport type {\n BaseNodeCell,\n Cell,\n DecoratorCell,\n InitialCell,\n NodeCell,\n} from \"../interfaces\";\nimport {\n isContainerDecoratorCell,\n isEdgeCell,\n isGroupDecoratorCell,\n isNoPoint,\n isNoSize,\n} from \"./asserts\";\nimport { dagreLayout } from \"../../shared/canvas/dagreLayout\";\nimport { computeBoundingBox } from \"./computeBoundingBox\";\nimport {\n CONTAINERGAP,\n DEFAULT_AREA_HEIGHT,\n DEFAULT_AREA_WIDTH,\n} from \"../constants\";\nimport { staggeredLayout } from \"./staggeredLayout\";\nimport { GROUPPADDING, initialGroupLayout } from \"./initialGroupLayout\";\nexport interface LayoutOptions {\n nodeLayout?: \"staggered\" | \"dagre\";\n}\n\n/**\n * 初始化容器内节点层次布局以及同步容器大小位置\n * @param cells\n */\nexport function initialContainerLayout(\n cells: InitialCell[],\n options: LayoutOptions = {}\n) {\n const { groupMap } = initialGroupLayout(cells, options);\n const nodeCells = cells.filter(\n (c) => c.type === \"node\" && !isNil(c.containerId)\n ) as NodeCell[];\n const groupCells = cells.filter(\n (c) =>\n c.type === \"decorator\" && c.decorator === \"group\" && !isNil(c.containerId)\n ) as DecoratorCell[];\n if (!nodeCells.length && !groupCells.length) return;\n\n const { nodeLayout = \"dagre\" } = options;\n\n const edgeCells = cells.filter(isEdgeCell);\n const containerCells = cells.filter((c) =>\n isContainerDecoratorCell(c)\n ) as DecoratorCell[];\n\n // 预处理 decoratorCells,以便后续查找更高效\n const containerCellMap = new Map<string, DecoratorCell>();\n let containerGap = 0,\n maxContainerWidth = 0;\n\n containerCells.forEach((cell) => {\n containerCellMap.set(cell.id, cell);\n });\n\n const containerGroup: Record<string, Omit<Cell, \"DecoratorCell\">[]> = {};\n const groupNameMap: Record<string, Set<string>> = {};\n\n forEach(\n groupBy([...nodeCells, ...groupCells], \"containerId\"),\n (groupedNodes, containerId) => {\n containerGroup[containerId] = groupedNodes;\n groupNameMap[containerId] = new Set(groupedNodes.map((node) => node.id));\n }\n );\n\n // 把边加入所属容器组\n edgeCells.forEach((edge) => {\n for (const [groupId, idSet] of Object.entries(groupNameMap)) {\n if (idSet.has(edge.source) && idSet.has(edge.target)) {\n containerGroup[groupId].push(edge);\n break;\n }\n }\n });\n\n const uniformWidthContainers: DecoratorCell[] = [];\n\n // 排序容器层级,level越大越后面;没有大小都排后面\n const sortedContainerIds = orderBy(\n containerCells.filter((cell) => containerGroup[cell.id]),\n [(o) => (isNoSize(o.view) ? 1 : 0), (o) => get(o, \"view.level\", 1)],\n [\"asc\", \"asc\"]\n ).map((cell) => cell.id);\n const { updatedGap, updatedMaxWidth } = processSortedContainers(\n sortedContainerIds,\n containerGroup,\n containerCellMap,\n nodeLayout,\n containerGap,\n uniformWidthContainers,\n maxContainerWidth,\n {\n groupCells,\n groupMap,\n }\n );\n\n containerGap = updatedGap;\n maxContainerWidth = updatedMaxWidth;\n\n // 统一容器宽度\n uniformWidthContainers.forEach((container) => {\n container.view.width = Math.max(DEFAULT_AREA_WIDTH, maxContainerWidth);\n });\n}\n\nfunction processSortedContainers(\n sortedContainerIds: string[],\n containerGroup: Record<string, Omit<Cell, \"DecoratorCell\">[]>,\n containerCellMap: Map<string, DecoratorCell>,\n nodeLayout: string,\n containerGap: number,\n uniformWidthContainers: DecoratorCell[],\n maxContainerWidth: number,\n decoratorGroup: {\n groupCells: DecoratorCell[];\n groupMap: Record<string, Omit<Cell, \"DecoratorCell\">[]>;\n }\n) {\n let currentContainerGap = containerGap;\n let currentMaxContainerWidth = maxContainerWidth;\n\n sortedContainerIds.forEach((groupId) => {\n const containerCell = containerCellMap.get(groupId)!;\n const groupedNodes = containerGroup[groupId] as Cell[];\n\n const isVertical = [\"top\", \"bottom\"].includes(\n get(containerCell, \"view.direction\", \"top\")\n );\n if (isVertical) currentContainerGap += CONTAINERGAP;\n const nodeCells = groupedNodes.filter(\n (cell) => cell.type === \"node\"\n ) as NodeCell[];\n const decoratorGroups = get(decoratorGroup, \"groupCells\", []).filter(\n (g) => g.containerId === groupId\n ) as DecoratorCell[];\n\n let nodeViews: (NodeCell | DecoratorCell)[] = [];\n if (nodeLayout === \"dagre\") {\n const { getNodeView } = dagreLayout({\n cells: [...groupedNodes, ...decoratorGroups],\n });\n nodeViews = [...nodeCells, ...decoratorGroups].map((cell) => {\n if (isNoPoint(cell.view) || isGroupDecoratorCell(cell)) {\n const view = getNodeView(cell.id);\n cell.view = {\n ...cell.view,\n x: view.x,\n y: view.y + currentContainerGap,\n width: view.width,\n height: view.height,\n };\n }\n return cell;\n });\n } else if (nodeLayout === \"staggered\") {\n nodeViews = staggeredLayout([...nodeCells, ...decoratorGroups], {\n offsetY: currentContainerGap,\n });\n }\n let containerHeight = 0,\n containerWidth = 0;\n if (isNoSize(containerCell.view)) {\n const containerRect = computeBoundingBox(nodeViews as BaseNodeCell[]);\n containerHeight = get(containerRect, \"height\", DEFAULT_AREA_HEIGHT);\n containerWidth = get(containerRect, \"width\", DEFAULT_AREA_WIDTH);\n containerCell.view = { ...containerCell.view, ...containerRect };\n uniformWidthContainers.push(containerCell);\n } else {\n containerHeight = get(containerCell, \"view.height\");\n containerWidth = get(containerCell, \"view.width\");\n }\n\n /**\n * 计算好容器位置在重新设置组内节点x,y\n */\n if (decoratorGroups.length > 0) {\n const groupMap = get(decoratorGroup, \"groupMap\", {});\n decoratorGroups.forEach((group) => {\n const groupId = group.id;\n const { x: groupX, y: groupY } = group.view;\n const nodeCells: NodeCell[] = get(groupMap, groupId, []);\n\n if (!nodeCells.length) return;\n\n // 记录第一个节点的基准坐标\n const baseX = nodeCells[0].view.x;\n const baseY = nodeCells[0].view.y;\n\n nodeCells.forEach((node: NodeCell) => {\n node.view = {\n ...node.view,\n x: groupX + (node.view?.x - baseX),\n y: groupY + (node.view?.y - baseY),\n };\n });\n\n group.view = {\n ...group.view,\n x: groupX - GROUPPADDING,\n y: groupY - GROUPPADDING,\n };\n });\n }\n\n currentMaxContainerWidth = Math.max(\n containerWidth,\n currentMaxContainerWidth\n );\n currentContainerGap += containerHeight + CONTAINERGAP;\n });\n\n return {\n updatedGap: currentContainerGap,\n updatedMaxWidth: currentMaxContainerWidth,\n };\n}\n","import * as React from \"react\";\nconst SvgCenter = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={24} height={24} viewBox=\"0 0 24 24\" {...props}><path d=\"M12 0a.5.5 0 0 1 .5.5v2.013a9.5 9.5 0 0 1 8.987 8.988L23.5 11.5a.5.5 0 0 1 0 1h-2.013a9.5 9.5 0 0 1-8.987 8.987V23.5a.5.5 0 0 1-1 0v-2.013A9.5 9.5 0 0 1 2.514 12.5H.5a.5.5 0 0 1 0-1h2.013A9.5 9.5 0 0 1 11.5 2.514V.5A.5.5 0 0 1 12 0M3.514 11.5H7.5a.5.5 0 0 1 0 1H3.514a8.5 8.5 0 0 0 7.987 7.986L11.5 16.5a.5.5 0 0 1 1 0v3.986a8.5 8.5 0 0 0 7.986-7.986H16.5a.5.5 0 0 1 0-1h3.986A8.5 8.5 0 0 0 12.5 3.515V7.5a.5.5 0 0 1-1 0V3.514a8.5 8.5 0 0 0-7.986 7.987zm8.486-1a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3\" /></svg>;\nexport default SvgCenter;","import * as React from \"react\";\nconst SvgZoomIn = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={128} height={128} className=\"icon\" viewBox=\"0 0 1024 1024\" {...props}><path d=\"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384\" /><path d=\"M744.448 486.4h-204.8V281.6a25.6 25.6 0 1 0-51.2 0v204.8h-204.8a25.6 25.6 0 0 0 0 51.2h204.8v204.8a25.6 25.6 0 0 0 51.2 0V537.6h204.8a25.6 25.6 0 0 0 0-51.2\" /></svg>;\nexport default SvgZoomIn;","import * as React from \"react\";\nconst SvgZoomOut = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={128} height={128} className=\"icon\" viewBox=\"0 0 1024 1024\" {...props}><path d=\"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384\" /><path d=\"M744.448 486.4H280.064a25.6 25.6 0 1 0 0 51.2h464.384a25.6 25.6 0 0 0 0-51.2\" /></svg>;\nexport default SvgZoomOut;","import React, { useCallback, useMemo, useRef } from \"react\";\nimport { ConfigProvider, Slider, theme } from \"antd\";\nimport { StyleProvider, createCache } from \"@ant-design/cssinjs\";\nimport { useCurrentTheme } from \"@next-core/react-runtime\";\nimport type { RangeTuple } from \"../../diagram/interfaces\";\nimport CenterSVG from \"./icons/center.svg\";\nimport ZoomInSVG from \"./icons/zoom-in.svg\";\nimport ZoomOutSVG from \"./icons/zoom-out.svg\";\n\nexport interface ZoomBarComponentProps {\n shadowRoot: ShadowRoot;\n scale: number;\n scaleRange: RangeTuple;\n onZoomChange(value: number): void;\n onReCenter(): void;\n}\n\nexport function ZoomBarComponent({\n shadowRoot,\n scale,\n scaleRange,\n onZoomChange,\n onReCenter,\n}: ZoomBarComponentProps): JSX.Element | null {\n const currentTheme = useCurrentTheme();\n const cache = useMemo(() => createCache(), []);\n const zoomBarRef = useRef<HTMLDivElement | null>(null);\n const min = scaleRange[0] * 100;\n const max = scaleRange[1] * 100;\n const value = scale * 100;\n const step = 5;\n\n const tooltip = useMemo(() => {\n return {\n formatter: (value: number | undefined) => `${value}%`,\n placement: \"left\" as const,\n getPopupContainer: () => zoomBarRef.current!,\n };\n }, []);\n\n const onZoomIn = useCallback(() => {\n onZoomChange(Math.min(value + step, max));\n }, [max, onZoomChange, value]);\n\n const onZoomOut = useCallback(() => {\n onZoomChange(Math.max(value - step, min));\n }, [min, onZoomChange, value]);\n\n return (\n <ConfigProvider\n theme={{\n algorithm:\n currentTheme === \"dark-v2\"\n ? theme.darkAlgorithm\n : theme.defaultAlgorithm,\n }}\n >\n <StyleProvider\n container={shadowRoot}\n // Auto clear injected styles after unmount\n autoClear\n cache={cache}\n // Set hashPriority to \"high\" to disable `:where()` usage for compatibility\n hashPriority=\"high\"\n >\n <div className=\"zoom-bar\" ref={zoomBarRef}>\n <div className=\"center-button\" onClick={onReCenter} role=\"button\">\n <CenterSVG />\n </div>\n <div className=\"zoom-slider\">\n <div className=\"zoom-button\" role=\"button\" onClick={onZoomIn}>\n <ZoomInSVG />\n </div>\n <Slider\n min={min}\n max={max}\n value={value}\n step={step}\n vertical\n included={false}\n tooltip={tooltip}\n onChange={onZoomChange}\n />\n <div className=\"zoom-button\" role=\"button\" onClick={onZoomOut}>\n <ZoomOutSVG />\n </div>\n </div>\n </div>\n </StyleProvider>\n </ConfigProvider>\n );\n}\n","import { useMemo, useRef } from \"react\";\nimport {\n __secret_internals,\n checkIfByTransform,\n checkIfOfComputed,\n} from \"@next-core/runtime\";\nimport { findIndex, isUndefined, omitBy } from \"lodash\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n ComputedLineConnecterConf,\n EdgeCell,\n EdgeLineConf,\n EditableLineCell,\n LineConnecterConf,\n LineMarker,\n} from \"../../draw-canvas/interfaces\";\nimport {\n isEdgeCell,\n isLineDecoratorCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport {\n DEFAULT_LINE_STROKE_COLOR,\n DEFAULT_LINE_STROKE_WIDTH,\n DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n DEFAULT_LINE_INTERACT_SHOW_START_ARROW,\n DEFAULT_LINE_INTERACT_SHOW_END_ARROW,\n DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n DEFAULT_DECORATOR_LINE_STROKE_COLOR,\n} from \"../../draw-canvas/constants\";\nimport { LineMarkerConf } from \"../../diagram/interfaces\";\n\nexport interface UseLineMarkersOptions {\n cells: Cell[];\n defaultEdgeLines: EdgeLineConf[] | undefined;\n markerPrefix: string;\n lineConnector?: LineConnecterConf | boolean;\n /** Use memoized result when moving and resizing cells */\n useMemoizedResult?: boolean;\n}\n\nexport interface UseLineMarkersResult {\n lineConfMap: WeakMap<EditableLineCell, ComputedEdgeLineConf>;\n lineConnectorConf: ComputedLineConnecterConf | null;\n markers: LineMarker[];\n}\n\nexport function useLineMarkers({\n cells,\n defaultEdgeLines,\n markerPrefix,\n lineConnector,\n useMemoizedResult,\n}: UseLineMarkersOptions): UseLineMarkersResult {\n const memoizedResult = useRef<UseLineMarkersResult | null>(null);\n\n return useMemo<UseLineMarkersResult>(() => {\n if (useMemoizedResult && memoizedResult.current) {\n // If cells are moving or resizing, we can use the previous memoized result.\n return memoizedResult.current;\n }\n\n // Always put the default stroke marker at the first position,\n // since the connecting line will use it.\n const markers: LineMarker[] = [\n {\n strokeColor: DEFAULT_LINE_STROKE_COLOR,\n markerType: \"arrow\",\n },\n ];\n\n let lineConnectorConf: ComputedLineConnecterConf | null = null;\n if (lineConnector) {\n lineConnectorConf = {\n ...getDefaultLineConf(),\n editingStrokeColor: \"var(--palette-blue-5)\",\n ...omitBy(lineConnector === true ? {} : lineConnector, isUndefined),\n } as ComputedLineConnecterConf;\n const lineMarkers: LineMarkerConf[] = getMarkers(lineConnectorConf);\n for (const marker of lineMarkers) {\n const { placement, type: _type } = marker;\n const type = _type ?? \"arrow\";\n const markerIndex = addMarker(\n {\n strokeColor: lineConnectorConf.strokeColor,\n markerType: type,\n },\n markers\n );\n const editingMarkerIndex = addMarker(\n {\n strokeColor: lineConnectorConf.editingStrokeColor,\n markerType: type,\n },\n markers\n );\n if (placement === \"start\") {\n lineConnectorConf.$markerStartUrl = `url(#${markerPrefix}${markerIndex})`;\n lineConnectorConf.$editingStartMarkerUrl = `url(#${markerPrefix}${editingMarkerIndex})`;\n } else {\n lineConnectorConf.$markerEndUrl = `url(#${markerPrefix}${markerIndex})`;\n lineConnectorConf.$editingEndMarkerUrl = `url(#${markerPrefix}${editingMarkerIndex})`;\n }\n }\n }\n\n const map = new WeakMap<EditableLineCell, ComputedEdgeLineConf>();\n for (const cell of cells) {\n const isEdge = isEdgeCell(cell);\n const isLineDecorator = isLineDecoratorCell(cell);\n\n let lineConf: ComputedEdgeLineConf;\n if (isEdge) {\n const computedLineConf =\n (Array.isArray(defaultEdgeLines)\n ? transformLineConf(\n defaultEdgeLines.find((item) =>\n checkIfByTransform(item, { edge: cell })\n ),\n cell\n )\n : (\n __secret_internals.legacyDoTransform(\n { edge: cell },\n defaultEdgeLines\n ) as EdgeLineConf[]\n )?.find((item) => checkIfOfComputed(item))) ?? {};\n lineConf = {\n ...getDefaultLineConf(),\n ...omitBy(computedLineConf, isUndefined),\n ...omitBy(cell.view, isUndefined),\n } as ComputedEdgeLineConf;\n if (lineConf.parallelGap === undefined) {\n lineConf.parallelGap = lineConf.interactStrokeWidth;\n }\n } else {\n lineConf = {\n ...getDefaultLineConf(),\n showEndArrow: false,\n strokeColor: DEFAULT_DECORATOR_LINE_STROKE_COLOR,\n ...omitBy(cell.view, isUndefined),\n } as ComputedEdgeLineConf;\n }\n\n if (isEdge || isLineDecorator) {\n const lineMarkers: LineMarkerConf[] = getMarkers(lineConf);\n\n for (const marker of lineMarkers) {\n const { placement, type: _type } = marker;\n const type = _type ?? \"arrow\";\n const markerIndex = addMarker(\n {\n strokeColor: lineConf.strokeColor,\n markerType: type,\n },\n markers\n );\n if (placement === \"start\") {\n lineConf.$markerStartUrl = `url(#${markerPrefix}${markerIndex})`;\n } else {\n lineConf.$markerEndUrl = `url(#${markerPrefix}${markerIndex})`;\n }\n\n const activeStrokeColor = lineConf.overrides?.active?.strokeColor;\n if (activeStrokeColor && activeStrokeColor !== lineConf.strokeColor) {\n const activeMarkerIndex = addMarker(\n {\n strokeColor: activeStrokeColor,\n markerType: type,\n },\n markers\n );\n if (placement === \"start\") {\n lineConf.$activeMarkerStartUrl = `url(#${markerPrefix}${activeMarkerIndex})`;\n } else {\n lineConf.$activeMarkerEndUrl = `url(#${markerPrefix}${activeMarkerIndex})`;\n }\n }\n\n if (isEdge) {\n const activeRelatedStrokeColor =\n lineConf.overrides?.activeRelated?.strokeColor;\n if (\n activeRelatedStrokeColor &&\n activeRelatedStrokeColor !== lineConf.strokeColor\n ) {\n const activeRelatedMarkerIndex = addMarker(\n {\n strokeColor: activeRelatedStrokeColor,\n markerType: type,\n },\n markers\n );\n if (placement === \"start\") {\n lineConf.$activeRelatedMarkerStartUrl = `url(#${markerPrefix}${activeRelatedMarkerIndex})`;\n } else {\n lineConf.$activeRelatedMarkerEndUrl = `url(#${markerPrefix}${activeRelatedMarkerIndex})`;\n }\n }\n }\n }\n map.set(cell, lineConf);\n }\n }\n return (memoizedResult.current = {\n lineConfMap: map,\n lineConnectorConf,\n markers,\n });\n }, [cells, defaultEdgeLines, lineConnector, markerPrefix, useMemoizedResult]);\n}\n\nfunction transformLineConf(\n lineConf: EdgeLineConf | undefined,\n edge: EdgeCell\n): EdgeLineConf {\n // Do not transform useBrick\n if (lineConf?.label?.useBrick) {\n const {\n label: { useBrick, ...restLabel },\n ...restConf\n } = lineConf;\n const computedRestConf = __secret_internals.legacyDoTransform(\n { edge },\n {\n ...restConf,\n label: restLabel,\n }\n ) as EdgeLineConf;\n return {\n ...computedRestConf,\n label: {\n ...computedRestConf.label,\n useBrick,\n },\n } as EdgeLineConf;\n }\n return __secret_internals.legacyDoTransform(\n { edge },\n lineConf\n ) as EdgeLineConf;\n}\n\nexport function getMarkers(lineConf: ComputedEdgeLineConf): LineMarkerConf[] {\n let lineMarkers: LineMarkerConf[] = [];\n if (lineConf.markers) {\n lineMarkers = lineConf.markers;\n } else {\n if (lineConf.showStartArrow) {\n lineMarkers.push({\n type: \"arrow\",\n placement: \"start\",\n });\n }\n if (lineConf.showEndArrow) {\n lineMarkers.push({\n type: \"arrow\",\n placement: \"end\",\n });\n }\n }\n return lineMarkers;\n}\nfunction addMarker(marker: LineMarker, markers: LineMarker[]): number {\n let markerIndex = findIndex(markers, marker);\n if (markerIndex === -1) {\n markerIndex = markers.push(marker) - 1;\n }\n return markerIndex;\n}\n\nfunction getDefaultLineConf(): EdgeLineConf {\n return {\n type: \"straight\",\n dashed: false,\n strokeColor: DEFAULT_LINE_STROKE_COLOR,\n strokeWidth: DEFAULT_LINE_STROKE_WIDTH,\n interactStrokeWidth: DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n showStartArrow: DEFAULT_LINE_INTERACT_SHOW_START_ARROW,\n showEndArrow: DEFAULT_LINE_INTERACT_SHOW_END_ARROW,\n animate: {\n useAnimate: false,\n duration: DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n },\n jumps: false,\n };\n}\n","import React, { useCallback, useEffect, useMemo } from \"react\";\nimport { checkIfOfComputed } from \"@next-core/runtime\";\nimport { ReactUseBrick } from \"@next-core/react-runtime\";\nimport classNames from \"classnames\";\nimport type {\n LineLabelConf,\n PositionTuple,\n TextOptions,\n} from \"../diagram/interfaces\";\nimport type { EdgeCell, PositionAndAngle } from \"./interfaces\";\n\nexport interface LineLabelComponentProps {\n edge: EdgeCell;\n position?: PositionAndAngle | null;\n offset?: PositionTuple | null;\n label?: LineLabelConf;\n text?: TextOptions;\n onRendered?: (element: HTMLElement | null) => void;\n onClick?: () => void;\n}\n\nexport function LineLabelComponent({\n edge,\n position,\n offset,\n label,\n text,\n onRendered,\n onClick,\n}: LineLabelComponentProps): JSX.Element | null {\n if (!label && !text) {\n return null;\n }\n const ready = !!(position && offset);\n return (\n <foreignObject\n className={classNames(\"line-label-container\", { ready })}\n x={ready ? position[0] + offset[0] : 0}\n y={ready ? position[1] + offset[1] : 0}\n onClick={onClick}\n >\n {label ? (\n <div className=\"line-label label\">\n <LineLabelUseBrickComponent\n edge={edge}\n label={label}\n onRendered={onRendered}\n />\n </div>\n ) : (\n <LineLabelTextComponent text={text!} onRendered={onRendered} />\n )}\n </foreignObject>\n );\n}\n\ninterface LineLabelTextComponentProps {\n text: TextOptions;\n onRendered?: (element: HTMLElement | null) => void;\n}\n\nfunction LineLabelTextComponent({\n text,\n onRendered,\n}: LineLabelTextComponentProps): JSX.Element {\n const refCallback = useCallback(\n (element: HTMLDivElement) => {\n onRendered?.(element);\n },\n [onRendered]\n );\n\n return (\n <div className=\"line-label text\" ref={refCallback} style={text.style}>\n {text.content}\n </div>\n );\n}\n\ninterface LineLabelUseBrickComponentProps {\n edge: EdgeCell;\n label: LineLabelConf;\n onRendered?: (element: HTMLElement | null) => void;\n}\n\n// istanbul ignore next\nfunction LineLabelUseBrickComponent({\n edge,\n label,\n onRendered,\n}: LineLabelUseBrickComponentProps): JSX.Element | null {\n const useBrick = useMemo(\n () => (checkIfOfComputed(label) ? label.useBrick : null),\n [label]\n );\n\n const memoizedData = useMemo(() => ({ edge }), [edge]);\n\n useEffect(() => {\n if (!useBrick) {\n // Keep the same time delay for reporting rendered.\n setTimeout(() => {\n onRendered?.(null);\n });\n }\n }, [onRendered, useBrick]);\n\n useEffect(\n () => {\n return () => {\n onRendered?.(null);\n };\n },\n // Only unmount once\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n const refCallback = useCallback(\n (element: HTMLElement | null) => {\n if (element) {\n // Todo: correctly wait for `useBrick` in v3 to be rendered (after layout)\n // Wait a macro task to let `useBrick` to be rendered.\n setTimeout(() => {\n // await Promise.resolve();\n onRendered?.(element.parentElement);\n });\n }\n },\n [onRendered]\n );\n\n const ignoredCallback = useCallback(() => {\n setTimeout(() => {\n onRendered?.(null);\n });\n }, [onRendered]);\n\n if (!useBrick) {\n return null;\n }\n\n return (\n <ReactUseBrick\n refCallback={refCallback}\n ignoredCallback={ignoredCallback}\n useBrick={useBrick}\n data={memoizedData}\n />\n );\n}\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport classNames from \"classnames\";\nimport { uniqueId } from \"lodash\";\nimport ResizeObserver from \"resize-observer-polyfill\";\nimport type {\n ActiveTarget,\n ComputedEdgeLineConf,\n Direction,\n EdgeCell,\n EdgeLineMotion,\n EditableLine,\n EditableLineCell,\n PositionAndAngle,\n} from \"./interfaces\";\nimport {\n DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n DEFAULT_MOTION_SPEED,\n} from \"./constants\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { getMarkers } from \"../shared/canvas/useLineMarkers\";\nimport type {\n LineMarkerConf,\n NodePosition,\n SizeTuple,\n} from \"../diagram/interfaces\";\nimport { LineLabelComponent } from \"./LineLabelComponent\";\nimport { cellToTarget } from \"./processors/cellToTarget\";\nimport { getLabelMaskAndOffset } from \"./processors/getLabelMaskAndOffset\";\n\nexport interface EdgeComponentProps {\n edge: EdgeCell;\n lineConfMap: WeakMap<EditableLineCell, ComputedEdgeLineConf>;\n editableLineMap: WeakMap<EditableLineCell, EditableLine>;\n readOnly?: boolean;\n active?: boolean;\n activeRelated?: boolean;\n onSwitchActiveTarget?(activeTarget: ActiveTarget | null): void;\n}\n\nexport function EdgeComponent({\n edge,\n lineConfMap,\n editableLineMap,\n readOnly,\n active,\n activeRelated,\n onSwitchActiveTarget,\n}: EdgeComponentProps): JSX.Element | null {\n const pathRef = useRef<SVGPathElement | null>(null);\n const lineConf = lineConfMap.get(edge)!;\n const { points: linePoints, jumpsMap } = editableLineMap.get(edge) ?? {};\n\n const line = useMemo(() => {\n return curveLine(\n linePoints,\n lineConf.type === \"curve\" ? lineConf.curveType : \"curveLinear\",\n 0,\n 1,\n jumpsMap\n );\n }, [lineConf, linePoints, jumpsMap]);\n\n const lineClipPathPrefix = useMemo(() => uniqueId(\"line-mask-\"), []);\n\n const [labelPosition, setLabelPosition] = useState<PositionAndAngle | null>(\n null\n );\n const [labelSize, setLabelSize] = useState<SizeTuple | null>(null);\n const [lineRect, setLineRect] = useState<Pick<\n SVGRect,\n \"x\" | \"y\" | \"width\" | \"height\"\n > | null>(null);\n\n const updateLabelPosition = useCallback(() => {\n const path = pathRef.current;\n const { label, text } = lineConf;\n // istanbul ignore next\n if (path && linePoints && (label || text)) {\n if (process.env.NODE_ENV === \"test\") {\n setLabelPosition([30, 40, \"center\", 0, 0]);\n setLineRect({ x: 10, y: 20, width: 300, height: 400 });\n return;\n }\n const placement = (label ? label.placement : text.placement) ?? \"center\";\n const offset = (label ? label.offset : text.offset) ?? 0;\n const pathLength = path.getTotalLength();\n const halfPathLength = pathLength / 2;\n const pathPoint = path.getPointAtLength(\n placement === \"start\"\n ? 0\n : placement === \"end\"\n ? pathLength\n : halfPathLength + offset\n );\n\n let direction: Direction | \"center\" = \"center\";\n let angle = 0;\n if (placement === \"start\" || placement === \"end\") {\n let p0: NodePosition;\n let p1: NodePosition;\n if (placement === \"start\") {\n p0 = linePoints[0];\n p1 = linePoints[1];\n } else {\n p0 = linePoints[linePoints.length - 1];\n p1 = linePoints[linePoints.length - 2];\n }\n angle = Math.atan2(p1.y - p0.y, p1.x - p0.x);\n direction =\n Math.abs(p0.x - p1.x) > Math.abs(p0.y - p1.y)\n ? p0.x > p1.x\n ? \"left\"\n : \"right\"\n : p0.y > p1.y\n ? \"top\"\n : \"bottom\";\n }\n\n setLabelPosition([pathPoint.x, pathPoint.y, direction, angle, offset]);\n const rect = path.getBBox();\n setLineRect({\n x: rect.x - 1000,\n y: rect.y - 1000,\n width: rect.width + 2000,\n height: rect.height + 2000,\n });\n }\n }, [lineConf, linePoints]);\n\n const [pathLength, setPathLength] = useState<number | null>(null);\n\n const pathRefCallback = useCallback(\n (element: SVGPathElement | null) => {\n pathRef.current = element;\n if (element) {\n // Jest does not support `SVGPathElement::getTotalLength`\n setPathLength(element.getTotalLength?.() ?? 100);\n const rect = element.getBBox?.();\n edge.view = {\n ...edge.view,\n x: rect?.x,\n y: rect?.y,\n width: rect?.width,\n height: rect?.height,\n };\n }\n updateLabelPosition();\n },\n [updateLabelPosition, edge]\n );\n\n const [labelElement, setLabelElement] = useState<HTMLElement | null>(null);\n\n useEffect(() => {\n if (!labelElement) {\n setLabelSize(null);\n return;\n }\n const observerCallback = () => {\n const { offsetWidth, offsetHeight } = labelElement;\n // Do not mask out when the label takes no space.\n // istanbul ignore next\n if (\n process.env.NODE_ENV !== \"test\" &&\n (offsetWidth === 0 || offsetHeight === 0)\n ) {\n setLabelSize(null);\n return;\n }\n setLabelSize([offsetWidth, offsetHeight]);\n };\n const resizeObserver = new ResizeObserver(observerCallback);\n resizeObserver.observe(labelElement);\n\n // `ResizeObserver` will not call the callback in test environment.\n // istanbul ignore next\n if (process.env.NODE_ENV === \"test\") {\n observerCallback();\n }\n return () => {\n resizeObserver.disconnect();\n };\n }, [labelElement]);\n\n const handleLabelRendered = useCallback((element: HTMLElement | null) => {\n setLabelElement(element);\n }, []);\n\n useEffect(\n () => {\n updateLabelPosition();\n },\n // Update label position when line points changed\n [updateLabelPosition, linePoints]\n );\n\n const onLabelClick = useCallback(() => {\n onSwitchActiveTarget?.(cellToTarget(edge));\n }, [edge, onSwitchActiveTarget]);\n\n const onDoubleClick = useCallback(\n (e: React.MouseEvent) => {\n if (readOnly || !lineConf.callLabelOnDoubleClick) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n (\n labelElement?.firstElementChild as unknown as Record<string, () => void>\n )?.[lineConf.callLabelOnDoubleClick]?.();\n },\n [labelElement, lineConf, readOnly]\n );\n\n const [mask, labelOffset] = useMemo(\n () => getLabelMaskAndOffset(labelPosition, labelSize),\n [labelPosition, labelSize]\n );\n\n const clipPathPoints = useMemo(() => {\n if (!mask || !lineRect) {\n return null;\n }\n const right = lineRect.x + lineRect.width;\n const bottom = lineRect.y + lineRect.height;\n const maskRight = mask.left + mask.width;\n const maskBottom = mask.top + mask.height;\n return [\n [mask.left, maskBottom],\n [maskRight, maskBottom],\n [maskRight, mask.top],\n [mask.left, mask.top],\n [mask.left, lineRect.y],\n [right, lineRect.y],\n [right, bottom],\n [lineRect.x, bottom],\n [lineRect.x, lineRect.y],\n [mask.left, lineRect.y],\n ]\n .map((points) => points.join(\",\"))\n .join(\" \");\n }, [lineRect, mask]);\n\n if (!line) {\n // This happens when source or target is not found,\n // or when source or target has not been positioned yet.\n return null;\n }\n\n let markerStart: string | undefined;\n let markerEnd: string | undefined;\n let strokeColor: string | undefined;\n let strokeWidth: number | undefined;\n let motion: EdgeLineMotion | undefined;\n const lineMarkers: LineMarkerConf[] = getMarkers(lineConf);\n if (active) {\n const overrides = lineConf.overrides?.active;\n strokeColor = overrides?.strokeColor ?? lineConf.strokeColor;\n strokeWidth = overrides?.strokeWidth ?? lineConf.strokeWidth;\n motion = overrides?.motion;\n for (const marker of lineMarkers) {\n if (marker.placement === \"start\") {\n markerStart =\n lineConf.$activeMarkerStartUrl ?? lineConf.$markerStartUrl;\n } else {\n markerEnd = lineConf.$activeMarkerEndUrl ?? lineConf.$markerEndUrl;\n }\n }\n } else if (activeRelated) {\n const overrides = lineConf.overrides?.activeRelated;\n strokeColor = overrides?.strokeColor ?? lineConf.strokeColor;\n strokeWidth = overrides?.strokeWidth ?? lineConf.strokeWidth;\n motion = overrides?.motion;\n for (const marker of lineMarkers) {\n if (marker.placement === \"start\") {\n markerStart =\n lineConf.$activeRelatedMarkerStartUrl ?? lineConf.$markerStartUrl;\n } else {\n markerEnd =\n lineConf.$activeRelatedMarkerEndUrl ?? lineConf.$markerEndUrl;\n }\n }\n } else {\n strokeColor = lineConf.strokeColor;\n strokeWidth = lineConf.strokeWidth;\n for (const marker of lineMarkers) {\n if (marker.placement === \"start\") {\n markerStart = lineConf.$markerStartUrl;\n } else {\n markerEnd = lineConf.$markerEndUrl;\n }\n }\n }\n\n let motionPath: string | undefined;\n if (motion?.shape === \"dot\") {\n const radius = motion.size == null ? strokeWidth * 2 : motion.size / 2;\n motionPath = `M 0,${-radius} A ${radius},${radius} 0,1,1 0,${radius} A ${radius},${radius} 0,1,1 0,${-radius} z`;\n } else if (motion?.shape === \"triangle\") {\n const radius = motion.size == null ? strokeWidth * 2 : motion.size / 2;\n const offset = radius / Math.sqrt(3);\n motionPath = `M ${-offset},${radius} v ${-radius * 2} L ${offset * 2},0 z`;\n }\n let motionDuration: string | undefined;\n if (pathLength) {\n motionDuration = `${pathLength / (motion?.speed ?? DEFAULT_MOTION_SPEED)}s`;\n }\n\n const hasMotion = [\n lineConf.overrides?.active?.motion?.shape,\n lineConf.overrides?.activeRelated?.motion?.shape,\n ].some((item) => item === \"dot\" || item === \"triangle\");\n\n const clipPathUrl = clipPathPoints\n ? `url(#${lineClipPathPrefix})`\n : undefined;\n\n return (\n <>\n {clipPathPoints && (\n <defs>\n <clipPath id={lineClipPathPrefix}>\n <polygon points={clipPathPoints} />\n </clipPath>\n </defs>\n )}\n <g className=\"line-group\" onDoubleClick={onDoubleClick}>\n <path\n // This `path` is made for expanding interaction area of graph lines.\n d={line}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={lineConf.interactStrokeWidth}\n clipPath={clipPathUrl}\n />\n <path\n ref={pathRefCallback}\n className={classNames(\"line\", {\n dashed: lineConf.dashed,\n dotted: lineConf.dotted,\n [`${lineConf.dashed ? \"dashed\" : lineConf.dotted ? \"dotted\" : \"solid\"}-animation`]:\n lineConf.animate.useAnimate,\n })}\n clipPath={clipPathUrl}\n style={\n {\n \"--time\": `${lineConf.animate.duration ?? DEFAULT_LINE_INTERACT_ANIMATE_DURATION}s`,\n \"--solid-length\": pathLength,\n } as React.CSSProperties\n }\n d={line}\n fill=\"none\"\n stroke={strokeColor}\n strokeWidth={strokeWidth}\n markerStart={markerStart}\n markerEnd={markerEnd}\n />\n {!lineConf.overrides?.active && (\n <path\n className=\"line-active-bg\"\n d={line}\n fill=\"none\"\n clipPath={clipPathUrl}\n />\n )}\n {\n // No dur in old browsers will cause animation not working.\n // So always set a dur.\n hasMotion && motionDuration && (\n <path\n className={classNames(\"motion\", { visible: !!motionPath })}\n d={motionPath}\n fill={strokeColor}\n >\n <animateMotion\n dur={motionDuration}\n repeatCount={\"indefinite\"}\n rotate={\"auto\"}\n path={line}\n />\n </path>\n )\n }\n </g>\n <LineLabelComponent\n edge={edge}\n position={labelPosition}\n offset={labelOffset}\n label={lineConf.label}\n text={lineConf.text}\n onClick={onLabelClick}\n onRendered={handleLabelRendered}\n />\n </>\n );\n}\n","import type {\n PositionTuple,\n SimpleRect,\n SizeTuple,\n} from \"../../diagram/interfaces\";\nimport type { PositionAndAngle } from \"../interfaces\";\n\nexport function getLabelMaskAndOffset(\n labelPosition: PositionAndAngle | null,\n labelSize: SizeTuple | null\n): [labelMask: SimpleRect | null, labelOffset: PositionTuple | null] {\n if (!labelPosition || !labelSize) {\n return [null, null];\n }\n const padding = 3;\n const [x, y, direction, angle, offset] = labelPosition;\n const [width, height] = labelSize;\n\n const left = x - width / 2 - padding;\n const top = y - height / 2 - padding;\n let offsetX = 0;\n let offsetY = 0;\n const halfWidth = width / 2 + padding;\n const halfHeight = height / 2 + padding;\n switch (direction) {\n case \"top\":\n offsetX = offset * Math.cos(angle) - halfHeight / Math.tan(angle);\n offsetY = offset * Math.sin(angle) - halfHeight;\n break;\n case \"bottom\":\n offsetX = offset * Math.cos(angle) + halfHeight / Math.tan(angle);\n offsetY = offset * Math.sin(angle) + halfHeight;\n break;\n case \"left\":\n offsetX = offset * Math.cos(angle) - halfWidth;\n offsetY = offset * Math.sin(angle) - halfWidth * Math.tan(angle);\n break;\n case \"right\":\n offsetX = offset * Math.cos(angle) + halfWidth;\n offsetY = offset * Math.sin(angle) + halfWidth * Math.tan(angle);\n break;\n }\n\n return [\n {\n left: left + offsetX,\n top: top + offsetY,\n width: width + padding * 2,\n height: height + padding * 2,\n },\n [offsetX, offsetY],\n ];\n}\n","import React from \"react\";\n\nexport interface LockIconProps {\n x: number;\n y: number;\n}\n\nexport function LockIcon({ x, y }: LockIconProps) {\n // 12 / 512 = 0.0234375\n return (\n <g\n transform={`translate(${x}, ${y}) scale(0.0234375)`}\n className=\"lock-icon\"\n >\n <path\n d=\"M144 144l0 48 160 0 0-48c0-44.2-35.8-80-80-80s-80 35.8-80 80zM80 192l0-48C80 64.5 144.5 0 224 0s144 64.5 144 144l0 48 16 0c35.3 0 64 28.7 64 64l0 192c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 256c0-35.3 28.7-64 64-64l16 0z\"\n fill=\"var(--color-secondary-text)\"\n stroke=\"none\"\n />\n </g>\n );\n}\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { ReactUseBrick } from \"@next-core/react-runtime\";\nimport { __secret_internals, checkIfByTransform } from \"@next-core/runtime\";\nimport { isEqual } from \"lodash\";\nimport ResizeObserver from \"resize-observer-polyfill\";\nimport type {\n NodeBrickCell,\n NodeBrickConf,\n NodeCell,\n NodeComponentCell,\n} from \"./interfaces\";\nimport type { SizeTuple } from \"../diagram/interfaces\";\nimport { LockIcon } from \"./LockIcon\";\n\nexport interface NodeComponentProps {\n node: NodeCell;\n x?: number;\n y?: number;\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n locked?: boolean;\n containerLocked?: boolean;\n groupLocked?: boolean;\n onResize(id: string, size: SizeTuple | null): void;\n}\n\nexport function NodeComponent({\n node,\n x,\n y,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n locked,\n containerLocked,\n groupLocked,\n onResize,\n}: NodeComponentProps): JSX.Element | null {\n const memoizedData = useDeepMemo({\n node: { id: node.id, data: node.data, locked: !!locked },\n });\n const specifiedUseBrick = (node as NodeBrickCell).useBrick;\n const specifiedComponent = (node as NodeComponentCell).component;\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const { useBrick, component: Component } =\n useMemo<\n Pick<NodeBrickConf, \"useBrick\" | \"component\"> | null | undefined\n >(() => {\n return degraded\n ? null\n : specifiedUseBrick\n ? {\n useBrick: specifiedUseBrick,\n }\n : specifiedComponent\n ? {\n component: specifiedComponent,\n }\n : defaultNodeBricks?.find((item) =>\n checkIfByTransform(item, memoizedData)\n );\n }, [\n defaultNodeBricks,\n degraded,\n memoizedData,\n specifiedComponent,\n specifiedUseBrick,\n ]) ?? {};\n\n const label = useMemo<string>(\n () =>\n degraded\n ? String(\n __secret_internals.legacyDoTransform(\n memoizedData,\n degradedNodeLabel ?? \"<% DATA.node.id %>\"\n )\n )\n : \"\",\n [degraded, degradedNodeLabel, memoizedData]\n );\n\n const brickRef = useRef<HTMLElement | null>(null);\n const xRef = useRef<number | undefined>(x);\n const yRef = useRef<number | undefined>(y);\n\n const refCallback = useCallback(\n (element: HTMLElement | null) => {\n brickRef.current = element;\n const prevObserver = observerRef.current;\n if (prevObserver) {\n prevObserver.disconnect();\n observerRef.current = null;\n }\n if (element) {\n if (xRef.current != null && yRef.current != null) {\n element.style.left = `${xRef.current}px`;\n element.style.top = `${yRef.current}px`;\n }\n // Todo: correctly wait for `useBrick` in v3 to be rendered (after layout)\n // Wait a macro task to let `useBrick` to be rendered.\n setTimeout(() => {\n const observer = new ResizeObserver(() => {\n onResize(node.id, [element.offsetWidth, element.offsetHeight]);\n });\n observer.observe(element);\n observerRef.current = observer;\n });\n } else {\n onResize(node.id, null);\n }\n },\n [node.id, onResize]\n );\n\n // Use position instead of transform, for clients\n // that hardware acceleration (GPU) is not available.\n useEffect(() => {\n xRef.current = x;\n yRef.current = y;\n const element = brickRef.current;\n if (element && x != null && y != null) {\n element.style.top = `${y}px`;\n element.style.left = `${x}px`;\n }\n }, [x, y]);\n\n const degradedRefCallBack = useCallback(\n (g: SVGGElement | null) => {\n if (g) {\n // istanbul ignore next\n const size =\n process.env.NODE_ENV === \"test\"\n ? { width: 60, height: 60 }\n : g.getBBox();\n onResize(node.id, [size.width, size.height]);\n } else {\n onResize(node.id, null);\n }\n },\n [node.id, onResize]\n );\n\n const foreignObjectRef = useRef<SVGForeignObjectElement | null>(null);\n\n // Workaround for Firefox bug:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1644680\n // istanbul ignore next\n useEffect(() => {\n const fo = foreignObjectRef.current;\n if (!fo || !/firefox/i.test(navigator.userAgent)) {\n return;\n }\n fo.style.overflow = \"hidden\";\n // 延时 500ms 是经验值,实际测试如果机器性能较差,可能需要更长的时间。\n // MacBook Air M1 >= 100ms 可以工作,<= 50ms 则不行。\n const timeoutId = setTimeout(() => {\n fo.style.overflow = \"visible\";\n }, 500);\n return () => clearTimeout(timeoutId);\n }, []);\n\n return (\n <>\n {useBrick || Component ? (\n <foreignObject\n // Make a large size to avoid the brick inside to be clipped by the foreignObject.\n width={9999}\n height={9999}\n className=\"node\"\n ref={foreignObjectRef}\n >\n {Component ? (\n <Component {...memoizedData} refCallback={refCallback} />\n ) : (\n <ReactUseBrick\n useBrick={useBrick!}\n data={memoizedData}\n refCallback={refCallback}\n />\n )}\n </foreignObject>\n ) : degraded ? (\n <g className=\"degraded\" ref={degradedRefCallBack}>\n <circle cx={8} cy={8} r={8} />\n <text x={8} y={32}>\n {label}\n </text>\n </g>\n ) : null}\n {locked &&\n ![containerLocked, groupLocked].some(Boolean) &&\n x != null &&\n y != null && (\n <LockIcon x={x + node.view.width + 4} y={y + node.view.height - 12} />\n )}\n </>\n );\n}\n\nfunction useDeepMemo<T>(value: T): T {\n const [memoizedValue, setMemoizedValue] = useState(value);\n\n useEffect(() => {\n setMemoizedValue((prev) => (isEqual(prev, value) ? prev : value));\n }, [value]);\n\n return memoizedValue;\n}\n","import type { PositionTuple } from \"../../diagram/interfaces\";\nimport type { NodeView, SnapToObjectPosition } from \"../interfaces\";\n\nconst DEFAULT_ALL_POSITIONS = [\"center\", \"top\", \"bottom\", \"left\", \"right\"];\n\nexport type SnapPositions = Partial<\n Record<SnapToObjectPosition, PositionTuple>\n>;\n\nexport function getSnapPositions(\n view: NodeView,\n positions: string | undefined\n) {\n const snapPositions: SnapPositions = {};\n for (const position of positions\n ?.split(/\\s+/g)\n ?.flatMap((pos) => (pos === \"all\" ? DEFAULT_ALL_POSITIONS : pos)) ?? []) {\n let tuple: PositionTuple;\n const cx = view.x + view.width / 2;\n const cy = view.y + view.height / 2;\n switch (position) {\n case \"center\":\n tuple = [cx, cy];\n break;\n case \"top\":\n tuple = [cx, view.y];\n break;\n case \"right\":\n tuple = [view.x + view.width, cy];\n break;\n case \"bottom\":\n tuple = [cx, view.y + view.height];\n break;\n case \"left\":\n tuple = [view.x, cy];\n break;\n default:\n throw new Error(`Unknown snap position: \"${position}\"`);\n }\n snapPositions[position] = tuple;\n }\n return snapPositions;\n}\n","import { map } from \"lodash\";\nimport type { PositionTuple } from \"../../diagram/interfaces\";\nimport type {\n ActiveTarget,\n Cell,\n LayoutOptions,\n DecoratorCell,\n LayoutType,\n NodeCell,\n SnapToObjectPosition,\n ActiveTargetOfSingular,\n EditableLineCell,\n} from \"../interfaces\";\nimport type {\n MoveCellPayload,\n ResizeCellPayload,\n} from \"../reducers/interfaces\";\nimport {\n isContainerDecoratorCell,\n isDecoratorCell,\n isEdgeCell,\n isGroupDecoratorCell,\n isLineDecoratorCell,\n isNodeCell,\n} from \"./asserts\";\nimport { cellToTarget } from \"./cellToTarget\";\nimport { getSnapPositions, type SnapPositions } from \"./getSnapPositions\";\nimport { getLockedContainerIds, isLocked } from \"./isLocked\";\nimport { normalizeSnapOptions } from \"./normalizeSnapOptions\";\nimport { sameTarget } from \"./sameTarget\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nconst HORIZONTAL_POSITIONS = [\"left\", \"center\", \"right\"];\nconst VERTICAL_POSITIONS = [\"top\", \"center\", \"bottom\"];\n\nexport function handleMouseDown(\n event: MouseEvent,\n {\n action,\n cell,\n scale,\n layout,\n layoutOptions,\n activeTarget,\n cells,\n onCellsMoving,\n onCellsMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n updateCurActiveEditableLine,\n }: {\n action: \"move\" | \"resize\";\n cell: Cell;\n scale: number;\n layout?: LayoutType;\n layoutOptions?: LayoutOptions;\n activeTarget: ActiveTarget | null | undefined;\n cells: Cell[];\n onCellsMoving?(info: MoveCellPayload[]): void;\n onCellsMoved?(info: MoveCellPayload[]): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget?(activeTarget: ActiveTarget | null): void;\n updateCurActiveEditableLine?: (\n activeEditableLine: EditableLineCell | null\n ) => void;\n }\n) {\n event.stopPropagation();\n\n // Ignore contextmenu click\n if (event.button === 2 || (event.button === 0 && event.ctrlKey)) {\n return;\n }\n\n // Drag node\n const preActive = targetIsActive(cell, activeTarget);\n const lockedContainerIds = getLockedContainerIds(cells);\n let canUpdateActiveEditableLine = false;\n if (event.shiftKey) {\n const activeTargets = activeTarget\n ? activeTarget?.type === \"multi\"\n ? activeTarget.targets\n : [activeTarget]\n : [];\n let targets: ActiveTargetOfSingular[] = [];\n if (preActive) {\n targets = activeTargets.filter((target) => !sameTarget(target, cell));\n } else {\n targets = [...activeTargets, cell];\n canUpdateActiveEditableLine = true;\n }\n onSwitchActiveTarget?.(\n targets.length > 0 ? { type: \"multi\", targets } : null\n );\n } else {\n if (action === \"resize\" || !preActive) {\n onSwitchActiveTarget?.(cellToTarget(cell));\n canUpdateActiveEditableLine = true;\n }\n }\n\n if (isLocked(cell, lockedContainerIds)) {\n return;\n }\n\n if (\n canUpdateActiveEditableLine &&\n (isEdgeCell(cell) || isLineDecoratorCell(cell))\n ) {\n updateCurActiveEditableLine?.(cell);\n }\n\n if (isEdgeCell(cell)) {\n return;\n }\n\n const activeCells: Cell[] = [];\n const actives =\n activeTarget?.type === \"multi\" && action === \"move\"\n ? cells.filter((c) => targetIsActive(c, activeTarget))\n : [cell];\n actives.forEach((a) => {\n activeCells.push(a);\n if (action === \"move\") {\n if (isContainerDecoratorCell(a)) {\n const groupIds = map(\n cells.filter(\n (c) => isGroupDecoratorCell(c) && c.containerId === a.id\n ),\n \"id\"\n );\n const nodeCells = cells.filter(\n (c) =>\n ((isNodeCell(c) || isGroupDecoratorCell(c)) &&\n c.containerId === a.id &&\n !actives.includes(c)) ||\n (isNodeCell(c) && groupIds.includes(c?.groupId))\n );\n activeCells.push(...nodeCells);\n }\n if (isGroupDecoratorCell(a)) {\n activeCells.push(\n ...cells.filter(\n (c) => isNodeCell(c) && c.groupId === a.id && !actives.includes(c)\n )\n );\n }\n }\n });\n const isAutoLayout = layout === \"force\" || layout === \"dagre\";\n const movableActiveCells = activeCells.filter(\n (c) =>\n !isLocked(c, lockedContainerIds) &&\n ((isNodeCell(c) && !isAutoLayout) || isDecoratorCell(c))\n ) as (NodeCell | DecoratorCell)[];\n\n if (movableActiveCells.length === 0) {\n return;\n }\n\n const snap = normalizeSnapOptions(layoutOptions?.snap);\n const snapToObjectPositions = snap.object?.positions;\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const originals = movableActiveCells.map<{\n cell: NodeCell | DecoratorCell;\n position: PositionTuple;\n snapPositions: SnapPositions | null;\n }>((c) => ({\n cell: c,\n position:\n action === \"move\" ? [c.view.x, c.view.y] : [c.view.width, c.view.height],\n snapPositions:\n action === \"move\" && !isEdgeCell(c)\n ? getSnapPositions(c.view, snapToObjectPositions)\n : null,\n }));\n const firstOriginalPosition = originals[0].position;\n // let previousPositions = originals.map(({ position }) => position);\n\n // Get the positions of the objects (cells that are not active) to snap to\n let snapToObjectTargets: {\n cell: NodeCell | DecoratorCell;\n snapPositions: SnapPositions;\n }[] = [];\n if (action === \"move\" && snap.object) {\n const objectCells = cells.filter(\n // Edge and line cells are not snap targets\n (c) =>\n !isEdgeCell(c) && !isLineDecoratorCell(c) && !activeCells.includes(c)\n ) as (NodeCell | DecoratorCell)[];\n snapToObjectTargets = objectCells.map((c) => ({\n cell: c,\n snapPositions: getSnapPositions(c.view, snapToObjectPositions),\n }));\n }\n\n function getMovement(e: MouseEvent): PositionTuple {\n return [(e.clientX - from[0]) / scale, (e.clientY - from[1]) / scale];\n }\n let moved = false;\n\n const handleMove = (e: MouseEvent, finished?: boolean) => {\n // Respect the scale\n const movement = getMovement(e);\n const snapMovement: PositionTuple = [...movement];\n let newPositions: PositionTuple[];\n let xAlign: [PositionTuple, PositionTuple] | undefined;\n let yAlign: [PositionTuple, PositionTuple] | undefined;\n let xAlignCell: Cell | undefined;\n let yAlignCell: Cell | undefined;\n\n if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n }\n\n // Use alt key (or option key ⌥ on Mac) to disable snap\n if ((!snap.grid && !snap.object) || e.altKey) {\n // No snap\n newPositions = originals.map(({ position }) => [\n position[0] + movement[0],\n position[1] + movement[1],\n ]);\n } else {\n // Snap\n let diffX = Infinity;\n let diffY = Infinity;\n\n if (snap.object) {\n const snapToObjectDistance = snap.object.distance;\n let xAlignFrom: PositionTuple | undefined;\n let yAlignFrom: PositionTuple | undefined;\n let xAlignTarget: NodeCell | DecoratorCell | undefined;\n let yAlignTarget: NodeCell | DecoratorCell | undefined;\n let xAlignToY = 0;\n let yAlignToX = 0;\n for (const {\n cell: target,\n snapPositions: targetPositions,\n // center: [x, y],\n } of snapToObjectTargets) {\n for (const {\n cell: c,\n snapPositions: originalPositions,\n } of originals) {\n for (const [position, originalPoint] of Object.entries(\n originalPositions!\n )) {\n const horizontal = HORIZONTAL_POSITIONS.includes(position);\n const vertical = VERTICAL_POSITIONS.includes(position);\n const [x, y] = targetPositions[position as SnapToObjectPosition]!;\n const [cx, cy] = originalPoint!;\n if (horizontal) {\n const dX = Math.abs(cx + movement[0] - x);\n const xSnapped = dX < snapToObjectDistance && dX < diffX;\n if (xSnapped) {\n diffX = dX;\n snapMovement[0] = x - cx;\n xAlignCell = c;\n xAlignTarget = target;\n xAlignFrom = [x, y];\n xAlignToY = cy;\n }\n }\n if (vertical) {\n const dY = Math.abs(cy + movement[1] - y);\n const ySnapped = dY < snapToObjectDistance && dY < diffY;\n if (ySnapped) {\n diffY = dY;\n snapMovement[1] = y - cy;\n yAlignCell = c;\n yAlignTarget = target;\n yAlignFrom = [x, y];\n yAlignToX = cx;\n }\n }\n }\n }\n }\n\n if (xAlignTarget && xAlignTarget === yAlignTarget) {\n // Handle special case when both x and y are snapped to the same target.\n const halfHeight = xAlignTarget.view.height / 2;\n const halfWidth = xAlignTarget.view.width / 2;\n xAlign = [\n [xAlignFrom![0], xAlignFrom![1] - halfHeight],\n [xAlignFrom![0], xAlignFrom![1] + halfHeight],\n ];\n yAlign = [\n [yAlignFrom![0] - halfWidth, yAlignFrom![1]],\n [yAlignFrom![0] + halfWidth, yAlignFrom![1]],\n ];\n } else {\n if (xAlignFrom) {\n xAlign = [xAlignFrom, [xAlignFrom[0], xAlignToY + snapMovement[1]]];\n }\n if (yAlignFrom) {\n yAlign = [yAlignFrom, [yAlignToX + snapMovement[0], yAlignFrom[1]]];\n }\n }\n }\n\n if (snap.grid) {\n const snapToGridSize = snap.grid.size;\n // Use the first cell to decide the snap to grid position\n const firstNewPosition: PositionTuple = [\n Math.round(\n (firstOriginalPosition[0] + movement[0]) / snapToGridSize\n ) * snapToGridSize,\n Math.round(\n (firstOriginalPosition[1] + movement[1]) / snapToGridSize\n ) * snapToGridSize,\n ];\n const snapToGridMovement: PositionTuple = [\n firstNewPosition[0] - firstOriginalPosition[0],\n firstNewPosition[1] - firstOriginalPosition[1],\n ];\n const snapToGridDiffX = Math.abs(snapToGridMovement[0] - movement[0]);\n const snapToGridDiffY = Math.abs(snapToGridMovement[1] - movement[1]);\n if (snapToGridDiffX < diffX) {\n diffX = snapToGridDiffX;\n snapMovement[0] = snapToGridMovement[0];\n xAlign = undefined;\n xAlignCell = undefined;\n }\n if (snapToGridDiffY < diffY) {\n diffY = snapToGridDiffY;\n snapMovement[1] = snapToGridMovement[1];\n yAlign = undefined;\n yAlignCell = undefined;\n }\n }\n\n newPositions = originals.map(({ position }) => [\n position[0] + snapMovement[0],\n position[1] + snapMovement[1],\n ]);\n }\n\n if (moved) {\n if (action === \"move\") {\n const payloads = originals.map(({ cell: c }, index) => ({\n type: c.type,\n id: c.id,\n x: newPositions[index][0],\n y: newPositions[index][1],\n groupId: c.groupId,\n containerId: c.containerId,\n width: c.view.width,\n height: c.view.height,\n decorator: isDecoratorCell(c) ? c.decorator : undefined,\n guideLines: finished\n ? undefined\n : [\n ...(xAlignCell === c ? [xAlign!] : []),\n ...(yAlignCell === c ? [yAlign!] : []),\n ],\n ...(isLineDecoratorCell(c)\n ? {\n source: {\n x: c.view.source.x + snapMovement[0],\n y: c.view.source.y + snapMovement[1],\n },\n target: {\n x: c.view.target.x + snapMovement[0],\n y: c.view.target.y + snapMovement[1],\n },\n vertices: c.view.vertices?.map((v) => ({\n x: v.x + snapMovement[0],\n y: v.y + snapMovement[1],\n })),\n }\n : null),\n }));\n (finished ? onCellsMoved : onCellsMoving)?.(payloads);\n } else {\n (finished ? onCellResized : onCellResizing)?.({\n type: cell.type,\n id: cell.id,\n width: newPositions[0][0],\n height: newPositions[0][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 {\n DEFAULT_SNAP_GRID_SIZE,\n DEFAULT_SNAP_OBJECT_DISTANCE,\n DEFAULT_SNAP_OBJECT_POSITIONS,\n} from \"../constants\";\nimport type {\n SnapOptions,\n SnapToGridOptions,\n SnapToObjectOptions,\n} from \"../interfaces\";\n\nexport interface NormalizedSnapOptions {\n grid: Required<SnapToGridOptions> | null;\n object: Required<SnapToObjectOptions> | null;\n}\n\nexport function normalizeSnapOptions(\n snap: boolean | SnapOptions | undefined\n): NormalizedSnapOptions {\n const intermediateSnap = snap\n ? snap === true\n ? { grid: true, object: true }\n : snap\n : null;\n const snapToGrid = intermediateSnap?.grid\n ? intermediateSnap.grid === true\n ? {}\n : intermediateSnap.grid\n : null;\n const snapToObject = intermediateSnap?.object\n ? intermediateSnap.object === true\n ? {}\n : intermediateSnap.object\n : null;\n return {\n grid: snapToGrid\n ? { size: snapToGrid.size ?? DEFAULT_SNAP_GRID_SIZE }\n : null,\n object: snapToObject\n ? {\n distance: snapToObject.distance ?? DEFAULT_SNAP_OBJECT_DISTANCE,\n positions: snapToObject.positions ?? DEFAULT_SNAP_OBJECT_POSITIONS,\n }\n : null,\n };\n}\n","// istanbul ignore file: compatibility workaround\nimport type { HTMLAttributes } from \"react\";\n\nlet _supports: boolean | undefined;\n\nfunction supportsContentEditablePlaintextOnly(): boolean {\n if (typeof _supports !== \"boolean\") {\n const div = document.createElement(\"div\");\n div.setAttribute(\"contenteditable\", \"PLAINTEXT-ONLY\");\n _supports = div.contentEditable === \"plaintext-only\";\n }\n return _supports;\n}\n\nexport function getContentEditable(\n editable: boolean\n): HTMLAttributes<HTMLDivElement>[\"contentEditable\"] {\n return editable\n ? supportsContentEditablePlaintextOnly()\n ? \"plaintext-only\"\n : \"true\"\n : \"false\";\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport classNames from \"classnames\";\nimport { LockIcon } from \"../LockIcon\";\nimport { getContentEditable } from \"../processors/getContentEditable\";\n\nexport type DecoratorTextProps = Pick<\n BasicDecoratorProps,\n | \"cell\"\n | \"readOnly\"\n | \"locked\"\n | \"onDecoratorTextEditing\"\n | \"onDecoratorTextChange\"\n>;\n\nexport function DecoratorText({\n cell,\n readOnly,\n locked,\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(\n (e: React.MouseEvent) => {\n if (readOnly || locked) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n },\n [readOnly, locked]\n );\n\n useEffect(() => {\n const element = ref.current;\n if (element && element.textContent !== currentLabel) {\n element.textContent = currentLabel;\n }\n }, [currentLabel]);\n useEffect(() => {\n const parentElement = ref.current?.parentElement;\n if (parentElement) {\n cell.view.width = parentElement.clientWidth;\n cell.view.height = parentElement.clientHeight;\n }\n }, [currentLabel, cell.id]);\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(\n (event: React.FormEvent<HTMLDivElement>) => {\n if (readOnly) {\n return;\n }\n setCurrentLabel((event.target as HTMLDivElement).textContent!);\n },\n [readOnly]\n );\n\n const handleBlur = useCallback(() => {\n if (readOnly) {\n return;\n }\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n }, [readOnly]);\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 <>\n <foreignObject className=\"decorator-text\" width=\"9999\" height=\"9999\">\n <div\n className={classNames(\"text-container\", { editing: editingLabel })}\n onDoubleClick={handleEnableEdit}\n style={cell.view.style}\n >\n <div\n className=\"text\"\n contentEditable={getContentEditable(editingLabel)}\n ref={ref}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n {locked && (\n <LockIcon x={cell.view.width} y={(cell.view.height - 12) / 2} />\n )}\n </>\n );\n}\n\nexport function 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, DecoratorType } from \"../interfaces\";\nimport { DecoratorArea } from \"./DecoratorArea\";\nimport { DecoratorText } from \"./DecoratorText\";\nimport { DecoratorContainer } from \"./DecoratorContainer\";\nimport { DecoratorRect } from \"./DecoratorRect\";\nimport { DecoratorLine } from \"./DecoratorLine\";\nimport { DecoratorGroup } from \"./DecoratorGroup\";\n\nconst decoratorComponents = new Map<\n DecoratorType,\n React.ComponentType<BasicDecoratorProps>\n>([\n [\"group\", DecoratorGroup],\n [\"container\", DecoratorContainer],\n [\"area\", DecoratorArea],\n [\"text\", DecoratorText],\n [\"rect\", DecoratorRect],\n [\"line\", DecoratorLine],\n]);\n\nexport function DecoratorComponent({\n cell,\n view,\n transform,\n readOnly,\n layout,\n layoutOptions,\n active,\n activeTarget,\n cells,\n lineConfMap,\n editableLineMap,\n locked,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n onDecoratorGroupPlusClick,\n}: BasicDecoratorProps): JSX.Element | null {\n const SpecifiedComponent = decoratorComponents.get(cell.decorator);\n\n if (!SpecifiedComponent) {\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 view={view}\n transform={transform}\n readOnly={readOnly}\n layout={layout}\n layoutOptions={layoutOptions}\n active={active}\n activeTarget={activeTarget}\n cells={cells}\n lineConfMap={lineConfMap}\n editableLineMap={editableLineMap}\n locked={locked}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n onDecoratorGroupPlusClick={onDecoratorGroupPlusClick}\n />\n );\n}\n","import React, { useMemo } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { LockIcon } from \"../LockIcon\";\nimport classNames from \"classnames\";\nimport { PlusOutlined } from \"@ant-design/icons\";\nimport { highlightGroupCell } from \"../processors/initialGroupLayout\";\n\nexport type DecoratorRectProps = Omit<\n BasicDecoratorProps,\n \"lineConfMap\" | \"editableLineMap\"\n>;\n\nexport function DecoratorGroup({\n cell,\n view,\n activeTarget,\n cells,\n locked,\n onDecoratorGroupPlusClick,\n}: DecoratorRectProps): JSX.Element {\n const active = useMemo(\n () => highlightGroupCell(cell, activeTarget, cells),\n [activeTarget, cell, cells]\n );\n\n return (\n <g\n className={classNames(\"decorator-group\", {\n [\"active-group\"]: active,\n })}\n >\n <foreignObject\n className=\"group-wrapper\"\n width={cell.view.width + 10}\n height={cell.view.height + 10}\n >\n <div\n className=\"group\"\n style={{\n ...cell.view?.style,\n width: cell.view.width,\n height: cell.view.height,\n }}\n >\n {view.usePlus && (\n <PlusOutlined\n className=\"plus-icon\"\n onClick={() => onDecoratorGroupPlusClick?.(cell)}\n />\n )}\n </div>\n </foreignObject>\n {locked && (\n <LockIcon x={cell.view.width! - 16} y={cell.view.height! - 16} />\n )}\n </g>\n );\n}\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport type { BasicDecoratorProps, NodeCell } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\nimport classNames from \"classnames\";\nimport { get } from \"lodash\";\nimport { selectAllText } from \"./DecoratorText\";\nimport { isNoManualLayout } from \"../processors/asserts\";\nimport { uuidV4 } from \"..\";\nimport { LockIcon } from \"../LockIcon\";\nimport { getContentEditable } from \"../processors/getContentEditable\";\n\nexport function DecoratorContainer({\n cell,\n transform,\n readOnly,\n layout,\n view,\n activeTarget,\n cells,\n locked,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: BasicDecoratorProps): JSX.Element {\n const label = get(cell.view, \"text\", \"\");\n const direction = get(cell.view, \"direction\", \"top\");\n const textRef = useRef<HTMLDivElement>(null);\n const resizeHandleRef = React.useRef<SVGGElement>(null);\n const [editingLabel, setEditingLabel] = useState(false);\n const [currentLabel, setCurrentLabel] = useState<string>(label);\n const [shouldEmitLabelChange, setShouldEmitLabelChange] = useState(false);\n const [recomputation, setRecomputation] = useState<string>();\n const [titleForeignRect, setTitleForeignRect] = useState({\n x: 0,\n y: 0,\n width: cell.view.width,\n height: cell.view.height,\n });\n // istanbul ignore next\n const shouldHighlight = useMemo(() => {\n let activeTargetCells = [],\n active = false;\n if (activeTarget?.type === \"multi\") {\n activeTargetCells = activeTarget.targets;\n } else if (activeTarget?.type === \"node\") {\n activeTargetCells.push(activeTarget);\n }\n const containerLeft = cell.view.x;\n const containerRight = cell.view.x + cell.view.width;\n const containerTop = cell.view.y;\n const containerBottom = cell.view.y + cell.view.height;\n active = activeTargetCells.some((item) => {\n if (item?.type === \"node\" || item.type === \"decorator\") {\n const targetCell = cells.find(\n (c) =>\n (c?.type === \"node\" || c.type === \"decorator\") && c.id === item.id\n ) as NodeCell;\n if (targetCell) {\n const left = targetCell.view.x;\n const right = targetCell.view.x + targetCell.view.width;\n const top = targetCell.view.y;\n const bottom = targetCell.view.y + targetCell.view.height;\n return (\n left >= containerLeft &&\n right <= containerRight &&\n top >= containerTop &&\n bottom <= containerBottom\n );\n }\n }\n });\n return active;\n }, [activeTarget, cell, cells]);\n const handleEnableEdit = useCallback(\n (e: React.MouseEvent) => {\n if (readOnly || locked) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n },\n [readOnly, locked]\n );\n const handleInput = useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n if (readOnly) {\n return;\n }\n setCurrentLabel((event.target as HTMLDivElement).textContent!);\n },\n [readOnly]\n );\n\n const handleBlur = useCallback(() => {\n if (readOnly) {\n return;\n }\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n setRecomputation(uuidV4());\n }, [readOnly]);\n\n useEffect(() => {\n setCurrentLabel(label);\n }, [label]);\n\n useEffect(() => {\n const element = textRef.current;\n if (element && element.textContent !== currentLabel) {\n element.textContent = currentLabel;\n }\n }, [currentLabel]);\n\n useEffect(() => {\n const element = textRef.current?.parentElement;\n if (!element) return;\n\n const resizeObserver = new ResizeObserver(() => {\n const { clientWidth, clientHeight } = element;\n if ([\"left\", \"right\"].includes(direction)) {\n setTitleForeignRect({\n width: clientWidth,\n height: view.height,\n x: direction === \"left\" ? -clientWidth : view.width,\n y: 0,\n });\n } else {\n setTitleForeignRect({\n width: view.width,\n height: clientHeight,\n x: 0,\n y: direction === \"top\" ? -clientHeight : view.height,\n });\n }\n });\n\n resizeObserver.observe(element);\n return () => resizeObserver.disconnect();\n }, [view, currentLabel, direction, recomputation]);\n\n useEffect(() => {\n if (editingLabel && textRef.current) {\n textRef.current.focus();\n selectAllText(textRef.current);\n }\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n useEffect(() => {\n if (shouldEmitLabelChange) {\n onDecoratorTextChange?.({\n id: cell.id,\n view: { ...view, text: currentLabel },\n });\n setShouldEmitLabelChange(false);\n }\n }, [cell, view, currentLabel, onDecoratorTextChange, shouldEmitLabelChange]);\n\n useEffect(() => {\n const resizeHandle = resizeHandleRef.current;\n if (!resizeHandle || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"resize\",\n cell,\n scale: transform.k,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n activeTarget,\n cell,\n cells,\n onCellResized,\n onCellResizing,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n return (\n <g className=\"decorator-container\">\n <foreignObject {...titleForeignRect}>\n <div\n className={classNames(\"text-container\", {\n editing: editingLabel,\n [[\"left\", \"right\"].includes(direction) ? \"vertical\" : \"horizontal\"]:\n true,\n })}\n onDoubleClick={handleEnableEdit}\n style={cell.view.titleStyle}\n >\n <div\n className=\"text\"\n contentEditable={getContentEditable(editingLabel)}\n ref={textRef}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n <foreignObject\n x={0}\n y={0}\n width={view.width}\n height={view.height}\n className=\"container-wrapper\"\n >\n <div\n className={classNames(\"container\", {\n [\"active-container\"]: shouldHighlight,\n })}\n style={{\n ...cell.view.style,\n width: view.width,\n height: view.height,\n }}\n />\n </foreignObject>\n {!readOnly && !locked && !isNoManualLayout(layout) && (\n <g\n ref={resizeHandleRef}\n className=\"resize-handle\"\n transform={`translate(${view.width - 20} ${view.height - 20})`}\n >\n <rect width={20} height={20} />\n <path d=\"M10 18L18 10 M15 18L18 15\" />\n </g>\n )}\n {locked && (\n <LockIcon x={cell.view.width - 16} y={cell.view.height - 16} />\n )}\n </g>\n );\n}\n","import React, { useEffect } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\nimport { LockIcon } from \"../LockIcon\";\n\nexport function DecoratorArea({\n cell,\n transform,\n readOnly,\n layoutOptions,\n activeTarget,\n cells,\n locked,\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 if (!resizeHandle || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"resize\",\n cell,\n scale: transform.k,\n layoutOptions,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n activeTarget,\n cell,\n cells,\n layoutOptions,\n onCellResized,\n onCellResizing,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n return (\n <g className=\"decorator-area-container\">\n <foreignObject className=\"decorator-area\" width=\"9999\" height=\"9999\">\n <div\n className=\"area\"\n style={{\n ...cell.view.style,\n width: cell.view.width,\n height: cell.view.height,\n }}\n />\n </foreignObject>\n {!readOnly && !locked && (\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 )}\n {locked && (\n <LockIcon x={cell.view.width - 16} y={cell.view.height - 16} />\n )}\n </g>\n );\n}\n","import React, { useEffect } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\nimport { isNoManualLayout } from \"../processors/asserts\";\nimport { LockIcon } from \"../LockIcon\";\n\nexport type DecoratorRectProps = Omit<\n BasicDecoratorProps,\n \"lineConfMap\" | \"editableLineMap\"\n>;\n\nexport function DecoratorRect({\n cell,\n transform,\n readOnly,\n layout,\n view,\n activeTarget,\n cells,\n locked,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n}: DecoratorRectProps): JSX.Element {\n const resizeHandleRef = React.useRef<SVGGElement>(null);\n\n useEffect(() => {\n const resizeHandle = resizeHandleRef.current;\n if (!resizeHandle || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"resize\",\n cell,\n scale: transform.k,\n layout,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n activeTarget,\n cell,\n cells,\n onCellResized,\n onCellResizing,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n layout,\n ]);\n\n return (\n <g className=\"decorator-rect-container\">\n <foreignObject className=\"decorator-rect\" width=\"9999\" height=\"9999\">\n <div\n className=\"rect-container\"\n style={{\n ...cell.view.style,\n width: view.width,\n height: view.height,\n }}\n />\n </foreignObject>\n {!readOnly && !locked && !isNoManualLayout(layout) && (\n <g\n ref={resizeHandleRef}\n className=\"resize-handle\"\n transform={`translate(${view.width - 20} ${view.height - 20})`}\n >\n <rect width={20} height={20} />\n <path d=\"M10 18L18 10 M15 18L18 15\" />\n </g>\n )}\n {locked && (\n <LockIcon x={cell.view.width - 16} y={cell.view.height - 16} />\n )}\n </g>\n );\n}\n","import React, { useCallback, useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { getMarkers } from \"../../shared/canvas/useLineMarkers\";\nimport type { LineMarkerConf } from \"../../diagram/interfaces\";\nimport { curveLine } from \"../../diagram/lines/curveLine\";\nimport { LockIcon } from \"../LockIcon\";\nimport { getLineLockIconPosition } from \"../processors/getLineLockIconPosition\";\n\nexport type DecoratorLineProps = Pick<\n BasicDecoratorProps,\n \"cell\" | \"active\" | \"locked\" | \"lineConfMap\" | \"editableLineMap\"\n>;\n\nexport function DecoratorLine({\n cell,\n active,\n lineConfMap,\n editableLineMap,\n locked,\n}: DecoratorLineProps): JSX.Element | null {\n const lineConf = lineConfMap.get(cell);\n const { points: linePoints, jumpsMap } = editableLineMap.get(cell) ?? {};\n\n const line = useMemo(() => {\n // istanbul ignore next: defensive check\n if (!lineConf) {\n return null;\n }\n return curveLine(\n linePoints,\n lineConf.type === \"curve\" ? lineConf.curveType : \"curveLinear\",\n 0,\n 1,\n jumpsMap\n );\n }, [lineConf, linePoints, jumpsMap]);\n\n const pathRef = useRef<SVGPathElement | null>(null);\n const pathRefCallback = useCallback(\n (element: SVGPathElement | null) => {\n pathRef.current = element;\n // istanbul ignore next: Jest does not support `SVGPathElement::getBBox`\n if (element && process.env.NODE_ENV !== \"test\") {\n const rect = element.getBBox();\n cell.view = {\n ...cell.view,\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height,\n };\n }\n },\n [cell]\n );\n\n const lockedPosition = useMemo(\n () => (locked && linePoints ? getLineLockIconPosition(linePoints) : null),\n [locked, linePoints]\n );\n\n if (!line || !lineConf) {\n return null;\n }\n\n let markerStart: string | undefined;\n let markerEnd: string | undefined;\n let strokeColor: string | undefined;\n let strokeWidth: number | undefined;\n const lineMarkers: LineMarkerConf[] = getMarkers(lineConf);\n if (active) {\n const overrides = lineConf.overrides?.active;\n strokeColor = overrides?.strokeColor ?? lineConf.strokeColor;\n strokeWidth = overrides?.strokeWidth ?? lineConf.strokeWidth;\n // motion = overrides?.motion;\n for (const marker of lineMarkers) {\n if (marker.placement === \"start\") {\n markerStart =\n lineConf.$activeMarkerStartUrl ?? lineConf.$markerStartUrl;\n } else {\n markerEnd = lineConf.$activeMarkerEndUrl ?? lineConf.$markerEndUrl;\n }\n }\n } else {\n strokeColor = lineConf.strokeColor;\n strokeWidth = lineConf.strokeWidth;\n for (const marker of lineMarkers) {\n if (marker.placement === \"start\") {\n markerStart = lineConf.$markerStartUrl;\n } else {\n markerEnd = lineConf.$markerEndUrl;\n }\n }\n }\n\n return (\n <g className=\"decorator-line\">\n <path\n // This `path` is made for expanding interaction area of graph lines.\n d={line}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={lineConf.interactStrokeWidth}\n />\n <path\n className={classNames(\"line\", {\n dashed: lineConf.dashed,\n dotted: lineConf.dotted,\n })}\n ref={pathRefCallback}\n d={line}\n fill=\"none\"\n stroke={strokeColor}\n strokeWidth={strokeWidth}\n markerStart={markerStart}\n markerEnd={markerEnd}\n />\n {locked && <LockIcon x={lockedPosition!.x} y={lockedPosition!.y} />}\n </g>\n );\n}\n","import type { NodePosition } from \"../../diagram/interfaces\";\n\nexport function getLineLockIconPosition(\n linePoints: NodePosition[]\n): NodePosition {\n const lastPoint = linePoints[linePoints.length - 1];\n if (linePoints.length < 2) {\n return {\n x: lastPoint.x + 16,\n y: lastPoint.y - 6,\n };\n }\n\n const firstPoint = linePoints[0];\n const dy = lastPoint.y - firstPoint.y;\n const dx = lastPoint.x - firstPoint.x;\n\n let useEndPoint: boolean;\n if (Math.abs(dy) > Math.abs(dx)) {\n useEndPoint = dy > 0;\n } else {\n useEndPoint = dx > 0;\n }\n\n const point1 = useEndPoint\n ? linePoints[linePoints.length - 2]\n : linePoints[1];\n const point2 = useEndPoint ? lastPoint : firstPoint;\n\n const angle = Math.atan2(point2.y - point1.y, point2.x - point1.x);\n const twistedAngle = angle - (Math.PI * 3) / 4;\n const distance = 16;\n return {\n x: point2.x + Math.cos(twistedAngle) * distance - 6,\n y: point2.y + Math.sin(twistedAngle) * distance - 6,\n };\n}\n","import React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n ActiveTarget,\n Cell,\n CellContextMenuDetail,\n ComputedEdgeLineConf,\n DecoratorTextChangeDetail,\n DecoratorView,\n LayoutOptions,\n LayoutType,\n NodeBrickConf,\n NodeCell,\n EditableLine,\n EditableLineCell,\n EditableEdgeLine,\n CellClickDetail,\n DecoratorCell,\n BaseNodeCell,\n} from \"./interfaces\";\nimport {\n isContainerDecoratorCell,\n isDecoratorCell,\n isEdgeCell,\n isEdgeSide,\n isGroupDecoratorCell,\n isLineDecoratorCell,\n isNoManualLayout,\n isNodeCell,\n} 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 { SizeTuple, TransformLiteral } from \"../diagram/interfaces\";\nimport { sameTarget } from \"./processors/sameTarget\";\nimport { targetIsActive } from \"./processors/targetIsActive\";\nimport { computeBoundingBox } from \"./processors/computeBoundingBox\";\nimport { get } from \"lodash\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport {\n GROUPPADDING,\n highlightGroupCell,\n} from \"./processors/initialGroupLayout\";\nexport interface CellComponentProps {\n layout: LayoutType;\n layoutOptions?: LayoutOptions;\n cell: Cell;\n cells: Cell[];\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n transform: TransformLiteral;\n lineConfMap: WeakMap<EditableLineCell, ComputedEdgeLineConf>;\n editableLineMap: WeakMap<EditableLineCell, EditableLine>;\n activeTarget: ActiveTarget | null | undefined;\n readOnly?: boolean;\n hoverCell?: Cell | null | undefined;\n unrelatedCells: Cell[];\n dragoverContainer?: boolean;\n allowEdgeToArea?: boolean;\n curActiveEditableLine?: EditableLineCell | null;\n locked?: boolean;\n containerLocked?: boolean;\n groupLocked?: boolean;\n updateCurActiveEditableLine?: (\n activeEditableLine: EditableLineCell | null\n ) => void;\n onCellsMoving?(info: MoveCellPayload[]): void;\n onCellsMoved?(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 onCellClick?(detail: CellClickDetail): void;\n onDecoratorTextEditing?(detail: { id: string; editing: boolean }): void;\n onDecoratorTextChange?(detail: DecoratorTextChangeDetail): void;\n onDecoratorGroupPlusClick?(detail: DecoratorCell): void;\n onNodeBrickResize(id: string, size: SizeTuple | null): void;\n onCellMouseEnter?(cell: Cell): void;\n onCellMouseLeave?(cell: Cell): void;\n}\n\nexport function CellComponent({\n layout,\n layoutOptions,\n cell,\n cells,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n lineConfMap,\n editableLineMap,\n activeTarget,\n dragoverContainer,\n readOnly,\n transform,\n hoverCell,\n unrelatedCells,\n allowEdgeToArea,\n curActiveEditableLine,\n locked,\n containerLocked,\n groupLocked,\n updateCurActiveEditableLine,\n onCellsMoving,\n onCellsMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onCellContextMenu,\n onCellClick,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n onDecoratorGroupPlusClick,\n onNodeBrickResize,\n onCellMouseEnter,\n onCellMouseLeave,\n}: CellComponentProps): JSX.Element | null {\n const {\n lineEditorState,\n smartConnectLineState,\n setSmartConnectLineState,\n onConnect,\n setLineEditorState,\n onChangeEdgeView,\n } = useHoverStateContext();\n const gRef = useRef<SVGGElement>(null);\n const unrelated = useMemo(\n () => unrelatedCells.some((item) => sameTarget(item, cell)),\n [cell, unrelatedCells]\n );\n\n const containerRect = useMemo((): DecoratorView | undefined => {\n if (isContainerDecoratorCell(cell) && isNoManualLayout(layout)) {\n const containCells = cells.filter(\n (c): c is NodeCell => isNodeCell(c) && c.containerId === cell.id\n );\n const view = {\n ...cell.view,\n ...computeBoundingBox(containCells),\n };\n cell.view = view; //Update the rect container to make sure Lasso gets the correct size\n return view;\n }\n if (\n isGroupDecoratorCell(cell) &&\n highlightGroupCell(cell, activeTarget, cells)\n ) {\n const nodeViews = cells.filter(\n (c) => c.type === \"node\" && c.groupId === cell.id\n );\n const view = {\n ...cell.view,\n ...computeBoundingBox(nodeViews as BaseNodeCell[], {\n padding: GROUPPADDING,\n }),\n };\n cell.view = view;\n return view;\n }\n return isEdgeCell(cell) || isLineDecoratorCell(cell)\n ? undefined\n : get(cell, \"view\", { x: 0, y: 0, width: 0, height: 0 });\n }, [layout, cell, cells, activeTarget]);\n\n useEffect(() => {\n const g = gRef.current;\n if (!g) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n if (\n readOnly ||\n ([isContainerDecoratorCell(cell), isGroupDecoratorCell(cell)].some(\n Boolean\n ) &&\n isNoManualLayout(layout))\n ) {\n event.stopPropagation();\n } else {\n handleMouseDown(event, {\n layout,\n layoutOptions,\n action: \"move\",\n cell,\n scale: transform.k,\n activeTarget,\n cells,\n onCellsMoving,\n onCellsMoved,\n onSwitchActiveTarget,\n updateCurActiveEditableLine,\n });\n }\n };\n g.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n g.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n layout,\n layoutOptions,\n cell,\n activeTarget,\n cells,\n onCellsMoved,\n onCellsMoving,\n onSwitchActiveTarget,\n updateCurActiveEditableLine,\n readOnly,\n transform.k,\n ]);\n\n // istanbul ignore next: experimental\n useEffect(() => {\n const g = gRef.current;\n if (\n !g ||\n !isEdgeSide(cell, allowEdgeToArea) ||\n !(\n smartConnectLineState ||\n (lineEditorState && lineEditorState.type !== \"control\")\n )\n ) {\n return;\n }\n const onMouseUp = (e: MouseEvent) => {\n if (\n curActiveEditableLine &&\n lineEditorState &&\n curActiveEditableLine.type === \"decorator\"\n ) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n if (smartConnectLineState) {\n if (smartConnectLineState.source !== cell) {\n onConnect?.(\n smartConnectLineState.source,\n cell,\n smartConnectLineState.exitPosition,\n undefined\n );\n }\n setSmartConnectLineState(null);\n } else if (curActiveEditableLine && lineEditorState) {\n const { type } = lineEditorState;\n const { source, target } = editableLineMap.get(\n curActiveEditableLine\n ) as EditableEdgeLine;\n const { view } = curActiveEditableLine;\n\n const isEntry = type === \"entry\";\n if ((isEntry ? target : source) === cell) {\n if (isEntry) {\n onChangeEdgeView?.(source!, target!, {\n ...view,\n entryPosition: null,\n // ...(!view?.exitPosition ? { vertices: null } : {}),\n });\n } else {\n onChangeEdgeView?.(source!, target!, {\n ...view,\n exitPosition: null,\n // ...(!view?.entryPosition ? { vertices: null } : {}),\n });\n }\n }\n setLineEditorState(null);\n }\n };\n g.addEventListener(\"mouseup\", onMouseUp);\n return () => {\n g.removeEventListener(\"mouseup\", onMouseUp);\n };\n }, [\n curActiveEditableLine,\n editableLineMap,\n allowEdgeToArea,\n cell,\n lineEditorState,\n onChangeEdgeView,\n onConnect,\n setLineEditorState,\n setSmartConnectLineState,\n smartConnectLineState,\n updateCurActiveEditableLine,\n ]);\n\n const handleContextMenu = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (readOnly && cell.type === \"decorator\") {\n return;\n }\n event.preventDefault();\n event.stopPropagation();\n let target = activeTarget;\n // When right-click a cell,\n // - if it's already active, use previous active target (including multiple targets)\n // - if it's inactive, use the cell as the new only target (excluding previous active target)\n if (!targetIsActive(cell, activeTarget)) {\n target = cellToTarget(cell);\n onSwitchActiveTarget(target);\n }\n onCellContextMenu({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n locked,\n target: target!,\n });\n },\n [\n readOnly,\n cell,\n activeTarget,\n onCellContextMenu,\n locked,\n onSwitchActiveTarget,\n ]\n );\n\n const handleCellClick = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (!onCellClick || cell.type === \"decorator\") {\n return;\n }\n onCellClick({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n locked,\n });\n },\n [cell, onCellClick, locked]\n );\n\n const handleMouseEnter = useCallback(() => {\n onCellMouseEnter?.(cell);\n }, [cell, onCellMouseEnter]);\n\n const handleMouseLeave = useCallback(() => {\n onCellMouseLeave?.(cell);\n }, [cell, onCellMouseLeave]);\n\n const active = targetIsActive(cell, activeTarget);\n return (\n <g\n className={classNames(\"cell\", {\n active,\n faded: unrelated,\n \"read-only\": readOnly,\n \"container-dragover\": dragoverContainer,\n })}\n ref={gRef}\n transform={\n (isNodeCell(cell) && !degraded) ||\n isEdgeCell(cell) ||\n isLineDecoratorCell(cell) ||\n cell.view?.x == null ||\n cell.view?.y == null\n ? undefined\n : `translate(${containerRect!.x},${containerRect!.y})`\n }\n onContextMenu={handleContextMenu}\n onClick={handleCellClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {isNodeCell(cell) ? (\n <NodeComponent\n node={cell}\n x={containerRect?.x}\n y={containerRect?.y}\n degraded={degraded}\n degradedNodeLabel={degradedNodeLabel}\n defaultNodeBricks={defaultNodeBricks}\n locked={locked}\n containerLocked={containerLocked}\n groupLocked={groupLocked}\n onResize={onNodeBrickResize}\n />\n ) : isEdgeCell(cell) ? (\n <EdgeComponent\n edge={cell}\n active={readOnly ? hoverCell === cell : active}\n activeRelated={!!(readOnly ? hoverCell : activeTarget) && !unrelated}\n lineConfMap={lineConfMap}\n editableLineMap={editableLineMap}\n readOnly={readOnly}\n onSwitchActiveTarget={onSwitchActiveTarget}\n />\n ) : isDecoratorCell(cell) ? (\n <DecoratorComponent\n cell={cell}\n view={containerRect!}\n transform={transform}\n readOnly={readOnly}\n layout={layout}\n layoutOptions={layoutOptions}\n active={active}\n activeTarget={activeTarget}\n cells={cells}\n lineConfMap={lineConfMap}\n editableLineMap={editableLineMap}\n locked={locked}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n onDecoratorGroupPlusClick={onDecoratorGroupPlusClick}\n />\n ) : null}\n </g>\n );\n}\n","import React, { useEffect, useMemo, useState } from \"react\";\nimport { select } from \"d3-selection\";\nimport { zoom, type ZoomBehavior } from \"d3-zoom\";\nimport type { RangeTuple, TransformLiteral } from \"../../diagram/interfaces\";\nimport {\n DEFAULT_SCALE_RANGE_MIN,\n DEFAULT_SCALE_RANGE_MAX,\n} from \"../../draw-canvas/constants\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\n\nexport interface UseZoomOptions {\n rootRef: React.RefObject<SVGSVGElement>;\n zoomable?: boolean;\n scrollable?: boolean;\n pannable?: boolean;\n draggable?: boolean;\n ctrlDraggable?: boolean;\n scaleRange?: RangeTuple;\n onSwitchActiveTarget?(target: ActiveTarget | null): void;\n}\n\nexport interface UseZoomResult {\n grabbing: boolean;\n transform: TransformLiteral;\n scaleRange: RangeTuple;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n}\n\n// istanbul ignore next\nconst isMac = /mac/i.test(\n (\n navigator as Navigator & {\n userAgentData?: {\n platform: string;\n };\n }\n ).userAgentData?.platform ??\n navigator.platform ??\n navigator.userAgent\n);\n\n// istanbul ignore next\nfunction wheelData(event: WheelEvent) {\n // On Windows with normal mouse, deltaY is too big when scroll with ctrlKey pressed,\n // which cause the zooming too fast.\n // While on mac OS, we need to keep default behavior of d3-zoom.\n return (\n -event.deltaY *\n (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) *\n (event.ctrlKey && isMac ? 10 : 1)\n );\n}\n\nexport function useZoom({\n rootRef,\n zoomable,\n scrollable,\n pannable,\n draggable,\n ctrlDraggable,\n scaleRange: _scaleRange,\n onSwitchActiveTarget,\n}: UseZoomOptions): UseZoomResult {\n const [grabbing, setGrabbing] = useState(false);\n const [transform, setTransform] = useState<TransformLiteral>({\n k: 1,\n x: 0,\n y: 0,\n });\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(\n () => zoom<SVGSVGElement, unknown>().wheelDelta(wheelData),\n []\n );\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 .filter(\n (event) =>\n // For wheel event, ignore d3 default behavior, because we control it manually.\n // Except for the trackpad pinch event on Mac OS (with ctrlKey).\n (event.type === \"wheel\"\n ? event.ctrlKey\n : ctrlDraggable\n ? draggable || event.ctrlKey\n : !event.ctrlKey) && !event.button\n );\n }, [\n onSwitchActiveTarget,\n scaleRange,\n zoomable,\n zoomer,\n ctrlDraggable,\n draggable,\n ]);\n\n useEffect(() => {\n if (ctrlDraggable) {\n const onContextMenu = (e: MouseEvent) => {\n if (e.ctrlKey) {\n e.preventDefault();\n }\n };\n document.addEventListener(\"contextmenu\", onContextMenu, true);\n return () => {\n document.removeEventListener(\"contextmenu\", onContextMenu, true);\n };\n }\n }, [ctrlDraggable]);\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 && scrollable) {\n e.preventDefault();\n zoomer.translateBy(\n rootSelection,\n e.wheelDeltaX / 5,\n e.wheelDeltaY / 5\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) => {\n if (scrollable || (zoomable && e.ctrlKey)) {\n e.preventDefault();\n }\n })\n .on(\"dblclick.zoom\", null);\n\n if ((!draggable && !ctrlDraggable) || !pannable) {\n rootSelection.on(\"mousedown.zoom\", null);\n }\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 }, [\n ctrlDraggable,\n draggable,\n pannable,\n rootRef,\n scrollable,\n zoomable,\n zoomer,\n ]);\n\n return { grabbing, transform, zoomer, scaleRange };\n}\n","import type {\n ActiveTarget,\n ActiveTargetOfEdge,\n ActiveTargetOfMulti,\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 === \"multi\"\n ? a.targets.length === (b as ActiveTargetOfMulti).targets.length &&\n a.targets.every((targetA) =>\n (b as ActiveTargetOfMulti).targets.some((targetB) =>\n sameTarget(targetA, targetB)\n )\n )\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 { useMemo } from \"react\";\nimport type { Cell, LayoutType } from \"../../draw-canvas/interfaces\";\nimport { isNodeCell } from \"../../draw-canvas/processors/asserts\";\nimport {\n SYMBOL_FOR_LAYOUT_INITIALIZED,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\n\nexport interface UseReadyOptions {\n cells: Cell[];\n layout: LayoutType;\n centered: boolean;\n}\n\nexport function useReady({ cells, layout, centered }: UseReadyOptions) {\n const ready = useMemo(\n () =>\n centered &&\n cells.every(\n (cell) =>\n !isNodeCell(cell) ||\n (cell[SYMBOL_FOR_SIZE_INITIALIZED] &&\n ((layout !== \"force\" && layout !== \"dagre\") ||\n cell[SYMBOL_FOR_LAYOUT_INITIALIZED]))\n ),\n [cells, centered, layout]\n );\n return ready;\n}\n","import type { NodePosition } from \"../../../diagram/interfaces\";\nimport type { NodeConnectPoint } from \"../../../draw-canvas/interfaces\";\n\n// *--*--*--*--*\n// | |\n// * *\n// | |\n// * Rect *\n// | |\n// * *\n// | |\n// *--*--*--*--*\nconst RectangleRelativeConnectPointsWithDirection: ReadonlyArray<NodeConnectPoint> =\n [\n {\n x: 0,\n y: 0,\n d: [\"top\", \"left\"],\n },\n { x: 0.5, y: 0, d: [\"top\"] },\n {\n x: 1,\n y: 0,\n d: [\"top\", \"right\"],\n },\n { x: 0, y: 0.5, d: [\"left\"] },\n { x: 1, y: 0.5, d: [\"right\"] },\n {\n x: 0,\n y: 1,\n d: [\"bottom\", \"left\"],\n },\n { x: 0.5, y: 1, d: [\"bottom\"] },\n {\n x: 1,\n y: 1,\n d: [\"bottom\", \"right\"],\n },\n ];\n\nconst RectangleRelativeConnectPoints: ReadonlyArray<NodePosition> =\n RectangleRelativeConnectPointsWithDirection.map((p) => ({ x: p.x, y: p.y }));\n\nexport function getConnectPointsOfRectangleWithDirection() {\n return RectangleRelativeConnectPointsWithDirection;\n}\n\nexport function getConnectPointsOfRectangle() {\n return RectangleRelativeConnectPoints;\n}\n","import type { Cell, DecoratorCell } from \"../interfaces\";\nimport {\n isContainerDecoratorCell,\n isGroupDecoratorCell,\n isNodeCell,\n} from \"./asserts\";\n\nexport function getLockedContainerIds(cells: Cell[]): string[] {\n const lockeds = cells.filter(\n (cell) =>\n (cell.view?.locked && isContainerDecoratorCell(cell)) ||\n (cell.view?.locked && isGroupDecoratorCell(cell))\n ) as DecoratorCell[];\n return lockeds.map((cell) => cell.id);\n}\n\nexport function isLocked(cell: Cell, lockeds: string[] | undefined): boolean {\n return (\n cell.view?.locked ||\n !!(\n (isNodeCell(cell) || isGroupDecoratorCell(cell)) &&\n cell.containerId &&\n lockeds?.includes(cell.containerId)\n ) ||\n !!(isNodeCell(cell) && cell.groupId && lockeds?.includes(cell.groupId))\n );\n}\n","import { get, pick } from \"lodash\";\nimport dagre from \"@dagrejs/dagre\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport type {\n Cell,\n ForceNode,\n LayoutOptionsDagre,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport {\n isEdgeCell,\n isGroupDecoratorCell,\n isNodeCell,\n isNodeOrAreaDecoratorCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport type { FullRectTuple } from \"../../diagram/interfaces\";\n\nexport interface DagreLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsDagre;\n allowEdgeToArea?: boolean;\n}\n\nexport function dagreLayout({\n cells,\n layoutOptions,\n allowEdgeToArea,\n}: DagreLayoutOptions): {\n getNodeView: (id: NodeId) => NodeView;\n nodePaddings: FullRectTuple;\n} {\n const { nodePadding, ...dagreGraphOptions } = {\n nodePadding: 0,\n rankdir: \"TB\",\n ranksep: 50,\n edgesep: 10,\n nodesep: 50,\n // align: undefined,\n ...pick(layoutOptions, [\n \"nodePadding\",\n \"rankdir\",\n \"ranksep\",\n \"edgesep\",\n \"nodesep\",\n \"align\",\n ]),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n\n if (!cells.some(isNodeCell)) {\n // Dagre cannot render empty nodes\n return {\n getNodeView: () => null!,\n nodePaddings,\n };\n }\n\n const graph = new dagre.graphlib.Graph<ForceNode>();\n graph.setGraph(dagreGraphOptions);\n // Default to assigning a new object as a label for each new edge.\n graph.setDefaultEdgeLabel(function () {\n return {};\n });\n for (const cell of cells) {\n if (\n (allowEdgeToArea && isNodeOrAreaDecoratorCell(cell)) ||\n isNodeCell(cell) ||\n isGroupDecoratorCell(cell)\n ) {\n graph.setNode(cell.id, {\n id: cell.id,\n width: get(cell, \"view.width\", 0) + nodePaddings[1] + nodePaddings[3],\n height: get(cell, \"view.height\", 0) + nodePaddings[0] + nodePaddings[2],\n });\n } else if (isEdgeCell(cell)) {\n graph.setEdge(cell.source, cell.target);\n }\n }\n dagre.layout(graph);\n\n return {\n getNodeView: (id: NodeId) => graph.node(id),\n nodePaddings,\n };\n}\n","import { pick } from \"lodash\";\nimport type { ActiveTargetOfSingular, Cell } from \"../interfaces\";\n\nexport function cellToTarget(cell: Cell): ActiveTargetOfSingular {\n return cell.type === \"edge\"\n ? pick(cell, [\"type\", \"source\", \"target\", \"data\"])\n : pick(cell, [\"type\", \"id\", \"data\"]);\n}\n","import { get } from \"lodash\";\nimport { BaseNodeCell } from \"../interfaces\";\nimport { CONTAINERGAP } from \"../constants\";\n\nexport function computeBoundingBox(\n cells: BaseNodeCell[],\n options?: { padding: number }\n) {\n let minX = Infinity,\n minY = Infinity;\n let maxX = -Infinity,\n maxY = -Infinity;\n cells.forEach((cell) => {\n const { x, y, width, height } = cell.view;\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x + width > maxX) maxX = x + width;\n if (y + height > maxY) maxY = y + height;\n });\n if (![minX, maxX, minY, maxY].some((n) => isFinite(n))) return {};\n const padding = get(options, \"padding\", CONTAINERGAP);\n const width = maxX - minX + padding * 2;\n const height = maxY - minY + padding * 2;\n return {\n x: minX - padding,\n y: minY - padding,\n width: width,\n height: height,\n };\n}\n","// istanbul ignore file: nothing logical to test\nimport React from \"react\";\nimport type {\n DecoratorCell,\n DecoratorLineView,\n DecoratorView,\n EdgeView,\n EditableLineCell,\n LineEditorState,\n NodeCell,\n SmartConnectLineState,\n} from \"./interfaces\";\nimport type { NodePosition } from \"../diagram/interfaces\";\n\nexport interface HoverState {\n // Currently only support node cell\n cell: NodeCell | DecoratorCell;\n relativePoints: ReadonlyArray<NodePosition>;\n points: ReadonlyArray<NodePosition>;\n activePointIndex?: number;\n}\n\nexport const HoverStateContext = React.createContext<{\n rootRef: React.RefObject<SVGSVGElement>;\n smartConnectLineState: SmartConnectLineState | null;\n unsetHoverStateTimeoutRef: React.MutableRefObject<number | null>;\n hoverState: HoverState | null;\n activeEditableLines: EditableLineCell[];\n lineEditorState: LineEditorState | null;\n movingCells?: boolean;\n setLineEditorState: React.Dispatch<\n React.SetStateAction<LineEditorState | null>\n >;\n setHoverState: React.Dispatch<React.SetStateAction<HoverState | null>>;\n setSmartConnectLineState: React.Dispatch<\n React.SetStateAction<SmartConnectLineState | null>\n >;\n onConnect?: (\n source: NodeCell | DecoratorCell,\n target: NodeCell | DecoratorCell,\n exitPosition: NodePosition,\n entryPosition: NodePosition | undefined\n ) => void;\n onChangeEdgeView?: (\n source: NodeCell | DecoratorCell,\n target: NodeCell | DecoratorCell,\n view: EdgeView\n ) => void;\n onChangeDecoratorView?: (\n cell: DecoratorCell,\n view: DecoratorView | DecoratorLineView\n ) => void;\n}>({\n rootRef: { current: null },\n smartConnectLineState: null,\n unsetHoverStateTimeoutRef: { current: null },\n hoverState: null,\n activeEditableLines: [],\n lineEditorState: null,\n setLineEditorState: () => {},\n setHoverState: () => {},\n setSmartConnectLineState: () => {},\n});\n\nexport function useHoverStateContext() {\n return React.useContext(HoverStateContext);\n}\n"],"names":["getUnrelatedCells","cells","connectLineState","activeTarget","allowEdgeToArea","unrelated","existedTargets","Set","cell","type","source","id","add","target","has","push","decorator","nodesMap","Map","activeNodeIds","relatedNodeIds","active","targets","set","targetIsActive","isNodeCell","isDecoratorCell","isInitialNodeCell","isEdgeCell","isNodeOrEdgeCell","isNodeOrAreaDecoratorCell","isEdgeSide","isContainerDecoratorCell","isGroupDecoratorCell","isLineDecoratorCell","isNoManualLayout","layout","undefined","includes","isNoSize","view","width","height","isNoPoint","isNil","x","y","isStraightType","isEditableEdgeLine","line","edge","nodeViewToNodeRect","padding","DEFAULT_DIRECTIONS","getSmartLinePoints","sourceView","targetView","lineView","parallelGap","cellType","_connectPoints$find$d","_connectPoints$find","_connectPoints$find$d2","_connectPoints$find2","_sourceDirections$","_targetDirections$","vertices","exitPosition","originalExit","entryPosition","originalEntry","getDirectLinePoints","DEFAULT_NODE_PADDING_FOR_SMART_LINES","DEFAULT_NODE_PADDING_FOR_LINES","length","firstVertex","lastVertex","exitPoint","entryPoint","exitDirection","entryDirection","getAbsolutePosition","possibleFirstNextPoint","getDefaultAbsolutePosition","prefer","point","direction","fitEndpointAndDirection","possibleLastPreviousPoint","slice","reverse","sourceX","sourceY","targetX","targetY","newLinePoints","newVertices","unshift","simplifyVertices","getDefaultPosition","connectPoints","getConnectPointsOfRectangleWithDirection","originalSourceDirections","find","p","d","originalTargetDirections","sourceDirections","targetDirections","pull","sourceDirection","targetDirection","sourcePosition","targetPosition","getPolyLinePoints","simplifiedVertices","prevDirection","prev","index","vertex","isHorizontal","isVertical","next","isHorizontalNext","isVerticalNext","position","halfPadding","flip","xAxis","yAxis","xSize","ySize","xPosition","oppositeView","nsDirection","ewDirection","_vertices$","nextVertex","SmartConnectLineComponent","_ref","transform","lineSettings","options","connectLineTo","setConnectLineTo","useState","hoverState","smartConnectLineState","setSmartConnectLineState","useHoverStateContext","useEffect","document","addEventListener","onMouseMove","onMouseUp","reset","e","clientX","offset","k","clientY","preventDefault","removeEventListener","useMemo","points","activePointIndex","relativePoints","x1","y1","getConnectLinePoints","curveLine","curveType","markerStart","markerEnd","lineMarkers","getMarkers","marker","placement","$markerStartUrl","$markerEndUrl","React","className","classNames","connecting","fill","stroke","strokeColor","strokeWidth","KeywordMap","normalizeAlignAxis","value","axis","newX","get","matches","match","Number","console","error","useLayout","layoutOptions","autoSize","rootRef","zoomable","zoomer","scaleRange","layoutKey","autoCenterWhenCellsChange","dispatch","layoutInitialized","setLayoutInitialized","layoutKeyRef","useRef","getNextLayoutKey","useCallback","current","centered","setCentered","some","root","SYMBOL_FOR_SIZE_INITIALIZED","rect","getCellsRect","clientWidth","clientHeight","fitWidth","fitHeight","fullPadding","extractPartialRectTuple","DEFAULT_CANVAS_PADDING","_autoSize$minWidth","_autoSize$maxWidth","_autoSize$minHeight","_autoSize$maxHeight","Math","min","max","minWidth","maxWidth","Infinity","style","minHeight","maxHeight","getTransformToCenter","canvasWidth","canvasHeight","canvasPadding","select","ZoomTransform","useAutoCenter","previousLayoutRef","a","b","filter","every","v","i","getNodeView","nodePaddings","forceLayout","dagreLayout","alignOrigin","origin","normalizeAlignOrigin","newCells","map","nodeView","SYMBOL_FOR_LAYOUT_INITIALIZED","payload","left","top","empty","paddingTop","paddingRight","paddingBottom","paddingLeft","availableWidth","availableHeight","scale","useActiveTarget","_activeTarget","doNotResetActiveTargetForSelector","doNotResetActiveTargetOutsideCanvas","onActiveTargetChange","newActiveTarget","setActiveTarget","previous","sameTarget","activeTargetChangeInitialized","resetActiveTarget","path","composedPath","rootIndex","indexOf","el","Element","getNewLineVertices","activeEditableLine","lineEditorState","editableLineMap","control","linePoints","LOOSE_CONTROL_TYPES","EditingLineComponent","setLineEditorState","onChangeEdgeView","onChangeDecoratorView","movedRef","setTimeout","from","getConnectTo","diff","otherPoints","axises","getFinalPosition","movementX","movementY","altKey","_","endpoint","editableLine","newDiff","abs","newConnectTo","isEdge","_view$vertices","splice","handleBodyClick","stopPropagation","body","pick","getEditingLinePoints","$editingStartMarkerUrl","$editingEndMarkerUrl","editing","editingStrokeColor","GROUPPADDING","initialGroupLayout","arguments","groupMap","decoratorCells","c","nodeLayout","nodeCells","edgeCells","containerCellMap","forEach","groupNameMap","node","groupId","idSet","Object","entries","sortedGroupIds","containerGroup","currentContainerGap","groupCell","CONTAINERGAP","nodeViews","staggeredLayout","offsetY","containerRect","computeBoundingBox","processSortedGroups","orderBy","o","highlightGroupCell","activeTargetCells","item","_cells$find","handleNodeContainedChange","payloads","onContainerContainerChange","nodeAndGroupCells","containerIds","cellPayloads","includeNodeFlag","containerId","containerDecoratorCells","_cell$view","locked","right","bottom","containerCell","containerLeft","containerRight","containerTop","containerBottom","containedChanges","_payload$containerCel","POINT_HELPER_IMAGE","END_POINT_HELPER_IMAGE","ANCHORED_POINT_HELPER_IMAGE","VERTEX_HELPER_IMAGE","POINT_HELPER_BG_SIZE","LineEditorComponent","updateCurActiveEditableLine","movingCells","exitRef","entryRef","controlPointsRef","isLineDecorator","exit","entry","handleMouseDownFactory","getBoundingClientRect","handleStartMouseDown","handleEndMouseDown","controlPoints","_activeEditableLine$v","cursor","getStraightControlPoints","ns","ew","getControlPoints","controlElements","handlers","gRef","g","onClick","commonProps","preserveAspectRatio","pointerEvents","ref","_extends","xlinkHref","key","opacity","handleLasso","event","onLassoing","onLassoed","ctrlKey","button","x0","y0","moved","handleMove","finished","movement","getMovement","HELPER_IMAGE","HELPER_RADIUS","HELPER_BG_RADIUS","HALF_HELPER_RADIUS","LineConnectorComponent","disabled","unsetHoverStateTimeoutRef","setHoverState","unsetTimeout","clearTimeout","unsetActivePointIndex","unsetHoverState","available","hasActiveEdge","onMouseEnter","onMouseLeave","cx","cy","r","fillOpacity","ConnectPointComponent","_ref2","onConnect","handleMouseEnter","handleMouseDown","originalPoint","handleMouseUp","handleKeyboard","lockedIds","activeCells","isLocked","keyCode","which","action","toggleLock","lockedContainerIds","previousLocked","previousUnlocked","updates","update","___CSS_LOADER_EXPORT___","module","toString","Symbol","for","DEFAULT_NODE_SIZE","DEFAULT_NODE_GAP_H","DEFAULT_NODE_GAP_V","DEFAULT_AREA_WIDTH","DEFAULT_AREA_HEIGHT","DEFAULT_SCALE_RANGE_MIN","DEFAULT_SCALE_RANGE_MAX","DEFAULT_LINE_STROKE_COLOR","DEFAULT_LINE_STROKE_WIDTH","DEFAULT_DECORATOR_LINE_STROKE_COLOR","DEFAULT_LINE_INTERACT_STROKE_WIDTH","DEFAULT_LINE_INTERACT_SHOW_START_ARROW","DEFAULT_LINE_INTERACT_SHOW_END_ARROW","DEFAULT_LINE_INTERACT_ANIMATE_DURATION","DEFAULT_DEGRADED_THRESHOLD","DEFAULT_SNAP_GRID_SIZE","DEFAULT_SNAP_OBJECT_DISTANCE","DEFAULT_SNAP_OBJECT_POSITIONS","DEFAULT_MOTION_SPEED","MAXPERROW","computeNodePoints","containerView","existingPoints","nodeWidth","nodeHeight","gap","stepX","stepY","cols","floor","row","col","isOverlapping","w1","h1","x2","y2","w2","h2","cx1","cy1","cx2","cy2","minDistX","minDistY","updateCells","previousCells","defaultNodeSize","reason","parent","parentNode","isManualLayout","initializeCells","isInitialize","updateCandidates","shouldReCenter","prevSizeNodes","prevShouldCentered","prevNode","assign","handled","parentNodeCell","adjacency","queue","parentId","shift","baseX","baseY","offsetX","ceil","cid","layoutRelatedNodes","positioned","hasDecorators","transformToCenter","without","fixedPosition","center","containerAndGroupCells","initialContainerLayout","newContainerChildCells","newGroupChildCells","groupBy","groupedNodes","group","newNodes","groupView","_node$view","_node$view2","newPoint","container","_node$view3","_node$view4","generateNewPointsWithLayout","updated","ConnectLineComponent","onMouseDown","capture","join","initialCells","originalCells","_cell$view2","nodes","gapX","gapY","maxPerRow","fullRowCount","shortRowCount","layoutedNodes","preRowOffsetY","isOddRow","nodesInRow","nodeX","maxNodeHeight","findNodeOrAreaDecorator","LINE_JUMP_BASE_SIZE","lineJumpIntersect","p1","p2","p3","p4","radius","intersect","r2","dx","dy","useEditableLineMap","lineConfMap","WeakMap","collectLineJumps","allJumps","allLineSegments","lineConf","lineJumps","lineSegments","start","end","jumpPoints","jumps","jumpLoop","jump","sqrt","pow","segJumps","sortBy","j","collectLineJumpsFactory","sourceNode","targetNode","_c$view","jumpsMap","rects","mergeRects","DEFAULT_CELL_ORDERS","decorators","insertCell","newCell","insertCells","findIndex","order","matchCellOrder","warn","targetIndex","findLastIndex","rootReducer","reducers","state","existedEdgeIndex","existedDecoratorIndex","matched","newState","move","size","fromEntries","nodePadding","collide","radiusDiff","strength","iterations","forceNodes","forceLinks","fx","fy","linkSimulation","forceLink","simulation","forceSimulation","force","forceX","forceY","forceManyBody","forceCollide","stop","tick","log","alphaMin","alphaDecay","manuallyTickToTheEnd","groupCells","containerCells","containerGap","maxContainerWidth","uniformWidthContainers","sortedContainerIds","updatedGap","updatedMaxWidth","decoratorGroup","currentMaxContainerWidth","decoratorGroups","containerHeight","containerWidth","groupX","groupY","processSortedContainers","props","xmlns","viewBox","ZoomBarComponent","shadowRoot","onZoomChange","onReCenter","currentTheme","useCurrentTheme","cache","createCache","zoomBarRef","tooltip","formatter","getPopupContainer","onZoomIn","onZoomOut","ConfigProvider","theme","algorithm","darkAlgorithm","defaultAlgorithm","StyleProvider","autoClear","hashPriority","role","CenterSVG","ZoomInSVG","Slider","step","vertical","included","onChange","ZoomOutSVG","useLineMarkers","defaultEdgeLines","markerPrefix","lineConnector","useMemoizedResult","memoizedResult","markers","markerType","lineConnectorConf","getDefaultLineConf","omitBy","isUndefined","_type","markerIndex","addMarker","editingMarkerIndex","_secret_internals$le","computedLineConf","Array","isArray","transformLineConf","checkIfByTransform","__secret_internals","legacyDoTransform","checkIfOfComputed","interactStrokeWidth","showEndArrow","_lineConf$overrides","activeStrokeColor","overrides","activeMarkerIndex","$activeMarkerStartUrl","$activeMarkerEndUrl","_lineConf$overrides2","activeRelatedStrokeColor","activeRelated","activeRelatedMarkerIndex","$activeRelatedMarkerStartUrl","$activeRelatedMarkerEndUrl","_lineConf$label","label","useBrick","restLabel","restConf","computedRestConf","showStartArrow","dashed","animate","useAnimate","duration","LineLabelComponent","text","onRendered","ready","LineLabelUseBrickComponent","LineLabelTextComponent","refCallback","element","content","_ref3","memoizedData","parentElement","ignoredCallback","ReactUseBrick","data","EdgeComponent","_editableLineMap$get","_motion","_motion2","_lineConf$overrides3","_lineConf$overrides4","_lineConf$animate$dur","_lineConf$overrides5","readOnly","onSwitchActiveTarget","pathRef","lineClipPathPrefix","uniqueId","labelPosition","setLabelPosition","labelSize","setLabelSize","lineRect","setLineRect","updateLabelPosition","pathLength","getTotalLength","halfPathLength","pathPoint","getPointAtLength","angle","p0","atan2","getBBox","setPathLength","pathRefCallback","_element$getTotalLeng","_element$getTotalLeng2","_element$getBBox","call","labelElement","setLabelElement","resizeObserver","ResizeObserver","observerCallback","offsetWidth","offsetHeight","observe","disconnect","handleLabelRendered","onLabelClick","cellToTarget","onDoubleClick","_labelElement$firstEl","_labelElement$firstEl2","callLabelOnDoubleClick","firstElementChild","mask","labelOffset","halfWidth","halfHeight","cos","tan","sin","getLabelMaskAndOffset","clipPathPoints","maskRight","maskBottom","motion","_overrides$strokeColo","_overrides$strokeWidt","_lineConf$$activeMark","_lineConf$$activeMark2","_overrides$strokeColo2","_overrides$strokeWidt2","_lineConf$$activeRela","_lineConf$$activeRela2","motionPath","motionDuration","shape","_motion$speed","_motion3","speed","hasMotion","clipPathUrl","clipPath","dotted","visible","dur","repeatCount","rotate","LockIcon","NodeComponent","_useMemo","degraded","degradedNodeLabel","defaultNodeBricks","containerLocked","groupLocked","onResize","memoizedValue","setMemoizedValue","isEqual","useDeepMemo","specifiedUseBrick","specifiedComponent","component","observerRef","Component","String","brickRef","xRef","yRef","prevObserver","observer","degradedRefCallBack","foreignObjectRef","fo","test","navigator","userAgent","overflow","timeoutId","Boolean","DEFAULT_ALL_POSITIONS","getSnapPositions","positions","snapPositions","_positions$split$flat","_positions$split","split","flatMap","pos","tuple","Error","HORIZONTAL_POSITIONS","VERTICAL_POSITIONS","_snap$object","onCellsMoving","onCellsMoved","onCellResizing","onCellResized","preActive","getLockedContainerIds","canUpdateActiveEditableLine","shiftKey","activeTargets","actives","groupIds","isAutoLayout","movableActiveCells","snap","_snapToGrid$size","_snapToObject$distanc","_snapToObject$positio","intermediateSnap","grid","object","snapToGrid","snapToObject","distance","normalizeSnapOptions","snapToObjectPositions","originals","firstOriginalPosition","snapToObjectTargets","objectCells","snapMovement","newPositions","xAlign","yAlign","xAlignCell","yAlignCell","diffX","diffY","snapToObjectDistance","xAlignFrom","yAlignFrom","xAlignTarget","yAlignTarget","xAlignToY","yAlignToX","targetPositions","originalPositions","horizontal","dX","dY","snapToGridSize","firstNewPosition","round","snapToGridMovement","snapToGridDiffX","snapToGridDiffY","_ref5","_ref4","_c$view$vertices","guideLines","_ref6","_supports","getContentEditable","editable","div","createElement","setAttribute","contentEditable","supportsContentEditablePlaintextOnly","selectAllText","range","createRange","selectNodeContents","selection","window","getSelection","removeAllRanges","addRange","decoratorComponents","onDecoratorGroupPlusClick","usePlus","PlusOutlined","onDecoratorTextEditing","onDecoratorTextChange","textRef","resizeHandleRef","editingLabel","setEditingLabel","currentLabel","setCurrentLabel","shouldEmitLabelChange","setShouldEmitLabelChange","recomputation","setRecomputation","titleForeignRect","setTitleForeignRect","shouldHighlight","targetCell","handleEnableEdit","handleInput","textContent","handleBlur","uuidV4","_textRef$current","focus","resizeHandle","titleStyle","onInput","onBlur","_cell$view$text","editingLabelInitialized","_ref$current","lockedPosition","lastPoint","firstPoint","useEndPoint","point1","point2","twistedAngle","PI","getLineLockIconPosition","DecoratorComponent","SpecifiedComponent","CellComponent","dragoverContainer","hoverCell","unrelatedCells","curActiveEditableLine","onCellContextMenu","onCellClick","onNodeBrickResize","onCellMouseEnter","onCellMouseLeave","containCells","isEntry","handleContextMenu","handleCellClick","handleMouseLeave","faded","onContextMenu","isMac","_userAgentData$platfo","_userAgentData","userAgentData","platform","wheelData","deltaY","deltaMode","useZoom","scrollable","pannable","draggable","ctrlDraggable","_scaleRange","grabbing","setGrabbing","setTransform","zoom","wheelDelta","scaleExtent","on","rootSelection","unsetZoom","translateBy","wheelDeltaX","wheelDeltaY","targetA","targetB","useReady","RectangleRelativeConnectPointsWithDirection","RectangleRelativeConnectPoints","getConnectPointsOfRectangle","lockeds","_cell$view3","dagreGraphOptions","rankdir","ranksep","edgesep","nodesep","graph","dagre","Graph","setGraph","setDefaultEdgeLabel","setNode","setEdge","minX","minY","maxX","maxY","n","isFinite","HoverStateContext","activeEditableLines"],"sourceRoot":""}
|