@next-bricks/diagram 0.43.2 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bricks.json +3 -3
- package/dist/chunks/2408.fb68feb4.js +2 -0
- package/dist/chunks/2408.fb68feb4.js.map +1 -0
- package/dist/chunks/6055.b92cd119.js +2 -0
- package/dist/chunks/6055.b92cd119.js.map +1 -0
- package/dist/chunks/9711.8210cef5.js +2 -0
- package/dist/chunks/9711.8210cef5.js.map +1 -0
- package/dist/chunks/eo-diagram.e1ace5a5.js +2 -0
- package/dist/chunks/eo-diagram.e1ace5a5.js.map +1 -0
- package/dist/chunks/eo-display-canvas.05693123.js +2 -0
- package/dist/chunks/eo-display-canvas.05693123.js.map +1 -0
- package/dist/chunks/eo-draw-canvas.c06550f7.js +2 -0
- package/dist/chunks/eo-draw-canvas.c06550f7.js.map +1 -0
- package/dist/chunks/main.3c306a02.js +2 -0
- package/dist/chunks/{main.1a8affb8.js.map → main.3c306a02.js.map} +1 -1
- package/dist/examples.json +4 -4
- package/dist/index.9179413f.js +2 -0
- package/dist/{index.05f1b5e3.js.map → index.9179413f.js.map} +1 -1
- package/dist/manifest.json +111 -105
- package/dist/types.json +3712 -3639
- package/dist-types/diagram/lines/getDirectLinePoints.d.ts +2 -1
- package/dist-types/draw-canvas/CellComponent.d.ts +2 -1
- package/dist-types/draw-canvas/EdgeComponent.d.ts +2 -1
- package/dist-types/draw-canvas/EditingLineComponent.d.ts +7 -0
- package/dist-types/draw-canvas/HoverStateContext.d.ts +15 -5
- package/dist-types/draw-canvas/LineConnectorComponent.d.ts +2 -3
- package/dist-types/draw-canvas/LineEditorComponent.d.ts +5 -0
- package/dist-types/draw-canvas/SmartConnectLineComponent.d.ts +2 -3
- package/dist-types/draw-canvas/constants.d.ts +5 -0
- package/dist-types/draw-canvas/index.d.ts +3 -2
- package/dist-types/draw-canvas/interfaces.d.ts +22 -4
- package/dist-types/draw-canvas/processors/asserts.d.ts +1 -0
- package/dist-types/draw-canvas/reducers/interfaces.d.ts +6 -1
- package/dist-types/shared/canvas/processors/getEditingLinePoints.d.ts +4 -0
- package/dist-types/shared/canvas/processors/getEditingLinePoints.spec.d.ts +1 -0
- package/dist-types/shared/canvas/processors/getSmartLinePoints.d.ts +2 -1
- package/dist-types/shared/canvas/shapes/Rectangle.d.ts +3 -1
- package/docs/eo-display-canvas.md +9 -0
- package/docs/eo-draw-canvas.md +5 -0
- package/package.json +2 -2
- package/dist/chunks/3252.d94ce52c.js +0 -2
- package/dist/chunks/3252.d94ce52c.js.map +0 -1
- package/dist/chunks/9711.2d99e6d9.js +0 -2
- package/dist/chunks/9711.2d99e6d9.js.map +0 -1
- package/dist/chunks/eo-diagram.1934f2b2.js +0 -2
- package/dist/chunks/eo-diagram.1934f2b2.js.map +0 -1
- package/dist/chunks/eo-display-canvas.2b754ef1.js +0 -2
- package/dist/chunks/eo-display-canvas.2b754ef1.js.map +0 -1
- package/dist/chunks/eo-draw-canvas.79b100f8.js +0 -2
- package/dist/chunks/eo-draw-canvas.79b100f8.js.map +0 -1
- package/dist/chunks/main.1a8affb8.js +0 -2
- package/dist/index.05f1b5e3.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunks/6055.b92cd119.js","mappings":"6PAGO,SAASA,EACdC,EACAC,GAEA,OAAOD,EAAME,MACVC,IAASC,EAAAA,EAAAA,IAA0BD,IAASA,EAAKF,KAAOA,GAE7D,C,cCYO,SAASI,EAAaC,GAKc,IAAAC,EAAAC,EAAA,IALb,KAC5BC,EAAI,MACJT,EAAK,YACLU,EAAW,OACXC,GACmBL,EACnB,MAAM,sBAAEM,IAA0BC,EAAAA,EAAAA,KAC5BC,GAAUC,EAAAA,EAAAA,QAAuB,MACjCC,GAAaC,EAAAA,EAAAA,UACjB,IAAMlB,EAAwBC,EAAOS,EAAKS,SAC1C,CAAClB,EAAOS,EAAKS,SAETC,GAAaF,EAAAA,EAAAA,UACjB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AAOprB,GAAI,85FAYmkB,KAE5mB,QAAemrB,EAAwBE,U","sources":["webpack:///./src/draw-canvas/processors/findNodeOrAreaDecorator.ts","webpack:///./src/draw-canvas/EdgeComponent.tsx","webpack:///./src/draw-canvas/NodeComponent.tsx","webpack:///./src/draw-canvas/processors/handleMouseDown.ts","webpack:///./src/draw-canvas/processors/normalizeSnapOptions.ts","webpack:///./src/draw-canvas/decorators/DecoratorArea.tsx","webpack:///./src/draw-canvas/decorators/DecoratorText.tsx","webpack:///./src/draw-canvas/decorators/DecoratorContainer.tsx","webpack:///./src/draw-canvas/decorators/index.tsx","webpack:///./src/draw-canvas/processors/computeContainerRect.ts","webpack:///./src/draw-canvas/CellComponent.tsx","webpack:///./src/draw-canvas/ConnectLineComponent.tsx","webpack:///./src/draw-canvas/EditingLineComponent.tsx","webpack:///./src/shared/canvas/processors/getEditingLinePoints.ts","webpack:///./src/draw-canvas/HoverStateContext.ts","webpack:///./src/draw-canvas/LineConnectorComponent.tsx","webpack:///./src/draw-canvas/LineEditorComponent.tsx","webpack:///./src/draw-canvas/SmartConnectLineComponent.tsx","webpack:///./src/shared/canvas/processors/getConnectLinePoints.ts","webpack:///./src/draw-canvas/constants.ts","webpack:///./src/draw-canvas/processors/asserts.ts","webpack:///./src/draw-canvas/processors/cellToTarget.ts","webpack:///./src/draw-canvas/processors/getUnrelatedCells.ts","webpack:///./src/draw-canvas/processors/handleKeyboard.ts","webpack:///./src/draw-canvas/processors/handleLasso.ts","webpack:///./src/draw-canvas/processors/handleNodeContainedChange.ts","webpack:///./src/draw-canvas/processors/initializeCells.ts","webpack:///./src/draw-canvas/processors/sameTarget.ts","webpack:///./src/draw-canvas/processors/targetIsActive.ts","webpack:///./src/draw-canvas/processors/transformToCenter.ts","webpack:///./src/draw-canvas/processors/updateCells.ts","webpack:///./src/draw-canvas/reducers/cells.ts","webpack:///./src/draw-canvas/reducers/index.ts","webpack:///./src/draw-canvas/reducers/layoutKey.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/dagreLayout.ts","webpack:///./src/shared/canvas/forceLayout.ts","webpack:///./src/shared/canvas/processors/getSmartLinePoints.ts","webpack:///./src/shared/canvas/processors/nodeViewToNodeRect.ts","webpack:///./src/shared/canvas/shapes/Rectangle.ts","webpack:///./src/shared/canvas/useActiveTarget.ts","webpack:///./src/draw-canvas/processors/normalizeAlignOrigin.ts","webpack:///./src/shared/canvas/useLayout.ts","webpack:///./src/shared/canvas/useAutoCenter.ts","webpack:///./src/shared/canvas/useLineMarkers.ts","webpack:///./src/shared/canvas/useReady.ts","webpack:///./src/shared/canvas/useZoom.ts","webpack:///./src/shared/canvas/ZoomBarComponent.shadow.css","webpack:///./src/shared/canvas/styles.shadow.css"],"sourcesContent":["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 React, { useEffect, useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type { Cell, ComputedEdgeLineConf, EdgeCell } from \"./interfaces\";\nimport { getDirectLinePoints } from \"../diagram/lines/getDirectLinePoints\";\nimport { isEdgeCell } from \"./processors/asserts\";\nimport {\n DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n DEFAULT_NODE_PADDING_FOR_LINES,\n} from \"./constants\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { nodeViewToNodeRect } from \"../shared/canvas/processors/nodeViewToNodeRect\";\nimport { getSmartLinePoints } from \"../shared/canvas/processors/getSmartLinePoints\";\nimport { findNodeOrAreaDecorator } from \"./processors/findNodeOrAreaDecorator\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\n\nexport interface EdgeComponentProps {\n edge: EdgeCell;\n cells: Cell[];\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n active?: boolean;\n}\n\nexport function EdgeComponent({\n edge,\n cells,\n lineConfMap,\n active,\n}: EdgeComponentProps): JSX.Element | null {\n const { setActiveEditableLine } = useHoverStateContext();\n const pathRef = useRef<SVGPathElement>(null);\n const sourceNode = useMemo(\n () => findNodeOrAreaDecorator(cells, edge.source),\n [cells, edge.source]\n );\n const targetNode = useMemo(\n () => findNodeOrAreaDecorator(cells, edge.target),\n [cells, edge.target]\n );\n const lineConf = useMemo(() => lineConfMap.get(edge)!, [edge, lineConfMap]);\n\n const parallelGap = useMemo(() => {\n const hasOppositeEdge = cells.some(\n (cell) =>\n isEdgeCell(cell) &&\n cell.source === edge.target &&\n cell.target === edge.source &&\n !(edge.view?.exitPosition || edge.view?.entryPosition)\n );\n return hasOppositeEdge ? lineConf.parallelGap : 0;\n }, [cells, edge, lineConf.parallelGap]);\n\n const linePoints = useMemo(() => {\n const directLinePadding =\n edge.view?.exitPosition || edge.view?.entryPosition\n ? 0\n : DEFAULT_NODE_PADDING_FOR_LINES;\n const points =\n sourceNode &&\n targetNode &&\n sourceNode.view.x != null &&\n targetNode.view.x != null\n ? edge.view?.exitPosition || edge.view?.entryPosition\n ? getSmartLinePoints(sourceNode.view, targetNode.view, edge.view)\n : getDirectLinePoints(\n nodeViewToNodeRect(sourceNode.view, directLinePadding),\n nodeViewToNodeRect(targetNode.view, directLinePadding),\n parallelGap,\n edge.view\n )\n : null;\n return points;\n }, [edge.view, parallelGap, sourceNode, targetNode]);\n\n const line = useMemo(() => {\n const fixedLineType = lineConf.type === \"auto\" ? \"polyline\" : lineConf.type;\n return curveLine(\n linePoints,\n fixedLineType === \"curve\" ? lineConf.curveType : \"curveLinear\",\n 0,\n 1\n );\n }, [lineConf, linePoints]);\n\n useEffect(() => {\n setActiveEditableLine((prev) =>\n active\n ? linePoints && sourceNode && targetNode\n ? {\n edge,\n source: sourceNode,\n target: targetNode,\n endPoints: [linePoints[0], linePoints[linePoints.length - 1]],\n exitPosition: edge.view?.exitPosition,\n entryPosition: edge.view?.entryPosition,\n }\n : null\n : prev?.edge &&\n prev.edge.source === edge.source &&\n prev.edge.target === edge.target\n ? null\n : prev\n );\n }, [active, edge, linePoints, setActiveEditableLine, sourceNode, targetNode]);\n\n if (!line || !linePoints) {\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 return (\n <>\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 ref={pathRef}\n className={classNames(\"line\", {\n dashed: lineConf.dashed,\n [`${lineConf.dashed ? \"dashed\" : \"solid\"}-animation`]:\n lineConf.animate.useAnimate,\n })}\n style={\n {\n \"--time\": `${lineConf.animate.duration ?? DEFAULT_LINE_INTERACT_ANIMATE_DURATION}s`,\n \"--solid-length\": pathRef.current?.getTotalLength?.(),\n } as React.CSSProperties\n }\n d={line}\n fill=\"none\"\n stroke={lineConf.strokeColor}\n strokeWidth={lineConf.strokeWidth}\n markerStart={lineConf.showStartArrow ? lineConf.$markerUrl : \"\"}\n markerEnd={lineConf.showEndArrow ? lineConf.$markerUrl : \"\"}\n />\n <path className=\"line-active-bg\" d={line} fill=\"none\" />\n </>\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 { NodeBrickCell, NodeBrickConf, NodeCell } from \"./interfaces\";\nimport type { SizeTuple } from \"../diagram/interfaces\";\n\nexport interface NodeComponentProps {\n node: NodeCell;\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n onResize(id: string, size: SizeTuple | null): void;\n}\n\nexport function NodeComponent({\n node,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n onResize,\n}: NodeComponentProps): JSX.Element | null {\n const memoizedData = useDeepMemo({ node: { id: node.id, data: node.data } });\n const specifiedUseBrick = (node as NodeBrickCell).useBrick;\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const useBrick = useMemo(() => {\n return degraded\n ? null\n : specifiedUseBrick ??\n defaultNodeBricks?.find((item) =>\n checkIfByTransform(item, memoizedData)\n )?.useBrick;\n }, [degraded, specifiedUseBrick, defaultNodeBricks, memoizedData]);\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 refCallback = useCallback(\n (element: HTMLElement | null) => {\n const prevObserver = observerRef.current;\n if (prevObserver) {\n prevObserver.disconnect();\n observerRef.current = null;\n }\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 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 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 return useBrick ? (\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 >\n {useBrick && (\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}\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 {\n ActiveTarget,\n Cell,\n LayoutOptions,\n DecoratorCell,\n LayoutType,\n NodeCell,\n NodeView,\n} from \"../interfaces\";\nimport type {\n MoveCellPayload,\n ResizeCellPayload,\n} from \"../reducers/interfaces\";\nimport {\n isContainerDecoratorCell,\n isDecoratorCell,\n isEdgeCell,\n isNodeCell,\n} from \"./asserts\";\nimport { cellToTarget } from \"./cellToTarget\";\nimport { normalizeSnapOptions } from \"./normalizeSnapOptions\";\nimport { targetIsActive } from \"./targetIsActive\";\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 }: {\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 }\n) {\n event.stopPropagation();\n // Drag node\n if (action === \"resize\" || !targetIsActive(cell, activeTarget)) {\n onSwitchActiveTarget?.(cellToTarget(cell));\n }\n\n const isAutoLayout = layout === \"force\" || layout === \"dagre\";\n if (isEdgeCell(cell)) {\n return;\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\" && isContainerDecoratorCell(a)) {\n activeCells.push(\n ...cells.filter(\n (c) => isNodeCell(c) && c.containerId === a.id && !actives.includes(c)\n )\n );\n }\n });\n const movableActiveCells = activeCells.filter(\n (c) => (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\n const from: PositionTuple = [event.clientX, event.clientY];\n const originals = movableActiveCells.map<{\n cell: NodeCell | DecoratorCell;\n position: PositionTuple;\n center: PositionTuple | null;\n }>((c) => ({\n cell: c,\n position:\n action === \"move\" ? [c.view.x, c.view.y] : [c.view.width, c.view.height],\n center:\n action === \"move\" && !isEdgeCell(c) ? getCenterPosition(c.view) : 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 center: PositionTuple;\n }[] = [];\n if (action === \"move\" && snap.object) {\n const objectCells = cells.filter(\n (c) => !isEdgeCell(c) && !activeCells.includes(c)\n ) as (NodeCell | DecoratorCell)[];\n snapToObjectTargets = objectCells.map((c) => ({\n cell: c,\n center: getCenterPosition(c.view),\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 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 // 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 if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n }\n } else {\n // Snap\n let diffX = Infinity;\n let diffY = Infinity;\n const snapMovement: PositionTuple = [...movement];\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 center: [x, y],\n } of snapToObjectTargets) {\n for (const { cell: c, center } of originals) {\n const [cx, cy] = center!;\n const dX = Math.abs(cx + movement[0] - x);\n const dY = Math.abs(cy + movement[1] - y);\n const xSnapped = dX < snapToObjectDistance && dX < diffX;\n const ySnapped = dY < snapToObjectDistance && dY < diffY;\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 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 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 Math.round(position[0] + snapMovement[0]),\n Math.round(position[1] + snapMovement[1]),\n ]);\n const changed =\n newPositions[0][0] !== previousPositions[0][0] ||\n newPositions[0][1] !== previousPositions[0][1];\n if (changed) {\n previousPositions = newPositions;\n moved = true;\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 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 }));\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\nfunction getCenterPosition(view: NodeView): PositionTuple {\n return [view.x + view.width / 2, view.y + view.height / 2];\n}\n","import {\n DEFAULT_SNAP_GRID_SIZE,\n DEFAULT_SNAP_OBJECT_DISTANCE,\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 ? { distance: snapToObject.distance ?? DEFAULT_SNAP_OBJECT_DISTANCE }\n : null,\n };\n}\n","import React, { useEffect } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\n\nexport function DecoratorArea({\n cell,\n transform,\n readOnly,\n layoutOptions,\n activeTarget,\n cells,\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\">\n <rect\n width={cell.view.width}\n height={cell.view.height}\n className=\"area\"\n />\n {!readOnly && (\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 </g>\n );\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport classNames from \"classnames\";\n\nexport type DecoratorTextProps = Pick<\n BasicDecoratorProps,\n \"cell\" | \"readOnly\" | \"onDecoratorTextEditing\" | \"onDecoratorTextChange\"\n>;\n\nexport function DecoratorText({\n cell,\n readOnly,\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) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n },\n [readOnly]\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 <foreignObject className=\"decorator-text\">\n <div\n className={classNames(\"text-container\", { editing: editingLabel })}\n onDoubleClick={handleEnableEdit}\n >\n <div\n className=\"text\"\n contentEditable={editingLabel}\n ref={ref}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n );\n}\n\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, { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { BasicDecoratorProps } 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 \"..\";\n\nexport function DecoratorContainer({\n cell,\n transform,\n readOnly,\n layout,\n view,\n activeTarget,\n cells,\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 const handleEnableEdit = useCallback(\n (e: React.MouseEvent) => {\n if (readOnly) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n },\n [readOnly]\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 useEffect(() => {\n const element = textRef.current;\n if (element && element.textContent !== currentLabel) {\n element.textContent = currentLabel;\n }\n }, [currentLabel]);\n\n useEffect(() => {\n const textParentEle = textRef.current?.parentElement;\n if (textParentEle) {\n const { clientWidth, clientHeight } = textParentEle;\n if ([\"left\", \"right\"].includes(direction)) {\n const rect = {\n width: clientWidth,\n height: view.height,\n x: direction === \"left\" ? -clientWidth : view.width,\n y: 0,\n };\n setTitleForeignRect(rect);\n } else {\n const rect = {\n width: view.width,\n height: clientHeight,\n x: 0,\n y: direction === \"top\" ? -clientHeight : view.height,\n };\n setTitleForeignRect(rect);\n }\n }\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 >\n <div\n className=\"text\"\n contentEditable={editingLabel}\n ref={textRef}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n <rect width={view.width} height={view.height} className=\"container\" />\n {!readOnly && !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 </g>\n );\n}\n","import React from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { DecoratorArea } from \"./DecoratorArea\";\nimport { DecoratorText } from \"./DecoratorText\";\nimport { DecoratorContainer } from \"./DecoratorContainer\";\n\nexport function DecoratorComponent({\n cell,\n view,\n transform,\n readOnly,\n layout,\n layoutOptions,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: BasicDecoratorProps): JSX.Element | null {\n let SpecifiedComponent: (props: BasicDecoratorProps) => JSX.Element | null;\n\n switch (cell.decorator) {\n case \"container\":\n SpecifiedComponent = DecoratorContainer;\n break;\n case \"area\":\n SpecifiedComponent = DecoratorArea;\n break;\n case \"text\":\n SpecifiedComponent = DecoratorText;\n break;\n // istanbul ignore next\n default:\n // eslint-disable-next-line no-console\n console.error(`Unknown decorator: ${cell.decorator}`);\n return null;\n }\n\n return (\n <SpecifiedComponent\n cell={cell}\n view={view}\n transform={transform}\n readOnly={readOnly}\n layout={layout}\n layoutOptions={layoutOptions}\n activeTarget={activeTarget}\n cells={cells}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n );\n}\n","import { BaseNodeCell } from \"../interfaces\";\n\nexport function computeContainerRect(cells: BaseNodeCell[]) {\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 = 20;\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","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 EdgeCell,\n LayoutOptions,\n LayoutType,\n NodeBrickConf,\n NodeCell,\n} from \"./interfaces\";\nimport {\n isContainerDecoratorCell,\n isDecoratorCell,\n isEdgeCell,\n isEdgeSide,\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 { computeContainerRect } from \"./processors/computeContainerRect\";\nimport { get } from \"lodash\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\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<EdgeCell, ComputedEdgeLineConf>;\n activeTarget: ActiveTarget | null | undefined;\n readOnly?: boolean;\n unrelatedCells: Cell[];\n dragNodeToContainerActive?: boolean;\n allowEdgeToArea?: boolean;\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: CellContextMenuDetail): void;\n onDecoratorTextEditing?(detail: { id: string; editing: boolean }): void;\n onDecoratorTextChange?(detail: DecoratorTextChangeDetail): 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 activeTarget,\n dragNodeToContainerActive,\n readOnly,\n transform,\n unrelatedCells,\n allowEdgeToArea,\n onCellsMoving,\n onCellsMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onCellContextMenu,\n onCellClick,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n onNodeBrickResize,\n onCellMouseEnter,\n onCellMouseLeave,\n}: CellComponentProps): JSX.Element | null {\n const {\n lineEditorState,\n smartConnectLineState,\n setSmartConnectLineState,\n onConnect,\n setLineEditorState,\n onChangeEdgeEndpoints,\n } = useHoverStateContext();\n const gRef = useRef<SVGGElement>(null);\n const unrelated = useMemo(\n () => unrelatedCells.some((item) => sameTarget(item, cell)),\n [cell, unrelatedCells]\n );\n // `containerRect` is undefined when it's an edge cell.\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 ...computeContainerRect(containCells),\n };\n cell.view = view; //Update the rect container to make sure Lasso gets the correct size\n return view;\n }\n return isEdgeCell(cell)\n ? undefined\n : get(cell, \"view\", { x: 0, y: 0, width: 0, height: 0 });\n }, [layout, cell, cells]);\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) && 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 });\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 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 !(smartConnectLineState || lineEditorState)\n ) {\n return;\n }\n const onMouseUp = (e: MouseEvent) => {\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 (lineEditorState) {\n const isEntry = lineEditorState.type === \"entry\";\n if (\n (isEntry ? lineEditorState.target : lineEditorState.source) === cell\n ) {\n if (isEntry) {\n onChangeEdgeEndpoints?.(\n lineEditorState.source,\n lineEditorState.target,\n lineEditorState.exitPosition,\n undefined\n );\n } else {\n onChangeEdgeEndpoints?.(\n lineEditorState.source,\n lineEditorState.target,\n undefined,\n lineEditorState.entryPosition\n );\n }\n }\n setLineEditorState(null);\n }\n };\n g.addEventListener(\"mouseup\", onMouseUp);\n return () => {\n g.removeEventListener(\"mouseup\", onMouseUp);\n };\n }, [\n allowEdgeToArea,\n cell,\n lineEditorState,\n onChangeEdgeEndpoints,\n onConnect,\n setLineEditorState,\n setSmartConnectLineState,\n smartConnectLineState,\n ]);\n\n const handleContextMenu = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (readOnly && cell.type === \"decorator\") {\n return;\n }\n event.preventDefault();\n onSwitchActiveTarget(cellToTarget(cell));\n onCellContextMenu({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n });\n },\n [cell, onCellContextMenu, onSwitchActiveTarget, readOnly]\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 });\n },\n [cell, onCellClick]\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\n return (\n <g\n className={classNames(\"cell\", {\n active,\n faded: unrelated,\n \"read-only\": readOnly,\n \"container-active\": dragNodeToContainerActive,\n })}\n ref={gRef}\n transform={\n cell.type === \"edge\" || cell.view.x == 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 degraded={degraded}\n degradedNodeLabel={degradedNodeLabel}\n defaultNodeBricks={defaultNodeBricks}\n onResize={onNodeBrickResize}\n />\n ) : isEdgeCell(cell) ? (\n <EdgeComponent\n edge={cell}\n cells={cells}\n lineConfMap={lineConfMap}\n active={active}\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 activeTarget={activeTarget}\n cells={cells}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n ) : null}\n </g>\n );\n}\n","import React, { useEffect, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type { ConnectLineState } from \"./interfaces\";\nimport type { PositionTuple, TransformLiteral } from \"../diagram/interfaces\";\n\nexport interface ConnectLineComponentProps {\n connectLineState: ConnectLineState | null;\n transform: TransformLiteral;\n markerEnd: string;\n onConnect(state: ConnectLineState, to: PositionTuple): void;\n}\n\nexport function ConnectLineComponent({\n connectLineState,\n transform,\n markerEnd,\n onConnect,\n}: ConnectLineComponentProps): JSX.Element {\n const [connectLineTo, setConnectLineTo] = useState<PositionTuple | null>(\n null\n );\n\n useEffect(() => {\n if (connectLineState) {\n setConnectLineTo(connectLineState.from);\n }\n }, [connectLineState]);\n\n useEffect(() => {\n if (connectLineState) {\n const onMouseMove = (e: MouseEvent) => {\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo([\n (e.clientX - transform.x - connectLineState.offset[0]) / transform.k,\n (e.clientY - transform.y - connectLineState.offset[1]) / transform.k,\n ]);\n };\n const onMouseDown = (e: MouseEvent) => {\n e.stopPropagation();\n };\n const onClick = (e: MouseEvent) => {\n e.stopPropagation();\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n reset();\n onConnect(connectLineState, [\n (e.clientX - transform.x - connectLineState.offset[0]) / transform.k,\n (e.clientY - transform.y - connectLineState.offset[1]) / transform.k,\n ]);\n };\n const reset = () => {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mousedown\", onMouseDown, {\n capture: true,\n });\n document.removeEventListener(\"click\", onClick, { capture: true });\n setConnectLineTo(null);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mousedown\", onMouseDown, { capture: true });\n document.addEventListener(\"click\", onClick, { capture: true });\n\n return reset;\n }\n }, [connectLineState, onConnect, transform]);\n\n return (\n <path\n className={classNames(\"connect-line\", {\n connecting:\n !!connectLineState &&\n connectLineTo &&\n // Do not show when the distance of mouse move is less than 5px\n (connectLineTo[0] - connectLineState.from[0]) ** 2 +\n (connectLineTo[1] - connectLineState.from[1]) ** 2 >\n 25,\n })}\n d={\n connectLineState && connectLineTo\n ? `M${connectLineState.from.join(\" \")}L${connectLineTo.join(\" \")}`\n : \"\"\n }\n fill=\"none\"\n stroke=\"gray\"\n strokeWidth={1}\n markerEnd={`url(#${markerEnd})`}\n />\n );\n}\n","// istanbul ignore file: experimental\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type { ComputedLineConnecterConf } from \"./interfaces\";\nimport type { PositionTuple, TransformLiteral } from \"../diagram/interfaces\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport { getEditingLinePoints } from \"../shared/canvas/processors/getEditingLinePoints\";\n\nexport interface EditingLineComponentProps {\n transform: TransformLiteral;\n options: ComputedLineConnecterConf;\n}\n\nexport function EditingLineComponent({\n transform,\n options,\n}: EditingLineComponentProps): JSX.Element {\n const [connectLineTo, setConnectLineTo] = useState<PositionTuple | null>(\n null\n );\n const { hoverState, lineEditorState, setLineEditorState } =\n useHoverStateContext();\n\n useEffect(() => {\n if (!lineEditorState) {\n return;\n }\n const onMouseMove = (e: MouseEvent) => {\n // const endPoint = lineEditorState.endPoints[lineEditorState.type === \"entry\" ? 1 : 0];\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo([\n (e.clientX - transform.x - lineEditorState.offset[0]) / transform.k,\n (e.clientY - transform.y - lineEditorState.offset[1]) / 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 setLineEditorState(null);\n }\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n\n return reset;\n }, [lineEditorState, transform, setLineEditorState]);\n\n const line = useMemo(() => {\n const fixedLineType = options.type === \"auto\" ? \"polyline\" : options.type;\n const points = getEditingLinePoints(\n lineEditorState,\n connectLineTo,\n hoverState\n );\n return curveLine(\n points,\n fixedLineType === \"curve\" ? options.curveType : \"curveLinear\",\n 0,\n 1\n );\n }, [connectLineTo, hoverState, lineEditorState, options]);\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={options.showStartArrow ? options.$editingMarkerUrl : \"\"}\n markerEnd={options.showEndArrow ? options.$editingMarkerUrl : \"\"}\n />\n );\n}\n","import type { NodePosition, PositionTuple } from \"../../../diagram/interfaces\";\nimport type { HoverState } from \"../../../draw-canvas/HoverStateContext\";\nimport type { LineEditorState } from \"../../../draw-canvas/interfaces\";\nimport { getSmartLinePoints } from \"./getSmartLinePoints\";\n\nexport function getEditingLinePoints(\n lineEditorState: LineEditorState | null,\n connectLineTo: PositionTuple | null,\n hoverState: HoverState | null\n): NodePosition[] | null {\n if (\n !lineEditorState ||\n !(connectLineTo || hoverState?.activePointIndex !== undefined)\n ) {\n return null;\n }\n\n const { type, source, target, exitPosition, entryPosition } = lineEditorState;\n\n if (hoverState?.activePointIndex !== undefined) {\n const position = hoverState.relativePoints[hoverState.activePointIndex];\n // Assert `hoverState.cell` is `target`\n return getSmartLinePoints(\n source.view,\n target.view,\n type === \"entry\"\n ? {\n exitPosition,\n entryPosition: position,\n }\n : {\n exitPosition: position,\n entryPosition,\n }\n );\n }\n\n const [x1, y1] = connectLineTo!;\n\n if (type === \"entry\") {\n return getSmartLinePoints(\n source.view,\n { x: x1, y: y1, width: 0, height: 0 },\n { exitPosition }\n );\n }\n\n return getSmartLinePoints(\n { x: x1, y: y1, width: 0, height: 0 },\n target.view,\n { entryPosition }\n );\n}\n","// istanbul ignore file: nothing logical to test\nimport React from \"react\";\nimport type {\n DecoratorCell,\n EditableLineInfo,\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 activeEditableLine: EditableLineInfo | null;\n lineEditorState: LineEditorState | null;\n setLineEditorState: React.Dispatch<\n React.SetStateAction<LineEditorState | null>\n >;\n setActiveEditableLine: React.Dispatch<\n React.SetStateAction<EditableLineInfo | 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 onChangeEdgeEndpoints?: (\n source: NodeCell | DecoratorCell,\n target: NodeCell | DecoratorCell,\n exitPosition: NodePosition | undefined,\n entryPosition: NodePosition | undefined\n ) => void;\n}>({\n rootRef: { current: null },\n smartConnectLineState: null,\n unsetHoverStateTimeoutRef: { current: null },\n hoverState: null,\n activeEditableLine: null,\n lineEditorState: null,\n setLineEditorState: () => {},\n setActiveEditableLine: () => {},\n setHoverState: () => {},\n setSmartConnectLineState: () => {},\n});\n\nexport function useHoverStateContext() {\n return React.useContext(HoverStateContext);\n}\n","// istanbul ignore file: experimental\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport type { ActiveTarget, NodeCell } from \"./interfaces\";\nimport { targetIsActive } from \"./processors/targetIsActive\";\nimport type { NodePosition, TransformLiteral } from \"../diagram/interfaces\";\nimport { DEFAULT_NODE_PADDING_FOR_SMART_LINES } from \"./constants\";\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 transform: TransformLiteral;\n disabled?: boolean;\n}\n\nexport function LineConnectorComponent({\n activeTarget,\n transform,\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 const available =\n !disabled &&\n hoverState &&\n (!!smartConnectLineState ||\n (lineEditorState\n ? lineEditorState.type === \"entry\"\n ? hoverState.cell === lineEditorState.target\n : hoverState.cell === lineEditorState.source\n : !targetIsActive(hoverState.cell, activeTarget) &&\n !hasActiveEdge(activeTarget)));\n\n const transformedPoints = useMemo(\n () =>\n available\n ? hoverState.points.map((p) => ({\n x: p.x * transform.k + transform.x,\n y: p.y * transform.k + transform.y,\n }))\n : null,\n [available, hoverState?.points, transform]\n );\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 <g\n transform={`translate(${transform.x} ${transform.y}) scale(${transform.k})`}\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) / transform.k}\n pointerEvents=\"stroke\"\n />\n </g>\n {hoverState?.activePointIndex !== undefined && (\n <circle\n cx={transformedPoints![hoverState.activePointIndex].x}\n cy={transformedPoints![hoverState.activePointIndex].y}\n r={HELPER_BG_RADIUS}\n fill=\"lightgreen\"\n fillOpacity={0.5}\n pointerEvents=\"none\"\n />\n )}\n {transformedPoints!.map((point, index) => (\n <ConnectPointComponent\n key={index}\n index={index}\n point={point}\n unsetActivePointIndex={unsetActivePointIndex}\n unsetTimeout={unsetTimeout}\n />\n ))}\n </>\n )}\n </g>\n );\n}\n\ninterface ConnectPointComponentProps {\n index: number;\n point: NodePosition;\n unsetTimeout: () => void;\n unsetActivePointIndex: () => void;\n}\n\nfunction ConnectPointComponent({\n index,\n point,\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 onChangeEdgeEndpoints,\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 // console.log(\"connect\", originalPoint, rect);\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 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 (lineEditorState) {\n const position =\n hoverState!.relativePoints[hoverState!.activePointIndex!];\n if (lineEditorState.type === \"entry\") {\n onChangeEdgeEndpoints?.(\n lineEditorState.source,\n lineEditorState.target,\n lineEditorState.exitPosition,\n position\n );\n } else {\n onChangeEdgeEndpoints?.(\n lineEditorState.source,\n lineEditorState.target,\n position,\n lineEditorState.entryPosition\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 lineEditorState,\n onChangeEdgeEndpoints,\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}\n y={point.y - HALF_HELPER_RADIUS}\n width={HELPER_RADIUS}\n height={HELPER_RADIUS}\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","// istanbul ignore file: experimental\nimport React, { useEffect, useRef } from \"react\";\nimport type { TransformLiteral } from \"../diagram/interfaces\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\n\nconst POINT_HELPER_IMAGE =\n \"data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIyMnB4IiBoZWlnaHQ9IjIycHgiIHZlcnNpb249IjEuMSI+PGNpcmNsZSBjeD0iMTEiIGN5PSIxMSIgcj0iNyIgc3Ryb2tlPSIjZmZmIiBmaWxsPSIjMDFiZDIyIi8+PHBhdGggZD0ibSA4IDggTCAxNCAxNE0gOCAxNCBMIDE0IDgiIHN0cm9rZT0iI2ZmZiIvPjwvc3ZnPg==\";\nconst POINT_HELPER_BG_SIZE = 22;\n\nexport interface LineEditorComponentProps {\n transform: TransformLiteral;\n}\n\nexport function LineEditorComponent({\n transform,\n}: LineEditorComponentProps): JSX.Element | null {\n const { rootRef, activeEditableLine, setLineEditorState } =\n useHoverStateContext();\n const exitRef = useRef<SVGImageElement>(null);\n const entryRef = useRef<SVGImageElement>(null);\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 ...activeEditableLine,\n offset: [rect.left, rect.top],\n type,\n });\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 }, [activeEditableLine, rootRef, setLineEditorState]);\n\n if (!activeEditableLine) {\n return null;\n }\n\n const commonProps: React.SVGAttributes<SVGImageElement> = {\n width: POINT_HELPER_BG_SIZE / transform.k,\n height: POINT_HELPER_BG_SIZE / transform.k,\n xlinkHref: POINT_HELPER_IMAGE,\n preserveAspectRatio: \"none\",\n style: { cursor: \"pointer\" },\n pointerEvents: \"fill\",\n };\n const exitPoint = activeEditableLine.endPoints[0];\n const entryPoint = activeEditableLine.endPoints[1];\n const offset = POINT_HELPER_BG_SIZE / transform.k / 2;\n\n return (\n <>\n <image\n ref={exitRef}\n {...commonProps}\n x={exitPoint.x - offset}\n y={exitPoint.y - offset}\n />\n <image\n ref={entryRef}\n {...commonProps}\n x={entryPoint.x - offset}\n y={entryPoint.y - offset}\n />\n </>\n );\n}\n","// istanbul ignore file: experimental\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type { ComputedLineConnecterConf } from \"./interfaces\";\nimport type { PositionTuple, TransformLiteral } from \"../diagram/interfaces\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport { getConnectLinePoints } from \"../shared/canvas/processors/getConnectLinePoints\";\n\nexport interface SmartConnectLineComponentProps {\n transform: TransformLiteral;\n options: ComputedLineConnecterConf;\n}\n\nexport function SmartConnectLineComponent({\n transform,\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 fixedLineType = options.type === \"auto\" ? \"polyline\" : options.type;\n const points = getConnectLinePoints(\n smartConnectLineState,\n connectLineTo,\n hoverState\n );\n return curveLine(\n points,\n fixedLineType === \"curve\" ? options.curveType : \"curveLinear\",\n 0,\n 1\n );\n }, [connectLineTo, hoverState, smartConnectLineState, options]);\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={options.showStartArrow ? options.$markerUrl : \"\"}\n markerEnd={options.showEndArrow ? options.$markerUrl : \"\"}\n />\n );\n}\n","import type { NodePosition, PositionTuple } from \"../../../diagram/interfaces\";\nimport type { HoverState } from \"../../../draw-canvas/HoverStateContext\";\nimport type { SmartConnectLineState } 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): 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 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 exitPosition: smartConnectLineState.exitPosition,\n }\n );\n}\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 = 36;\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_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;\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;\n\nexport const POINT_HELPER_RADIUS = 5;\n","import type {\n Cell,\n DecoratorCell,\n EdgeCell,\n InitialCell,\n InitialNodeCell,\n LayoutType,\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(cell: Cell): cell is DecoratorCell {\n return cell.type === \"decorator\";\n}\n\nexport function isInitialNodeCell(cell: InitialCell): cell is InitialNodeCell {\n return cell.type === \"node\";\n}\n\nexport function isEdgeCell(cell: Cell): cell is EdgeCell {\n return cell.type === \"edge\";\n}\n\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: Cell | MoveCellPayload\n): cell is DecoratorCell {\n return cell.type === \"decorator\" && cell.decorator === \"container\";\n}\n\nexport function isNoManualLayout(layout: LayoutType) {\n return ![\"manual\", undefined].includes(layout!);\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 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 type { ActiveTarget, Cell } from \"../interfaces\";\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 }: {\n cells: Cell[];\n activeTarget: ActiveTarget | null | undefined;\n }\n): KeyboardAction | undefined {\n const activeCells = cells.filter((cell) =>\n targetIsActive(cell, activeTarget)\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 { 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","import { Cell, DecoratorCell, NodeCell } from \"../interfaces\";\nimport { MoveCellPayload } from \"../reducers/interfaces\";\nimport { isContainerDecoratorCell, isNodeCell } from \"./asserts\";\n\nexport function handleNodeContainedChange(\n payloads: MoveCellPayload[],\n cells: Cell[],\n onContainerContainerChange?: (detail: MoveCellPayload[]) => void\n) {\n const nodeCells = cells.filter((c): c is NodeCell => isNodeCell(c));\n const containerIds = payloads\n .filter((p) => isContainerDecoratorCell(p))\n .map((v) => v.id);\n const nodePayloads = payloads.filter((p) => {\n const nodeCell = nodeCells.find((v) => v.id === p.id)!;\n const includeNodeFlag =\n nodeCell?.containerId && containerIds.includes(nodeCell.containerId);\n return isNodeCell(p) && !includeNodeFlag;\n });\n nodePayloads.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 const containerDecoratorCells = cells.filter(\n (cell): cell is DecoratorCell => isContainerDecoratorCell(cell)\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 = nodePayloads.filter((payload) => {\n const nodeCell = nodeCells.find((c) => c.id === payload.id);\n const containerId = nodeCell?.containerId;\n const containerCellId = payload.containerCell?.id;\n //过滤掉一直没有combo关系或者combo关系没有改变的\n return containerId !== containerCellId;\n });\n if (containedChanges.length > 0) {\n onContainerContainerChange?.(containedChanges);\n }\n return containedChanges;\n}\n","import type { SizeTuple } from \"../../diagram/interfaces\";\nimport type { Cell, InitialCell, NodeCell } from \"../interfaces\";\nimport { isInitialNodeCell } from \"./asserts\";\n\nexport function initializeCells(\n initialCells: InitialCell[] | undefined,\n {\n defaultNodeSize,\n }: {\n defaultNodeSize: SizeTuple;\n }\n): Cell[] {\n const originalCells = initialCells ?? [];\n const finalCells: Cell[] = originalCells.map<Cell>((cell) => {\n if (\n !isInitialNodeCell(cell) ||\n (cell.view?.width !== undefined && cell.view?.height !== undefined)\n ) {\n return cell as NodeCell;\n }\n return {\n ...cell,\n view: {\n width: defaultNodeSize[0],\n height: defaultNodeSize[1],\n ...cell.view,\n },\n } as NodeCell;\n });\n return finalCells;\n}\n","import type {\n ActiveTarget,\n ActiveTargetOfEdge,\n 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 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 type { TransformLiteral } from \"../../diagram/interfaces\";\nimport type { Cell } from \"../interfaces\";\nimport { isEdgeCell } from \"./asserts\";\n\nexport interface TransformToCenterOptions {\n canvasWidth: number;\n canvasHeight: number;\n scaleRange?: [min: number, max: number];\n}\n\nexport function transformToCenter(\n cells: Cell[],\n { canvasWidth, canvasHeight, scaleRange }: TransformToCenterOptions\n): TransformLiteral {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n let empty = true;\n for (const cell of cells) {\n if (!isEdgeCell(cell)) {\n empty = false;\n const { view } = cell;\n const r = view.x + view.width;\n const b = view.y + view.height;\n if (view.x < left) {\n left = view.x;\n }\n if (r > right) {\n right = r;\n }\n if (view.y < top) {\n top = view.y;\n }\n if (b > bottom) {\n bottom = b;\n }\n }\n }\n\n const width = right - left;\n const height = bottom - top;\n\n const scale =\n scaleRange && !empty && (width > canvasWidth || height > canvasHeight)\n ? Math.max(\n Math.min(canvasWidth / width, canvasHeight / height, scaleRange[1]),\n scaleRange[0]\n )\n : 1;\n\n const x = empty ? 0 : (canvasWidth - width * scale) / 2 - left * scale;\n const y = empty ? 0 : (canvasHeight - height * scale) / 2 - top * scale;\n\n return { x, y, k: scale };\n}\n","import { without } from \"lodash\";\nimport type {\n RangeTuple,\n SizeTuple,\n TransformLiteral,\n} from \"../../diagram/interfaces\";\nimport { DEFAULT_NODE_GAP, SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\nimport type {\n Cell,\n InitialCell,\n LayoutType,\n NodeCell,\n NodeId,\n NodeView,\n} from \"../interfaces\";\nimport { isDecoratorCell, isEdgeCell, isNodeCell } 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\";\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 allowEdgeToArea,\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 allowEdgeToArea?: boolean;\n}): {\n cells: Cell[];\n updated: Cell[];\n shouldReCenter: boolean;\n} {\n const isManualLayout = layout !== \"force\" && layout !== \"dagre\";\n const newCells = initializeCells(cells, { defaultNodeSize });\n const updateCandidates: NodeCell[] = [];\n let shouldReCenter = false;\n\n const previousSizeInitializedNodes = new Map<string, NodeCell>();\n let previousShouldCentered = false;\n for (const cell of previousCells) {\n if (isDecoratorCell(cell)) {\n previousShouldCentered = true;\n } else if (isNodeCell(cell)) {\n previousShouldCentered = true;\n if (cell[SYMBOL_FOR_SIZE_INITIALIZED]) {\n previousSizeInitializedNodes.set(cell.id, cell);\n }\n }\n }\n\n const nodesMap = new Map<string, NodeCell>();\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n nodesMap.set(cell.id, cell);\n const previousNode = previousSizeInitializedNodes.get(cell.id);\n if (previousNode) {\n cell.view.width = previousNode.view.width;\n cell.view.height = previousNode.view.height;\n cell[SYMBOL_FOR_SIZE_INITIALIZED] = true;\n }\n }\n }\n\n let handled = false;\n\n if (reason === \"add-related-nodes\" && parent) {\n // Place these unpositioned downstream nodes below the parent node, and\n // on the right side of the positioned siblings.\n const downstreamNodeIds = new Set<string>();\n for (const cell of newCells) {\n if (\n isEdgeCell(cell) &&\n cell.source === parent &&\n cell.target !== parent\n ) {\n downstreamNodeIds.add(cell.target);\n }\n }\n const parentNode = nodesMap.get(parent);\n if (parentNode?.view.x !== undefined && parentNode.view.y !== undefined) {\n handled = true;\n /**\n * 临时解决一次性添加多层的节点手工布局报错\n */\n if (isManualLayout) {\n for (const cell of newCells) {\n if (\n (isNodeCell(cell) && cell.view.x === undefined) ||\n (isNodeCell(cell) && cell.view.y === undefined)\n ) {\n downstreamNodeIds.add(cell.id);\n }\n }\n }\n const downstreamNodes = [...downstreamNodeIds]\n .map((id) => nodesMap.get(id))\n .filter(Boolean) as NodeCell[];\n let rightMostNode: NodeCell | undefined = undefined;\n for (const node of downstreamNodes) {\n if (node.view.x !== undefined && node.view.y !== undefined) {\n // Find the rightmost node that is below the parent node.\n if (\n (!rightMostNode || node.view.x > rightMostNode.view.x) &&\n node.view.y > parentNode.view.y\n ) {\n rightMostNode = node;\n }\n } else {\n // Unpositioned nodes\n updateCandidates.push(node);\n }\n }\n if (updateCandidates.length > 0 && isManualLayout) {\n let nextX: number;\n let nextY: number;\n if (rightMostNode) {\n // Place unpositioned nodes on the right side of the rightmost positioned siblings.\n nextX =\n rightMostNode.view.x + rightMostNode.view.width + DEFAULT_NODE_GAP;\n nextY = rightMostNode.view.y;\n } else {\n // If there are no positioned siblings, just place them below the parent.\n const totalWidth = updateCandidates.reduce(\n (acc, node) => acc + node.view.width + DEFAULT_NODE_GAP,\n -DEFAULT_NODE_GAP\n );\n nextX =\n parentNode.view.x - totalWidth / 2 + parentNode.view.width / 2;\n nextY = parentNode.view.y + parentNode.view.height + DEFAULT_NODE_GAP;\n }\n for (const node of updateCandidates) {\n node.view.x = nextX;\n node.view.y = nextY;\n nextX += node.view.width + DEFAULT_NODE_GAP;\n }\n }\n }\n }\n\n if (!handled) {\n // By default, place unpositioned nodes in a grid.\n let maxWidth = defaultNodeSize[0];\n let maxHeight = defaultNodeSize[1];\n const positionedNodes: NodeCell[] = [];\n let hasDecorators = false;\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n if (cell.view.width > maxWidth) {\n maxWidth = cell.view.width;\n }\n if (cell.view.height > maxHeight) {\n maxHeight = cell.view.height;\n }\n if (cell.view.x === undefined || cell.view.y === undefined) {\n updateCandidates.push(cell);\n } else {\n positionedNodes.push(cell);\n }\n } else if (isDecoratorCell(cell)) {\n hasDecorators = true;\n }\n }\n\n if (isManualLayout) {\n if (!previousShouldCentered) {\n // If the previous cells are not centered, use the centered transform instead.\n transform = transformToCenter(without(newCells, ...updateCandidates), {\n canvasWidth,\n canvasHeight,\n scaleRange,\n });\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n\n // If there is no positioned nodes, or only one while without decorators,\n // then there is no relative positions, we can place the nodes with dagre layout.\n // Otherwise, use the force layout.\n if (\n positionedNodes.length === 0 ||\n (positionedNodes.length === 1 && !hasDecorators)\n ) {\n // The positioned node (if exists) will be updated.\n updateCandidates.push(...positionedNodes);\n ({ getNodeView } = dagreLayout({ cells: newCells, allowEdgeToArea }));\n // Only re-center when there is no cells previous,\n // or the cell ids are not changed (this happens when updateCells called by backend right after dropNode).\n shouldReCenter =\n previousCells.length === 0 ||\n (previousCells.length === newCells.length &&\n previousCells.every((cell, index) =>\n sameTarget(cell, newCells[index])\n ));\n } else {\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 for (const cell of newCells) {\n if (isNodeCell(cell)) {\n const view = getNodeView(cell.id);\n cell.view.x = view.x;\n cell.view.y = view.y;\n }\n }\n }\n }\n\n return { cells: newCells, updated: updateCandidates, shouldReCenter };\n}\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\nimport type { Cell, EdgeCell, NodeCell } from \"../interfaces\";\nimport { isNodeCell } from \"../processors/asserts\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\n\nexport const cells: Reducer<Cell[], DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"drop-node\":\n return insertCellAfter(\n state,\n action.payload,\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n );\n case \"drop-decorator\": {\n if (action.payload.decorator === \"text\") {\n return [...state, action.payload];\n }\n return insertCellAfter(\n state,\n action.payload,\n (cell) => cell.type === \"decorator\" && cell.decorator === \"area\"\n );\n }\n case \"add-nodes\": {\n const index =\n state.findLastIndex(\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n ) + 1;\n return [\n ...state.slice(0, index),\n ...action.payload,\n ...state.slice(index),\n ];\n }\n case \"add-edge\": {\n 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 insertCellAfter(\n state,\n action.payload,\n (cell) =>\n cell.type === \"edge\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\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: {\n ...(state[existedEdgeIndex] as EdgeCell).view,\n ...action.payload.view,\n },\n },\n ...state.slice(existedEdgeIndex + 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: { ...(cell as NodeCell).view, x: newCell.x, y: newCell.y },\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 insertCellAfter(\n cells: Cell[],\n newCell: Cell,\n after: (cell: Cell) => boolean\n) {\n const index = cells.findLastIndex(after) + 1;\n return [...cells.slice(0, index), newCell, ...cells.slice(index)];\n}\n","import { Reducer } from \"react\";\nimport type { DrawCanvasAction, DrawCanvasState } from \"./interfaces\";\nimport { cells } from \"./cells\";\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 * 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 { 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 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 ) {\n graph.setNode(cell.id, {\n id: cell.id,\n width: cell.view.width + nodePaddings[1] + nodePaddings[3],\n height: cell.view.height + 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 {\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","import { pull } from \"lodash\";\nimport type { NodePosition } from \"../../../diagram/interfaces\";\nimport { getConnectPointsOfRectangleWithDirection } from \"../shapes/Rectangle\";\nimport type { EdgeView, NodeView } from \"../../../draw-canvas/interfaces\";\nimport { getPolyLinePoints } from \"../../../diagram/lines/getPolyLinePoints\";\nimport { nodeViewToNodeRect } from \"./nodeViewToNodeRect\";\nimport { DEFAULT_NODE_PADDING_FOR_SMART_LINES } from \"../../../draw-canvas/constants\";\n\nconst DEFAULT_DIRECTIONS = [\"right\", \"top\", \"left\", \"bottom\"] as const;\n\nexport function getSmartLinePoints(\n sourceView: NodeView,\n targetView: NodeView,\n view: EdgeView\n): NodePosition[] {\n const connectPoints = getConnectPointsOfRectangleWithDirection();\n\n const exitPosition =\n view.exitPosition ?? getDefaultPosition(targetView, sourceView);\n const entryPosition =\n view.entryPosition ?? getDefaultPosition(sourceView, targetView);\n\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 const padding = DEFAULT_NODE_PADDING_FOR_SMART_LINES;\n const halfPadding = padding / 2;\n\n const sourceX =\n sourceView.x - halfPadding + exitPosition.x * (sourceView.width + padding);\n const sourceY =\n sourceView.y - halfPadding + exitPosition.y * (sourceView.height + padding);\n const targetX =\n targetView.x - halfPadding + entryPosition.x * (targetView.width + padding);\n const targetY =\n targetView.y -\n halfPadding +\n entryPosition.y * (targetView.height + padding);\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, padding),\n nodeViewToNodeRect(targetView, padding),\n sourceDirection,\n targetDirection,\n sourcePosition,\n targetPosition\n );\n}\n\nexport function 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","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 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 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 cellsRef: React.RefObject<SVGGElement>;\n activeTarget?: ActiveTarget | null;\n onActiveTargetChange(target: ActiveTarget | null): void;\n}\n\nexport type UseActiveTargetResult = ActiveTarget | null;\n\nexport function useActiveTarget({\n cellsRef,\n activeTarget: _activeTarget,\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 cellsContainerIndex = path.indexOf(cellsRef.current!);\n // Reset active target to null when clicking outside of the cells container,\n // Or inside the cells container but not on any cell.\n if (cellsContainerIndex <= 0) {\n setActiveTarget(null);\n }\n };\n document.addEventListener(\"click\", resetActiveTarget);\n return () => {\n document.removeEventListener(\"click\", resetActiveTarget);\n };\n }, [activeTarget, cellsRef]);\n\n return activeTarget;\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} 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 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 dispatch: (value: DrawCanvasAction) => void;\n}\n\nexport function useLayout({\n layout,\n layoutOptions,\n rootRef,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n layoutKey,\n allowEdgeToArea,\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 });\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 }, [cells, dispatch, layout, layoutKey, layoutOptions /* , setCentered */]);\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 { RangeTuple } from \"../../diagram/interfaces\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../../draw-canvas/constants\";\nimport type { Cell } from \"../../draw-canvas/interfaces\";\nimport {\n isDecoratorCell,\n isNodeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport { transformToCenter } from \"../../draw-canvas/processors/transformToCenter\";\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}\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}: UseAutoCenterOptions): UseAutoCenterResult {\n const [centered, setCentered] = useState(false);\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 const { k, x, y } = transformToCenter(cells, {\n canvasWidth: root.clientWidth,\n canvasHeight: root.clientHeight,\n scaleRange: zoomable ? scaleRange : undefined,\n });\n // istanbul ignore next\n if (process.env.NODE_ENV !== \"test\") {\n // jsdom doesn't support svg baseVal yet.\n // https://github.com/jsdom/jsdom/issues/2531\n zoomer.transform(select(root), new ZoomTransform(k, x, y));\n }\n setCentered(true);\n }, [\n cells,\n centered,\n layoutInitialized,\n rootRef,\n scaleRange,\n zoomable,\n zoomer,\n ]);\n\n useEffect(() => {\n // Reset auto centering when nodes and decorators are all removed.\n if (!cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell))) {\n setCentered(false);\n }\n }, [cells]);\n\n return [centered, setCentered];\n}\n","import { useMemo } from \"react\";\nimport { __secret_internals, checkIfByTransform } from \"@next-core/runtime\";\nimport { findIndex, isUndefined, omitBy } from \"lodash\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n ComputedLineConnecterConf,\n EdgeCell,\n EdgeLineConf,\n LineConnecterConf,\n LineMarker,\n} from \"../../draw-canvas/interfaces\";\nimport { isEdgeCell } 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} from \"../../draw-canvas/constants\";\n\nexport interface UseLineMarkersOptions {\n cells: Cell[];\n defaultEdgeLines: EdgeLineConf[] | undefined;\n markerPrefix: string;\n lineConnector?: LineConnecterConf | boolean;\n}\n\nexport function useLineMarkers({\n cells,\n defaultEdgeLines,\n markerPrefix,\n lineConnector,\n}: UseLineMarkersOptions): {\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n lineConnectorConf: ComputedLineConnecterConf | null;\n markers: LineMarker[];\n} {\n return useMemo(() => {\n // Always put the default stroke marker at the first position,\n // since the connecting line will use it.\n const markers: LineMarker[] = [{ strokeColor: DEFAULT_LINE_STROKE_COLOR }];\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 markerIndex = addMarker(\n { strokeColor: lineConnectorConf.strokeColor },\n markers\n );\n lineConnectorConf.$markerUrl = `url(#${markerPrefix}${markerIndex})`;\n const editingMarkerIndex = addMarker(\n { strokeColor: lineConnectorConf.editingStrokeColor },\n markers\n );\n lineConnectorConf.$editingMarkerUrl = `url(#${markerPrefix}${editingMarkerIndex})`;\n }\n\n const map = new WeakMap<EdgeCell, ComputedEdgeLineConf>();\n for (const cell of cells) {\n if (isEdgeCell(cell)) {\n const computedLineConf =\n __secret_internals.legacyDoTransform(\n { edge: cell },\n defaultEdgeLines?.find((item) =>\n checkIfByTransform(item, { edge: cell })\n )\n ) ?? {};\n const 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 const markerIndex = addMarker(\n { strokeColor: lineConf.strokeColor },\n markers\n );\n lineConf.$markerUrl = `url(#${markerPrefix}${markerIndex})`;\n map.set(cell, lineConf);\n }\n }\n return { lineConfMap: map, lineConnectorConf, markers };\n }, [cells, defaultEdgeLines, lineConnector, markerPrefix]);\n}\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() {\n return {\n type: \"auto\",\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 };\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 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\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(() => zoom<SVGSVGElement, unknown>(), []);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n let moved = false;\n zoomer\n .scaleExtent(zoomable ? scaleRange : [1, 1])\n .on(\"start\", () => {\n moved = false;\n setGrabbing(true);\n })\n .on(\"zoom\", (e: { transform: TransformLiteral }) => {\n moved = true;\n setTransform(e.transform);\n })\n .on(\"end\", () => {\n setGrabbing(false);\n if (!moved) {\n onSwitchActiveTarget?.(null);\n }\n })\n .filter(\n (event) =>\n (event.type === \"wheel\" ||\n (ctrlDraggable ? draggable || event.ctrlKey : !event.ctrlKey)) &&\n !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) {\n // Stop immediate propagation for default d3 zoom handler\n e.stopImmediatePropagation();\n if (scrollable) {\n e.preventDefault();\n zoomer.translateBy(\n rootSelection,\n e.wheelDeltaX / 5,\n e.wheelDeltaY / 5\n );\n }\n }\n // zoomer.scaleBy(rootSelection, Math.pow(2, defaultWheelDelta(e)))\n }\n );\n }\n\n rootSelection\n .call(zoomer)\n .on(\"wheel\", (e: WheelEvent) => {\n e.preventDefault();\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","// 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-inline:5px}.zoom-slider .ant-slider-vertical .ant-slider-rail{width:2px}.zoom-slider .ant-slider-vertical .ant-slider-handle{width:6px;height:6px;inset-inline-start: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;inset-inline-start:-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;inset-block-start:0;inset-inline-start:0}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\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-dashoffset:96;--dasharray:4}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}@keyframes dashedAnimation{0%{stroke-dashoffset:var(--stroke-dashoffset)}to{stroke-dashoffset:0}}@keyframes solidAnimation{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}.decorator-area .area,\n.decorator-container .container{fill:rgba(119,141,195,0.1);stroke:none;stroke-width:0}.node,\n.decorator-text{overflow:visible}.cell.active .decorator-area .area,\n.cell.active .decorator-container .container,\n.cell:not(.read-only) .decorator-container .container:hover,\n.allowEdgeToArea .decorator-area .area:hover,\n.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:var(--dasharray);stroke-width:1}.container-active .decorator-container .container{stroke:var(--palette-blue-5);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}.cell.active .decorator-area .resize-handle,\n.decorator-area: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)}.cell.active .decorator-text .text-container{outline:1px dashed var(--palette-blue-5)}.decorator-text .text-container{width:max-content;padding:0.5em}.decorator-text .text:focus{outline:none}.cell.faded{opacity:0.3}.cell.container-active{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;background-color:rgba(119,141,195,0.6);overflow:hidden}.decorator-container .horizontal{height:max-content;width:100%}:is(.decorator-container .horizontal) .text{min-height:var(--defaultSize)}.decorator-container .vertical{width:max-content;height:100%;writing-mode:vertical-lr;text-orientation:upright;letter-spacing:4px}:is(.decorator-container .vertical) .text{min-width:var(--defaultSize)}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n"],"names":["findNodeOrAreaDecorator","cells","id","find","cell","isNodeOrAreaDecoratorCell","EdgeComponent","_ref","_pathRef$current","_pathRef$current$getT","edge","lineConfMap","active","setActiveEditableLine","useHoverStateContext","pathRef","useRef","sourceNode","useMemo","source","targetNode","target","lineConf","get","parallelGap","some","_edge$view","_edge$view2","isEdgeCell","view","exitPosition","entryPosition","linePoints","_edge$view3","_edge$view4","_edge$view5","_edge$view6","directLinePadding","DEFAULT_NODE_PADDING_FOR_LINES","x","getSmartLinePoints","getDirectLinePoints","nodeViewToNodeRect","line","fixedLineType","type","curveLine","curveType","useEffect","prev","_edge$view7","_edge$view8","endPoints","length","React","d","fill","stroke","strokeWidth","interactStrokeWidth","ref","className","classNames","dashed","animate","useAnimate","style","duration","DEFAULT_LINE_INTERACT_ANIMATE_DURATION","current","getTotalLength","call","strokeColor","markerStart","showStartArrow","$markerUrl","markerEnd","showEndArrow","NodeComponent","node","degraded","degradedNodeLabel","defaultNodeBricks","onResize","memoizedData","value","memoizedValue","setMemoizedValue","useState","isEqual","useDeepMemo","data","specifiedUseBrick","useBrick","observerRef","_defaultNodeBricks$fi","item","checkIfByTransform","label","String","__secret_internals","legacyDoTransform","refCallback","useCallback","element","prevObserver","disconnect","setTimeout","observer","ResizeObserver","offsetWidth","offsetHeight","observe","degradedRefCallBack","g","size","getBBox","width","height","ReactUseBrick","cx","cy","r","y","handleMouseDown","event","action","scale","layout","layoutOptions","activeTarget","onCellsMoving","onCellsMoved","onCellResizing","onCellResized","onSwitchActiveTarget","stopPropagation","targetIsActive","cellToTarget","isAutoLayout","activeCells","actives","filter","c","forEach","a","push","isContainerDecoratorCell","isNodeCell","containerId","includes","movableActiveCells","isDecoratorCell","snap","intermediateSnap","grid","object","snapToGrid","snapToObject","DEFAULT_SNAP_GRID_SIZE","distance","DEFAULT_SNAP_OBJECT_DISTANCE","normalizeSnapOptions","from","clientX","clientY","originals","map","position","center","getCenterPosition","firstOriginalPosition","previousPositions","_ref2","snapToObjectTargets","objectCells","moved","handleMove","e","finished","movement","getMovement","newPositions","xAlign","yAlign","xAlignCell","yAlignCell","altKey","_ref3","diffX","Infinity","diffY","snapMovement","snapToObjectDistance","xAlignFrom","yAlignFrom","xAlignTarget","yAlignTarget","xAlignToY","yAlignToX","dX","Math","abs","dY","ySnapped","halfHeight","halfWidth","snapToGridSize","firstNewPosition","round","snapToGridMovement","snapToGridDiffX","snapToGridDiffY","undefined","_ref4","_ref6","payloads","_ref5","index","decorator","guideLines","_ref7","onMouseMove","onMouseUp","document","removeEventListener","addEventListener","DecoratorArea","transform","readOnly","resizeHandleRef","resizeHandle","onMouseDown","k","DecoratorText","onDecoratorTextEditing","onDecoratorTextChange","text","currentLabel","setCurrentLabel","editingLabel","setEditingLabel","editingLabelInitialized","shouldEmitLabelChange","setShouldEmitLabelChange","handleEnableEdit","preventDefault","textContent","_ref$current","parentElement","clientWidth","clientHeight","focus","selectAllText","editing","handleInput","handleBlur","onDoubleClick","contentEditable","onInput","onBlur","range","createRange","selectNodeContents","selection","window","getSelection","removeAllRanges","addRange","DecoratorContainer","direction","textRef","recomputation","setRecomputation","titleForeignRect","setTitleForeignRect","uuidV4","_textRef$current","textParentEle","rect","isNoManualLayout","DecoratorComponent","SpecifiedComponent","console","error","computeContainerRect","minX","minY","maxX","maxY","n","isFinite","padding","CellComponent","dragNodeToContainerActive","unrelatedCells","allowEdgeToArea","onCellContextMenu","onCellClick","onNodeBrickResize","onCellMouseEnter","onCellMouseLeave","lineEditorState","smartConnectLineState","setSmartConnectLineState","onConnect","setLineEditorState","onChangeEdgeEndpoints","gRef","unrelated","sameTarget","containerRect","containCells","isEdgeSide","isEntry","handleContextMenu","handleCellClick","handleMouseEnter","handleMouseLeave","faded","onContextMenu","onClick","onMouseEnter","onMouseLeave","ConnectLineComponent","connectLineState","connectLineTo","setConnectLineTo","offset","reset","capture","connecting","join","EditingLineComponent","options","hoverState","points","activePointIndex","relativePoints","x1","y1","getEditingLinePoints","editingStrokeColor","$editingMarkerUrl","HoverStateContext","rootRef","unsetHoverStateTimeoutRef","activeEditableLine","setHoverState","HELPER_IMAGE","HELPER_RADIUS","HELPER_BG_RADIUS","HALF_HELPER_RADIUS","LineConnectorComponent","disabled","unsetTimeout","clearTimeout","unsetActivePointIndex","unsetHoverState","available","targets","hasActiveEdge","transformedPoints","p","DEFAULT_NODE_PADDING_FOR_SMART_LINES","halfPadding","pointerEvents","fillOpacity","point","ConnectPointComponent","key","getBoundingClientRect","originalPoint","left","top","handleMouseUp","xlinkHref","preserveAspectRatio","POINT_HELPER_IMAGE","POINT_HELPER_BG_SIZE","LineEditorComponent","exitRef","entryRef","exit","entry","handleMouseDownFactory","handleStartMouseDown","handleEndMouseDown","commonProps","cursor","exitPoint","entryPoint","_extends","SmartConnectLineComponent","sourceView","getConnectLinePoints","SYMBOL_FOR_SIZE_INITIALIZED","Symbol","for","SYMBOL_FOR_LAYOUT_INITIALIZED","DEFAULT_NODE_SIZE","DEFAULT_NODE_GAP","DEFAULT_AREA_WIDTH","DEFAULT_AREA_HEIGHT","DEFAULT_SCALE_RANGE_MIN","DEFAULT_SCALE_RANGE_MAX","DEFAULT_LINE_STROKE_COLOR","DEFAULT_LINE_STROKE_WIDTH","DEFAULT_LINE_INTERACT_STROKE_WIDTH","DEFAULT_LINE_INTERACT_SHOW_START_ARROW","DEFAULT_LINE_INTERACT_SHOW_END_ARROW","DEFAULT_DEGRADED_THRESHOLD","isInitialNodeCell","isNodeOrEdgeCell","isTextDecoratorCell","pick","getUnrelatedCells","existedTargets","Set","add","has","nodesMap","Map","activeNodeIds","relatedNodeIds","set","handleKeyboard","keyCode","which","handleLasso","onLassoing","onLassoed","ctrlKey","button","x0","y0","handleNodeContainedChange","onContainerContainerChange","nodeCells","containerIds","v","nodePayloads","nodeCell","includeNodeFlag","payload","right","bottom","containerDecoratorCells","containerCell","containerLeft","containerRight","containerTop","containerBottom","containedChanges","_payload$containerCel","initializeCells","initialCells","defaultNodeSize","_cell$view","_cell$view2","b","every","targetA","targetB","transformToCenter","canvasWidth","canvasHeight","scaleRange","empty","max","min","updateCells","previousCells","reason","parent","isManualLayout","newCells","updateCandidates","shouldReCenter","previousSizeInitializedNodes","previousShouldCentered","previousNode","handled","downstreamNodeIds","parentNode","downstreamNodes","Boolean","rightMostNode","nextX","nextY","totalWidth","reduce","acc","maxWidth","maxHeight","positionedNodes","hasDecorators","getNodeView","without","dagreLayout","forceLayout","fixedPosition","updated","insertCellAfter","newCell","after","findLastIndex","slice","rootReducer","reducers","state","existedEdgeIndex","findIndex","matched","newState","move","layoutKey","Object","fromEntries","entries","props","xmlns","viewBox","ZoomBarComponent","shadowRoot","onZoomChange","onReCenter","currentTheme","useCurrentTheme","cache","createCache","zoomBarRef","tooltip","formatter","placement","getPopupContainer","onZoomIn","onZoomOut","ConfigProvider","theme","algorithm","darkAlgorithm","defaultAlgorithm","StyleProvider","container","autoClear","hashPriority","role","CenterSVG","ZoomInSVG","Slider","step","vertical","included","onChange","ZoomOutSVG","nodePadding","dagreGraphOptions","rankdir","ranksep","edgesep","nodesep","nodePaddings","extractPartialRectTuple","graph","dagre","Graph","setGraph","setDefaultEdgeLabel","setNode","setEdge","collide","radiusDiff","strength","iterations","forceNodes","forceLinks","fx","fy","linkSimulation","forceLink","simulation","forceSimulation","force","forceX","forceY","forceManyBody","forceCollide","radius","sqrt","stop","tick","ceil","log","alphaMin","alphaDecay","manuallyTickToTheEnd","DEFAULT_DIRECTIONS","targetView","_connectPoints$find","_connectPoints$find2","connectPoints","getConnectPointsOfRectangleWithDirection","getDefaultPosition","originalSourceDirections","originalTargetDirections","sourceDirections","targetDirections","sourceX","sourceY","targetX","targetY","pull","sourceDirection","targetDirection","sourcePosition","targetPosition","getPolyLinePoints","RectangleRelativeConnectPointsWithDirection","RectangleRelativeConnectPoints","getConnectPointsOfRectangle","useActiveTarget","cellsRef","_activeTarget","onActiveTargetChange","newActiveTarget","setActiveTarget","previous","activeTargetChangeInitialized","resetActiveTarget","composedPath","indexOf","KeywordMap","normalizeAlignAxis","axis","newX","matches","match","Number","useLayout","zoomable","zoomer","dispatch","layoutInitialized","setLayoutInitialized","layoutKeyRef","getNextLayoutKey","centered","setCentered","root","select","ZoomTransform","useAutoCenter","previousLayoutRef","i","alignOrigin","origin","normalizeAlignOrigin","nodeView","useLineMarkers","defaultEdgeLines","markerPrefix","lineConnector","markers","lineConnectorConf","getDefaultLineConf","omitBy","isUndefined","markerIndex","addMarker","editingMarkerIndex","WeakMap","computedLineConf","marker","useReady","useZoom","scrollable","pannable","draggable","ctrlDraggable","_scaleRange","grabbing","setGrabbing","setTransform","zoom","scaleExtent","on","rootSelection","unsetZoom","stopImmediatePropagation","translateBy","wheelDeltaX","wheelDeltaY","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
|