@next-bricks/diagram 0.46.2 → 0.47.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/4192.5903f562.js +2 -0
- package/dist/chunks/4192.5903f562.js.map +1 -0
- package/dist/chunks/6055.9858b4b9.js +2 -0
- package/dist/chunks/6055.9858b4b9.js.map +1 -0
- package/dist/chunks/9711.58afee04.js +2 -0
- package/dist/chunks/9711.58afee04.js.map +1 -0
- package/dist/chunks/eo-display-canvas.31ead79a.js +2 -0
- package/dist/chunks/eo-display-canvas.31ead79a.js.map +1 -0
- package/dist/chunks/{eo-draw-canvas.7ee23e06.js → eo-draw-canvas.a5b81b45.js} +2 -2
- package/dist/chunks/eo-draw-canvas.a5b81b45.js.map +1 -0
- package/dist/chunks/{main.2a2456a9.js → main.5593807b.js} +2 -2
- package/dist/chunks/{main.2a2456a9.js.map → main.5593807b.js.map} +1 -1
- package/dist/examples.json +3 -3
- package/dist/{index.7f471621.js → index.cccdafd2.js} +2 -2
- package/dist/{index.7f471621.js.map → index.cccdafd2.js.map} +1 -1
- package/dist/manifest.json +104 -104
- package/dist/types.json +4208 -4146
- package/dist-types/diagram/interfaces.d.ts +1 -1
- package/dist-types/draw-canvas/interfaces.d.ts +4 -1
- package/docs/eo-draw-canvas.md +2 -0
- package/package.json +2 -2
- package/dist/chunks/4192.d6afa672.js +0 -2
- package/dist/chunks/4192.d6afa672.js.map +0 -1
- package/dist/chunks/6055.c26f35cf.js +0 -2
- package/dist/chunks/6055.c26f35cf.js.map +0 -1
- package/dist/chunks/9711.b1a2a5bc.js +0 -2
- package/dist/chunks/9711.b1a2a5bc.js.map +0 -1
- package/dist/chunks/eo-display-canvas.162cc0f1.js +0 -2
- package/dist/chunks/eo-display-canvas.162cc0f1.js.map +0 -1
- package/dist/chunks/eo-draw-canvas.7ee23e06.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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ACxC,C,kEC9KIkQ,E,MAA0B,GAA4B,KAE1DA,EAAwBzmB,KAAK,CAAC0mB,EAAO/uB,GAAI,86CAK2E,KAEpH,QAAe8uB,EAAwBE,U,kECTnCF,E,MAA0B,GAA4B,KAE1DA,EAAwBzmB,KAAK,CAAC0mB,EAAO/uB,GAAI,6pGAYmkB,KAE5mB,QAAe8uB,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/shared/canvas/processors/getEditingLinePoints.ts","webpack:///./src/draw-canvas/EditingLineComponent.tsx","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/nodeViewToNodeRect.ts","webpack:///./src/shared/canvas/processors/getSmartLinePoints.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 { isEdgeCell, isStraightType } from \"./processors/asserts\";\nimport { DEFAULT_LINE_INTERACT_ANIMATE_DURATION } from \"./constants\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\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 =\n isStraightType(edge.view?.type) &&\n cells.some(\n (cell) =>\n isEdgeCell(cell) &&\n cell.source === edge.target &&\n cell.target === edge.source &&\n isStraightType(cell.view?.type)\n );\n return hasOppositeEdge ? lineConf.parallelGap : 0;\n }, [cells, edge.source, edge.target, edge.view, lineConf.parallelGap]);\n\n const linePoints = useMemo(() => {\n const points =\n sourceNode &&\n targetNode &&\n sourceNode.view.x != null &&\n targetNode.view.x != null\n ? getSmartLinePoints(\n sourceNode.view,\n targetNode.view,\n edge.view,\n parallelGap\n )\n : null;\n return points;\n }, [edge.view, parallelGap, sourceNode, targetNode]);\n\n const line = useMemo(() => {\n const fixedLineType = 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 linePoints,\n lineType: lineConf.type,\n lineCurveType: lineConf.curveType,\n parallelGap,\n }\n : null\n : prev?.edge &&\n prev.edge.source === edge.source &&\n prev.edge.target === edge.target\n ? null\n : prev\n );\n }, [\n active,\n edge,\n lineConf.curveType,\n lineConf.type,\n linePoints,\n setActiveEditableLine,\n sourceNode,\n targetNode,\n parallelGap,\n ]);\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 dotted: lineConf.dotted,\n [`${lineConf.dashed ? \"dashed\" : lineConf.dotted ? \"dotted\" : \"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 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 isAutoLayout = layout === \"force\" || layout === \"dagre\";\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 onChangeEdgeView,\n } = useHoverStateContext();\n const gRef = useRef<SVGGElement>(null);\n const unrelated = useMemo(\n () => unrelatedCells.some((item) => sameTarget(item, cell)),\n [cell, unrelatedCells]\n );\n // `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 !(\n smartConnectLineState ||\n (lineEditorState && lineEditorState.type !== \"control\")\n )\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 {\n type,\n source,\n target,\n edge: { view },\n } = lineEditorState;\n\n const isEntry = type === \"entry\";\n if ((isEntry ? target : source) === cell) {\n if (isEntry) {\n onChangeEdgeView?.(source, target, {\n ...view,\n entryPosition: null,\n // ...(!view?.exitPosition ? { vertices: null } : {}),\n });\n } else {\n onChangeEdgeView?.(source, target, {\n ...view,\n exitPosition: null,\n // ...(!view?.entryPosition ? { vertices: null } : {}),\n });\n }\n }\n setLineEditorState(null);\n }\n };\n g.addEventListener(\"mouseup\", onMouseUp);\n return () => {\n g.removeEventListener(\"mouseup\", onMouseUp);\n };\n }, [\n allowEdgeToArea,\n cell,\n lineEditorState,\n onChangeEdgeView,\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 getConnectTo = (e: MouseEvent): PositionTuple => [\n (e.clientX - transform.x - connectLineState.offset[0]) / transform.k,\n (e.clientY - transform.y - connectLineState.offset[1]) / transform.k,\n ];\n const onMouseMove = (e: MouseEvent) => {\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo(getConnectTo(e));\n };\n const onMouseDown = (e: MouseEvent) => {\n e.stopPropagation();\n };\n const onClick = (e: MouseEvent) => {\n e.stopPropagation();\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n reset();\n onConnect(connectLineState, getConnectTo(e));\n };\n const reset = () => {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mousedown\", onMouseDown, {\n capture: true,\n });\n document.removeEventListener(\"click\", onClick, { capture: true });\n setConnectLineTo(null);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mousedown\", onMouseDown, { capture: true });\n document.addEventListener(\"click\", onClick, { capture: true });\n\n return reset;\n }\n }, [connectLineState, onConnect, transform]);\n\n return (\n <path\n className={classNames(\"connect-line\", {\n connecting:\n !!connectLineState &&\n connectLineTo &&\n // Do not show when the distance of mouse move is less than 5px\n (connectLineTo[0] - connectLineState.from[0]) ** 2 +\n (connectLineTo[1] - connectLineState.from[1]) ** 2 >\n 25,\n })}\n d={\n connectLineState && connectLineTo\n ? `M${connectLineState.from.join(\" \")}L${connectLineTo.join(\" \")}`\n : \"\"\n }\n fill=\"none\"\n stroke=\"gray\"\n strokeWidth={1}\n markerEnd={`url(#${markerEnd})`}\n />\n );\n}\n","import { pick } from \"lodash\";\nimport type { NodePosition, PositionTuple } from \"../../../diagram/interfaces\";\nimport type { HoverState } from \"../../../draw-canvas/HoverStateContext\";\nimport type {\n LineEditorState,\n LineEditorStateOfControl,\n} from \"../../../draw-canvas/interfaces\";\nimport { getSmartLinePoints, simplifyVertices } 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 !(\n connectLineTo ||\n (lineEditorState.type !== \"control\" &&\n hoverState?.activePointIndex !== undefined)\n )\n ) {\n return null;\n }\n\n const {\n type,\n source,\n target,\n edge: { view },\n } = lineEditorState;\n const { exitPosition, entryPosition, vertices } = view ?? {};\n\n const lineSettings = pick(view, [\"type\", \"curveType\"]);\n\n if (type === \"control\") {\n const newVertices = getNewLineVertices(lineEditorState, connectLineTo!);\n\n return getSmartLinePoints(source.view, target.view, {\n ...lineSettings,\n exitPosition,\n entryPosition,\n vertices: newVertices,\n });\n }\n\n if (hoverState?.activePointIndex !== undefined) {\n const position = hoverState.relativePoints[hoverState.activePointIndex];\n // Assert `hoverState.cell` is `target`\n return getSmartLinePoints(source.view, target.view, {\n ...lineSettings,\n ...(type === \"entry\"\n ? {\n exitPosition,\n entryPosition: position,\n }\n : {\n exitPosition: position,\n entryPosition,\n }),\n vertices,\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 { ...lineSettings, exitPosition, vertices }\n );\n }\n\n return getSmartLinePoints(\n { x: x1, y: y1, width: 0, height: 0 },\n target.view,\n { ...lineSettings, entryPosition, vertices }\n );\n}\n\nexport function getNewLineVertices(\n lineEditorState: LineEditorStateOfControl,\n connectLineTo: PositionTuple\n) {\n const { control, linePoints } = lineEditorState;\n const newVertices: NodePosition[] = [];\n const [x1, y1] = connectLineTo!;\n const exitPoint = linePoints[0];\n const entryPoint = linePoints[linePoints.length - 1];\n\n // If moving the first control, prepend a vertex to connect the control to the source\n if (control.index === 0) {\n newVertices.push(\n control.direction === \"ns\"\n ? { x: exitPoint.x, y: y1 }\n : { x: x1, y: exitPoint.y }\n );\n }\n\n // Adjust the related two controls, and leave other controls unchanged\n for (let i = 1; i < linePoints.length - 1; i++) {\n const vertex = linePoints[i];\n newVertices.push(\n i === control.index || i === control.index + 1\n ? control.direction === \"ns\"\n ? { x: vertex.x, y: y1 }\n : { x: x1, y: vertex.y }\n : vertex\n );\n }\n\n // If moving the last control, append a vertex to connect the control to the target\n if (control.index === linePoints.length - 2) {\n newVertices.push(\n control.direction === \"ns\"\n ? { x: entryPoint.x, y: y1 }\n : { x: x1, y: entryPoint.y }\n );\n }\n\n return simplifyVertices(exitPoint, newVertices, entryPoint);\n}\n","// istanbul ignore file: experimental\nimport React, { useEffect, useMemo, useRef, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type { ComputedLineConnecterConf } from \"./interfaces\";\nimport type {\n NodePosition,\n PositionTuple,\n TransformLiteral,\n} from \"../diagram/interfaces\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport {\n getEditingLinePoints,\n getNewLineVertices,\n} from \"../shared/canvas/processors/getEditingLinePoints\";\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 {\n activeEditableLine,\n hoverState,\n lineEditorState,\n setLineEditorState,\n onChangeEdgeView,\n } = useHoverStateContext();\n const movedRef = useRef(false);\n\n useEffect(() => {\n if (!lineEditorState) {\n setTimeout(() => {\n movedRef.current = false;\n }, 0);\n }\n }, [lineEditorState]);\n\n useEffect(() => {\n if (!lineEditorState) {\n return;\n }\n movedRef.current = false;\n const { type, offset, from } = lineEditorState;\n // Set connect line to based on the mouse position and the transform\n const getConnectTo = (e: MouseEvent): PositionTuple => {\n const position: NodePosition = {\n x: (e.clientX - transform.x - offset[0]) / transform.k,\n y: (e.clientY - transform.y - offset[1]) / transform.k,\n };\n let diff = Infinity;\n if (type === \"control\" && !e.altKey) {\n // Snap to other points\n const { linePoints, control } = lineEditorState;\n const axis = control.direction === \"ns\" ? \"y\" : \"x\";\n const original = control[axis];\n const otherPoints = linePoints.filter(\n (_, i) =>\n i === 0 ||\n i === linePoints.length - 1 ||\n (i !== control.index && i !== control.index + 1)\n );\n const snapDistance = 5;\n for (const point of otherPoints) {\n const newDiff = Math.abs(point[axis] - position[axis]);\n if (newDiff <= snapDistance && newDiff < diff) {\n position[axis] = point[axis];\n diff = newDiff;\n if (!movedRef.current && original !== position[axis]) {\n movedRef.current = true;\n }\n }\n }\n }\n if (diff === Infinity && !movedRef.current) {\n const movementX = (e.clientX - from[0]) / transform.k;\n const movementY = (e.clientY - from[1]) / transform.k;\n movedRef.current = movementX ** 2 + movementY ** 2 >= 9;\n }\n return [position.x, position.y];\n };\n const onMouseMove = (e: MouseEvent) => {\n const newConnectTo = getConnectTo(e);\n if (movedRef.current) {\n setConnectLineTo(newConnectTo);\n }\n };\n function onMouseUp(e: MouseEvent) {\n e.preventDefault();\n reset();\n if (lineEditorState?.type === \"control\") {\n const newConnectTo = getConnectTo(e);\n if (movedRef.current) {\n const {\n source,\n target,\n edge: { view },\n } = lineEditorState;\n onChangeEdgeView?.(source, target, {\n ...view,\n vertices: getNewLineVertices(lineEditorState, newConnectTo),\n });\n }\n }\n }\n function reset() {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n setConnectLineTo(null);\n setLineEditorState(null);\n }\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n\n return reset;\n }, [lineEditorState, transform, setLineEditorState, onChangeEdgeView]);\n\n useEffect(() => {\n if (!activeEditableLine) {\n return;\n }\n const handleBodyClick = (e: MouseEvent) => {\n if (movedRef.current) {\n e.stopPropagation();\n e.preventDefault();\n }\n };\n document.body.addEventListener(\"click\", handleBodyClick);\n return () => {\n document.body.removeEventListener(\"click\", handleBodyClick);\n };\n }, [activeEditableLine]);\n\n const line = useMemo(() => {\n const points = getEditingLinePoints(\n lineEditorState,\n connectLineTo,\n hoverState\n );\n return curveLine(\n points,\n lineEditorState?.edge.view?.type === \"curve\"\n ? lineEditorState.edge.view.curveType\n : \"curveLinear\",\n 0,\n 1\n );\n }, [connectLineTo, hoverState, lineEditorState]);\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","// istanbul ignore file: nothing logical to test\nimport React from \"react\";\nimport type {\n DecoratorCell,\n EdgeView,\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 onChangeEdgeView?: (\n source: NodeCell | DecoratorCell,\n target: NodeCell | DecoratorCell,\n view: EdgeView\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, useRef } from \"react\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport type { ActiveTarget, NodeCell } from \"./interfaces\";\nimport { targetIsActive } from \"./processors/targetIsActive\";\nimport type { NodePosition } 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 scale: number;\n disabled?: boolean;\n}\n\nexport function LineConnectorComponent({\n activeTarget,\n scale,\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 : lineEditorState.type === \"exit\" &&\n hoverState.cell === lineEditorState.source\n : !targetIsActive(hoverState.cell, activeTarget) &&\n !hasActiveEdge(activeTarget)));\n\n const padding = DEFAULT_NODE_PADDING_FOR_SMART_LINES;\n const halfPadding = padding / 2;\n\n return (\n <g onMouseEnter={unsetActivePointIndex} onMouseLeave={unsetHoverState}>\n {available && (\n <>\n <rect\n x={hoverState.cell.view.x - halfPadding}\n y={hoverState.cell.view.y - halfPadding}\n width={hoverState.cell.view.width + padding}\n height={hoverState.cell.view.height + padding}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={(HELPER_BG_RADIUS * 2) / scale}\n pointerEvents=\"stroke\"\n />\n {hoverState.activePointIndex !== undefined && (\n <circle\n cx={hoverState.points[hoverState.activePointIndex].x}\n cy={hoverState.points[hoverState.activePointIndex].y}\n r={HELPER_BG_RADIUS / scale}\n fill=\"lightgreen\"\n fillOpacity={0.5}\n pointerEvents=\"none\"\n />\n )}\n {hoverState.points.map((point, index) => (\n <ConnectPointComponent\n key={index}\n index={index}\n point={point}\n scale={scale}\n unsetActivePointIndex={unsetActivePointIndex}\n unsetTimeout={unsetTimeout}\n />\n ))}\n </>\n )}\n </g>\n );\n}\n\ninterface ConnectPointComponentProps {\n index: number;\n point: NodePosition;\n scale: number;\n unsetTimeout: () => void;\n unsetActivePointIndex: () => void;\n}\n\nfunction ConnectPointComponent({\n index,\n point,\n scale,\n unsetTimeout,\n unsetActivePointIndex,\n}: ConnectPointComponentProps): JSX.Element {\n const {\n rootRef,\n smartConnectLineState,\n hoverState,\n setHoverState,\n setSmartConnectLineState,\n onConnect,\n lineEditorState,\n setLineEditorState,\n onChangeEdgeView,\n } = useHoverStateContext();\n const ref = useRef<SVGGElement>(null);\n\n useEffect(() => {\n const g = ref.current;\n const handleMouseEnter = (e: MouseEvent) => {\n // There is a chance that mouseenter will not be triggered when the element is shown aync.\n // So we also listen to the mousemove event, but only once.\n if (e.type === \"mousemove\") {\n g?.removeEventListener(e.type, handleMouseEnter);\n }\n unsetTimeout();\n setHoverState((prev) =>\n prev && prev.activePointIndex !== index\n ? { ...hoverState!, activePointIndex: index }\n : prev\n );\n };\n g?.addEventListener(\"mouseenter\", handleMouseEnter);\n g?.addEventListener(\"mousemove\", handleMouseEnter);\n return () => {\n g?.removeEventListener(\"mouseenter\", handleMouseEnter);\n g?.removeEventListener(\"mousemove\", handleMouseEnter);\n };\n }, [hoverState, index, setHoverState, unsetTimeout]);\n\n useEffect(() => {\n if (lineEditorState) {\n return;\n }\n const handleMouseDown = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n const rect = rootRef.current!.getBoundingClientRect();\n const originalPoint = hoverState!.points[index];\n setSmartConnectLineState({\n source: hoverState!.cell as NodeCell,\n from: [originalPoint.x, originalPoint.y],\n offset: [rect.left, rect.top],\n exitPosition: hoverState!.relativePoints[index],\n });\n };\n const g = ref.current;\n g?.addEventListener(\"mousedown\", handleMouseDown);\n return () => {\n g?.removeEventListener(\"mousedown\", handleMouseDown);\n };\n }, [hoverState, index, lineEditorState, rootRef, setSmartConnectLineState]);\n\n useEffect(() => {\n const handleMouseUp = (e: MouseEvent) => {\n 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 const {\n type,\n source,\n target,\n edge: { view },\n } = lineEditorState;\n if (type === \"entry\") {\n onChangeEdgeView?.(source, target, {\n ...view,\n entryPosition: position,\n });\n } else {\n onChangeEdgeView?.(source, target, {\n ...view,\n exitPosition: position,\n });\n }\n setLineEditorState(null);\n }\n };\n const g = ref.current;\n g?.addEventListener(\"mouseup\", handleMouseUp);\n return () => {\n g?.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [\n smartConnectLineState,\n hoverState,\n onConnect,\n setSmartConnectLineState,\n lineEditorState,\n onChangeEdgeView,\n setLineEditorState,\n ]);\n\n return (\n <g ref={ref} onMouseLeave={unsetActivePointIndex}>\n <circle\n cx={point.x}\n cy={point.y}\n r={HELPER_BG_RADIUS}\n fill=\"transparent\"\n />\n <image\n x={point.x - HALF_HELPER_RADIUS / scale}\n y={point.y - HALF_HELPER_RADIUS / scale}\n width={HELPER_RADIUS / scale}\n height={HELPER_RADIUS / scale}\n xlinkHref={HELPER_IMAGE}\n preserveAspectRatio=\"none\"\n />\n </g>\n );\n}\n\nfunction hasActiveEdge(activeTarget: ActiveTarget | null) {\n return (\n activeTarget &&\n (activeTarget.type === \"edge\" ||\n (activeTarget.type === \"multi\" &&\n activeTarget.targets.some((target) => target.type === \"edge\")))\n );\n}\n","// istanbul ignore file: experimental\nimport React, { useEffect, useMemo, useRef } from \"react\";\nimport type { NodePosition } from \"../diagram/interfaces\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport type { ControlPoint } from \"./interfaces\";\nimport { isStraightType } from \"./processors/asserts\";\n\nconst POINT_HELPER_IMAGE =\n \"data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIyMnB4IiBoZWlnaHQ9IjIycHgiIHZlcnNpb249IjEuMSI+PGNpcmNsZSBjeD0iMTEiIGN5PSIxMSIgcj0iNyIgc3Ryb2tlPSIjZmZmIiBmaWxsPSIjMjliNmYyIi8+PGNpcmNsZSBjeD0iMTEiIGN5PSIxMSIgcj0iMyIgc3Ryb2tlPSIjZmZmIiBmaWxsPSJ0cmFuc3BhcmVudCIvPjwvc3ZnPg==\";\nconst ANCHORED_POINT_HELPER_IMAGE =\n \"data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIyMnB4IiBoZWlnaHQ9IjIycHgiIHZlcnNpb249IjEuMSI+PGNpcmNsZSBjeD0iMTEiIGN5PSIxMSIgcj0iNyIgc3Ryb2tlPSIjZmZmIiBmaWxsPSIjMDFiZDIyIi8+PHBhdGggZD0ibSA4IDggTCAxNCAxNE0gOCAxNCBMIDE0IDgiIHN0cm9rZT0iI2ZmZiIvPjwvc3ZnPg==\";\nconst VERTEX_HELPER_IMAGE =\n \"data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSIxOHB4IiBoZWlnaHQ9IjE4cHgiIHZlcnNpb249IjEuMSI+PGNpcmNsZSBjeD0iOSIgY3k9IjkiIHI9IjUiIHN0cm9rZT0iI2ZmZiIgZmlsbD0iIzI5YjZmMiIvPjwvc3ZnPg==\";\nconst POINT_HELPER_BG_SIZE = 22;\n\nexport interface LineEditorComponentProps {\n scale: number;\n}\n\nexport function LineEditorComponent({\n scale,\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 const controlPointsRef = 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 from: [e.clientX, e.clientY],\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 const controlPoints = useMemo(() => {\n return activeEditableLine &&\n !isStraightType(activeEditableLine.edge.view?.type)\n ? getControlPoints(activeEditableLine!.linePoints)\n : [];\n }, [activeEditableLine]);\n\n useEffect(() => {\n if (!activeEditableLine) {\n return;\n }\n const controlElements = controlPointsRef.current;\n const handleMouseDownFactory = (control: ControlPoint) => {\n return (e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n const rect = rootRef.current!.getBoundingClientRect();\n setLineEditorState({\n ...activeEditableLine!,\n offset: [rect.left, rect.top],\n from: [e.clientX, e.clientY],\n type: \"control\",\n control,\n });\n };\n };\n const handlers = controlPoints.map((control) =>\n handleMouseDownFactory(control)\n );\n controlElements.forEach((el, i) => {\n el?.addEventListener(\"mousedown\", handlers[i]);\n });\n return () => {\n controlElements.forEach((el, i) => {\n el?.removeEventListener(\"mousedown\", handlers[i]);\n });\n };\n }, [activeEditableLine, controlPoints, rootRef, setLineEditorState]);\n\n const gRef = useRef<SVGGElement>(null);\n useEffect(() => {\n const g = gRef.current;\n const onClick = (e: MouseEvent) => {\n e.stopPropagation();\n e.preventDefault();\n };\n g?.addEventListener(\"click\", onClick);\n return () => {\n g?.removeEventListener(\"click\", onClick);\n };\n }, []);\n\n if (!activeEditableLine) {\n return null;\n }\n const {\n linePoints,\n edge: { view },\n } = activeEditableLine;\n const { exitPosition, entryPosition } = view ?? {};\n\n const commonProps: React.SVGAttributes<SVGImageElement> = {\n width: POINT_HELPER_BG_SIZE / scale,\n height: POINT_HELPER_BG_SIZE / scale,\n preserveAspectRatio: \"none\",\n cursor: \"pointer\",\n pointerEvents: \"fill\",\n };\n const exitPoint = linePoints[0];\n const entryPoint = linePoints[linePoints.length - 1];\n const offset = POINT_HELPER_BG_SIZE / scale / 2;\n\n return (\n <g ref={gRef}>\n <image\n ref={exitRef}\n {...commonProps}\n x={exitPoint.x - offset}\n y={exitPoint.y - offset}\n xlinkHref={\n exitPosition ? ANCHORED_POINT_HELPER_IMAGE : POINT_HELPER_IMAGE\n }\n />\n {controlPoints.map((point, i) => (\n <image\n key={i}\n ref={(el) => {\n controlPointsRef.current[i] = el;\n }}\n {...commonProps}\n x={point.x - offset}\n y={point.y - offset}\n xlinkHref={VERTEX_HELPER_IMAGE}\n cursor={point.direction === \"ns\" ? \"row-resize\" : \"col-resize\"}\n />\n ))}\n <image\n ref={entryRef}\n {...commonProps}\n x={entryPoint.x - offset}\n y={entryPoint.y - offset}\n xlinkHref={\n entryPosition ? ANCHORED_POINT_HELPER_IMAGE : POINT_HELPER_IMAGE\n }\n />\n </g>\n );\n}\n\nfunction getControlPoints(linePoints: NodePosition[]): ControlPoint[] {\n const controlPoints: ControlPoint[] = [];\n let prev = linePoints[0];\n let cursor = 1;\n while (cursor < linePoints.length) {\n const next = linePoints[cursor];\n const ns = prev.y === next.y;\n const ew = prev.x === next.x;\n if (!(ns && ew)) {\n const direction = ns ? \"ns\" : \"ew\";\n controlPoints.push({\n direction,\n index: cursor - 1,\n x: (prev.x + next.x) / 2,\n y: (prev.y + next.y) / 2,\n });\n }\n prev = next;\n cursor++;\n }\n\n return controlPoints;\n}\n","// istanbul ignore file: experimental\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type { ComputedLineConnecterConf, LineSettings } 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 lineSettings?: LineSettings;\n options: ComputedLineConnecterConf;\n}\n\nexport function SmartConnectLineComponent({\n transform,\n lineSettings,\n options,\n}: SmartConnectLineComponentProps): JSX.Element {\n const [connectLineTo, setConnectLineTo] = useState<PositionTuple | null>(\n null\n );\n const { hoverState, smartConnectLineState, setSmartConnectLineState } =\n useHoverStateContext();\n\n useEffect(() => {\n if (!smartConnectLineState) {\n return;\n }\n function onMouseMove(e: MouseEvent) {\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo([\n (e.clientX - transform.x - smartConnectLineState!.offset[0]) /\n transform.k,\n (e.clientY - transform.y - smartConnectLineState!.offset[1]) /\n transform.k,\n ]);\n }\n function onMouseUp(e: MouseEvent) {\n e.preventDefault();\n reset();\n }\n function reset() {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n setConnectLineTo(null);\n setSmartConnectLineState(null);\n }\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n\n return reset;\n }, [setSmartConnectLineState, smartConnectLineState, transform]);\n\n const line = useMemo(() => {\n const points = getConnectLinePoints(\n smartConnectLineState,\n connectLineTo,\n hoverState,\n lineSettings\n );\n return curveLine(\n points,\n options.type === \"curve\" ? options.curveType : \"curveLinear\",\n 0,\n 1\n );\n }, [connectLineTo, hoverState, smartConnectLineState, options, lineSettings]);\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 {\n LineSettings,\n SmartConnectLineState,\n} from \"../../../draw-canvas/interfaces\";\nimport { getSmartLinePoints } from \"./getSmartLinePoints\";\n\nexport function getConnectLinePoints(\n smartConnectLineState: SmartConnectLineState | null,\n connectLineTo: PositionTuple | null,\n hoverState: HoverState | null,\n lineSettings?: LineSettings\n): NodePosition[] | null {\n if (\n !smartConnectLineState ||\n !(connectLineTo || hoverState?.activePointIndex !== undefined)\n ) {\n return null;\n }\n\n const sourceView = smartConnectLineState.source.view;\n if (hoverState?.activePointIndex !== undefined) {\n return getSmartLinePoints(sourceView, hoverState.cell.view, {\n ...lineSettings,\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: hoverState.relativePoints[hoverState.activePointIndex],\n });\n }\n\n const [x1, y1] = connectLineTo!;\n\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n {\n ...lineSettings,\n exitPosition: smartConnectLineState.exitPosition,\n }\n );\n}\n","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 LineType,\n NodeCell,\n} from \"../interfaces\";\nimport { MoveCellPayload } from \"../reducers/interfaces\";\n\nexport function isNodeCell(cell: Cell | MoveCellPayload): cell is NodeCell {\n return cell.type === \"node\";\n}\n\nexport function isDecoratorCell(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\nexport function isStraightType(type: LineType | undefined) {\n return !(type === \"polyline\" || type === \"curve\");\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 type { NodeRect } from \"../../../diagram/interfaces\";\nimport type { NodeView } from \"../../../draw-canvas/interfaces\";\n\nexport function nodeViewToNodeRect(view: NodeView, padding: number): NodeRect {\n return {\n x: view.x + view.width / 2,\n y: view.y + view.height / 2,\n width: view.width + padding,\n height: view.height + padding,\n };\n}\n","import { pull } from \"lodash\";\nimport type { NodePosition } from \"../../../diagram/interfaces\";\nimport { getConnectPointsOfRectangleWithDirection } from \"../shapes/Rectangle\";\nimport type {\n BiDirection,\n EdgeView,\n NodeView,\n} from \"../../../draw-canvas/interfaces\";\nimport { getPolyLinePoints } from \"../../../diagram/lines/getPolyLinePoints\";\nimport { nodeViewToNodeRect } from \"./nodeViewToNodeRect\";\nimport {\n DEFAULT_NODE_PADDING_FOR_LINES,\n DEFAULT_NODE_PADDING_FOR_SMART_LINES,\n} from \"../../../draw-canvas/constants\";\nimport { getDirectLinePoints } from \"../../../diagram/lines/getDirectLinePoints\";\nimport { isStraightType } from \"../../../draw-canvas/processors/asserts\";\n\nconst DEFAULT_DIRECTIONS = [\"right\", \"top\", \"left\", \"bottom\"] as const;\n\nexport function getSmartLinePoints(\n sourceView: NodeView,\n targetView: NodeView,\n edgeView: EdgeView | undefined,\n parallelGap?: number\n): NodePosition[] | null {\n const {\n type,\n vertices,\n exitPosition: originalExit,\n entryPosition: originalEntry,\n } = edgeView ?? {};\n\n if (isStraightType(type)) {\n return getDirectLinePoints(\n nodeViewToNodeRect(\n sourceView,\n originalExit\n ? DEFAULT_NODE_PADDING_FOR_SMART_LINES\n : DEFAULT_NODE_PADDING_FOR_LINES\n ),\n nodeViewToNodeRect(\n targetView,\n originalEntry\n ? DEFAULT_NODE_PADDING_FOR_SMART_LINES\n : DEFAULT_NODE_PADDING_FOR_LINES\n ),\n parallelGap,\n edgeView\n );\n }\n\n if (vertices?.length) {\n const firstVertex = vertices[0];\n const lastVertex = vertices[vertices.length - 1];\n\n let exitPoint: NodePosition;\n let entryPoint: NodePosition;\n let exitDirection: BiDirection | undefined;\n let entryDirection: BiDirection | undefined;\n\n // Auto decide the exit and entry position.\n if (originalExit) {\n exitPoint = getAbsolutePosition(sourceView, originalExit);\n } else {\n let possibleFirstNextPoint: NodePosition | undefined;\n if (vertices.length > 1) {\n // Decide exit point by the first two vertices.\n possibleFirstNextPoint = vertices[1];\n } else if (originalEntry) {\n // Decide exit point by the entry position.\n possibleFirstNextPoint = getAbsolutePosition(targetView, originalEntry);\n }\n if (possibleFirstNextPoint) {\n exitPoint = getDefaultAbsolutePosition(\n firstVertex,\n sourceView,\n firstVertex.y === possibleFirstNextPoint.y\n );\n } else {\n // No other vertices nor the entry position, decide exit point by the\n // relative position between the last vertex and the target node.\n const prefer =\n lastVertex.y < targetView.y ||\n lastVertex.y > targetView.y + targetView.height\n ? \"ns\"\n : \"ew\";\n ({ point: exitPoint, direction: exitDirection } =\n fitEndpointAndDirection(sourceView, targetView, vertices, prefer));\n }\n }\n\n if (originalEntry) {\n entryPoint = getAbsolutePosition(targetView, originalEntry);\n } else {\n let possibleLastPreviousPoint: NodePosition | undefined;\n if (vertices.length > 1) {\n // Decide entry point by the last two vertices.\n possibleLastPreviousPoint = vertices[vertices.length - 2];\n } else if (originalExit) {\n // Decide entry point by the exit position.\n possibleLastPreviousPoint = getAbsolutePosition(\n sourceView,\n originalExit\n );\n }\n if (possibleLastPreviousPoint) {\n entryPoint = getDefaultAbsolutePosition(\n lastVertex,\n targetView,\n lastVertex.y === possibleLastPreviousPoint.y\n );\n } else {\n // No other vertices nor the exit position, decide entry point by the\n // relative position between the first vertex and the source node.\n const prefer =\n firstVertex.x < sourceView.x ||\n firstVertex.x > sourceView.x + sourceView.width\n ? \"ew\"\n : \"ns\";\n ({ point: entryPoint, direction: entryDirection } =\n fitEndpointAndDirection(\n targetView,\n sourceView,\n vertices.slice().reverse(),\n prefer\n ));\n }\n }\n\n const { x: sourceX, y: sourceY } = exitPoint;\n const { x: targetX, y: targetY } = entryPoint;\n\n const newLinePoints = [exitPoint, ...vertices, entryPoint];\n\n const newVertices = [...vertices];\n\n // If the first vertex is not on any axis of the source exit point,\n // add a vertex to connect them.\n if (firstVertex && firstVertex.x !== sourceX && firstVertex.y !== sourceY) {\n newVertices.unshift(\n exitDirection === \"ns\"\n ? { x: sourceX, y: firstVertex.y }\n : exitDirection === \"ew\"\n ? { x: firstVertex.x, y: sourceY }\n : firstVertex.x === newLinePoints[2].x\n ? { x: sourceX, y: firstVertex.y }\n : { x: firstVertex.x, y: sourceY }\n );\n }\n\n // If the last vertex is not on any axis of the target entry point,\n // add a vertex to connect them.\n if (lastVertex && lastVertex.x !== targetX && lastVertex.y !== targetY) {\n newVertices.push(\n entryDirection === \"ns\"\n ? { x: targetX, y: lastVertex.y }\n : entryDirection === \"ew\"\n ? { x: lastVertex.x, y: targetY }\n : lastVertex.x === newLinePoints[newLinePoints.length - 3].x\n ? { x: targetX, y: lastVertex.y }\n : { x: lastVertex.x, y: targetY }\n );\n }\n\n return [\n exitPoint,\n ...simplifyVertices(exitPoint, newVertices, entryPoint),\n entryPoint,\n ];\n }\n\n const exitPosition =\n originalExit ?? getDefaultPosition(targetView, sourceView);\n const entryPosition =\n originalEntry ?? getDefaultPosition(sourceView, targetView);\n\n const { x: sourceX, y: sourceY } = getAbsolutePosition(\n sourceView,\n exitPosition\n );\n const { x: targetX, y: targetY } = getAbsolutePosition(\n targetView,\n entryPosition\n );\n\n const connectPoints = getConnectPointsOfRectangleWithDirection();\n const originalSourceDirections =\n connectPoints.find((p) => p.x === exitPosition.x && p.y === exitPosition.y)\n ?.d ?? DEFAULT_DIRECTIONS;\n const originalTargetDirections =\n connectPoints.find(\n (p) => p.x === entryPosition.x && p.y === entryPosition.y\n )?.d ?? DEFAULT_DIRECTIONS;\n const sourceDirections = [...originalSourceDirections];\n const targetDirections = [...originalTargetDirections];\n\n if (sourceX < targetX) {\n pull(sourceDirections, \"left\");\n pull(targetDirections, \"right\");\n } else {\n pull(sourceDirections, \"right\");\n pull(targetDirections, \"left\");\n }\n\n if (sourceY < targetY) {\n pull(sourceDirections, \"top\");\n pull(targetDirections, \"bottom\");\n } else {\n pull(sourceDirections, \"bottom\");\n pull(targetDirections, \"top\");\n }\n\n const sourceDirection = sourceDirections[0] ?? originalSourceDirections[0];\n const targetDirection = targetDirections[0] ?? originalTargetDirections[0];\n\n const sourcePosition =\n sourceDirection === \"left\" || sourceDirection === \"right\"\n ? exitPosition.y\n : exitPosition.x;\n const targetPosition =\n targetDirection === \"left\" || targetDirection === \"right\"\n ? entryPosition.y\n : entryPosition.x;\n\n return getPolyLinePoints(\n nodeViewToNodeRect(sourceView, DEFAULT_NODE_PADDING_FOR_SMART_LINES),\n nodeViewToNodeRect(targetView, DEFAULT_NODE_PADDING_FOR_SMART_LINES),\n sourceDirection,\n targetDirection,\n sourcePosition,\n targetPosition\n );\n}\n\nexport function simplifyVertices(\n exitPoint: NodePosition,\n vertices: NodePosition[],\n entryPoint: NodePosition\n): NodePosition[] {\n // Simplify the vertices, ignore all vertices that its previous and next points are on the same axis\n // E.g, ignore two vertices of index 1 and index 3 for the following line.\n // 0---1---2\n // |\n // 3\n // |\n // 4\n const simplifiedVertices: NodePosition[] = [];\n let prev = exitPoint;\n let prevDirection: \"ns\" | \"ew\" | undefined;\n let index = 0;\n while (index < vertices.length) {\n const vertex = vertices[index];\n const isHorizontal = vertex.x !== prev.x;\n const isVertical = vertex.y !== prev.y;\n if (isHorizontal || isVertical) {\n const direction = isHorizontal ? \"ew\" : \"ns\";\n if (direction !== prevDirection) {\n const next =\n index === vertices.length - 1 ? entryPoint : vertices[index + 1];\n const isHorizontalNext = next.x !== vertex.x;\n const isVerticalNext = next.y !== vertex.y;\n if (isHorizontalNext || isVerticalNext) {\n const nextDirection = isHorizontalNext ? \"ew\" : \"ns\";\n if (direction !== nextDirection) {\n prevDirection = direction;\n simplifiedVertices.push(vertex);\n prev = vertex;\n }\n }\n }\n }\n index++;\n }\n\n return simplifiedVertices;\n}\n\nfunction getDefaultPosition(\n sourceView: NodeView,\n targetView: NodeView\n): NodePosition {\n if (targetView.y + targetView.height < sourceView.y) {\n return { x: 0.5, y: 1 };\n }\n if (targetView.y > sourceView.y + sourceView.height) {\n return { x: 0.5, y: 0 };\n }\n return targetView.x < sourceView.x ? { x: 1, y: 0.5 } : { x: 0, y: 0.5 };\n}\n\nfunction getAbsolutePosition(view: NodeView, position: NodePosition) {\n const halfPadding = DEFAULT_NODE_PADDING_FOR_SMART_LINES / 2;\n return {\n x:\n view.x -\n halfPadding +\n position.x * (view.width + DEFAULT_NODE_PADDING_FOR_SMART_LINES),\n y:\n view.y -\n halfPadding +\n position.y * (view.height + DEFAULT_NODE_PADDING_FOR_SMART_LINES),\n };\n}\n\nfunction getDefaultAbsolutePosition(\n sourceView: NodePosition,\n targetView: NodeView,\n flip?: boolean\n): NodePosition {\n let xAxis: \"x\" | \"y\";\n let yAxis: \"x\" | \"y\";\n let xSize: \"width\" | \"height\";\n let ySize: \"width\" | \"height\";\n if (flip) {\n xAxis = \"y\";\n yAxis = \"x\";\n xSize = \"height\";\n ySize = \"width\";\n } else {\n xAxis = \"x\";\n yAxis = \"y\";\n xSize = \"width\";\n ySize = \"height\";\n }\n let position: NodePosition | undefined;\n if (targetView[yAxis] + targetView[ySize] < sourceView[yAxis]) {\n position = { [xAxis]: 0.5, [yAxis]: 1 } as unknown as NodePosition;\n }\n if (targetView[yAxis] > sourceView[yAxis]) {\n position = { [xAxis]: 0.5, [yAxis]: 0 } as unknown as NodePosition;\n }\n if (position) {\n return getAbsolutePosition(targetView, position);\n }\n\n const xPosition = targetView[xAxis] < sourceView[xAxis] ? 1 : 0;\n\n return {\n [xAxis]:\n targetView[xAxis] -\n DEFAULT_NODE_PADDING_FOR_SMART_LINES / 2 +\n xPosition * (targetView[xSize] + DEFAULT_NODE_PADDING_FOR_SMART_LINES),\n [yAxis]: sourceView[yAxis],\n } as unknown as NodePosition;\n}\n\nfunction fitEndpointAndDirection(\n view: NodeView,\n oppositeView: NodeView,\n vertices: NodePosition[],\n prefer: BiDirection\n): { point: NodePosition; direction: BiDirection } {\n let point: NodePosition;\n let direction: BiDirection;\n\n let xAxis: \"x\" | \"y\";\n let yAxis: \"x\" | \"y\";\n let xSize: \"width\" | \"height\";\n let ySize: \"width\" | \"height\";\n let nsDirection: BiDirection;\n let ewDirection: BiDirection;\n if (prefer === \"ns\") {\n xAxis = \"x\";\n yAxis = \"y\";\n xSize = \"width\";\n ySize = \"height\";\n nsDirection = \"ns\";\n ewDirection = \"ew\";\n } else {\n xAxis = \"y\";\n yAxis = \"x\";\n xSize = \"height\";\n ySize = \"width\";\n nsDirection = \"ew\";\n ewDirection = \"ns\";\n }\n const vertex = vertices[0];\n\n if (\n vertex[xAxis] >= view[xAxis] &&\n vertex[xAxis] <= view[xAxis] + view[xSize]\n ) {\n if (vertex[yAxis] > view[yAxis] + view[ySize]) {\n point = {\n [xAxis]: vertex[xAxis],\n [yAxis]: view[yAxis] + view[ySize],\n } as unknown as NodePosition;\n direction = nsDirection;\n } else if (vertex[yAxis] < view[yAxis]) {\n point = {\n [xAxis]: vertex[xAxis],\n [yAxis]: view[yAxis],\n } as unknown as NodePosition;\n direction = nsDirection;\n } else {\n const nextVertex = vertices[1] ?? oppositeView;\n point = {\n [xAxis]: vertex[xAxis],\n [yAxis]:\n nextVertex[yAxis] < vertex[yAxis]\n ? vertex[yAxis]\n : view[yAxis] + view[ySize],\n } as unknown as NodePosition;\n direction = nsDirection;\n }\n } else {\n if (vertex[yAxis] < view[yAxis]) {\n point = {\n [xAxis]: view[xAxis] + view[xSize] / 2,\n [yAxis]: view[yAxis],\n } as unknown as NodePosition;\n direction = nsDirection;\n } else if (vertex[yAxis] > view[yAxis] + view[ySize]) {\n point = {\n [xAxis]: view[xAxis] + view[xSize] / 2,\n [yAxis]: view[yAxis] + view[ySize],\n } as unknown as NodePosition;\n direction = nsDirection;\n } else if (vertex[xAxis] < view[xAxis]) {\n point = {\n [xAxis]: view[xAxis],\n [yAxis]: vertex[yAxis],\n } as unknown as NodePosition;\n direction = ewDirection;\n } else {\n point = {\n [xAxis]: view[xAxis] + view[xSize],\n [yAxis]: vertex[yAxis],\n } as unknown as NodePosition;\n direction = ewDirection;\n }\n }\n return { point, direction: direction };\n}\n","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 rootRef: 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 rootRef,\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 rootIndex = path.indexOf(rootRef.current!);\n // Reset active target to null when clicking outside of the cells container,\n // Or inside the cells container but not on any cell.\n if (rootIndex <= 0) {\n setActiveTarget(null);\n }\n };\n document.addEventListener(\"click\", resetActiveTarget);\n return () => {\n document.removeEventListener(\"click\", resetActiveTarget);\n };\n }, [activeTarget, rootRef]);\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[] = [\n {\n strokeColor: DEFAULT_LINE_STROKE_COLOR,\n markerType: \"arrow\",\n },\n ];\n\n let lineConnectorConf: ComputedLineConnecterConf | null = null;\n if (lineConnector) {\n lineConnectorConf = {\n ...getDefaultLineConf(),\n editingStrokeColor: \"var(--palette-blue-5)\",\n ...omitBy(lineConnector === true ? {} : lineConnector, isUndefined),\n } as ComputedLineConnecterConf;\n const markerIndex = addMarker(\n {\n strokeColor: lineConnectorConf.strokeColor,\n markerType: lineConnectorConf.markerType,\n },\n markers\n );\n lineConnectorConf.$markerUrl = `url(#${markerPrefix}${markerIndex})`;\n const editingMarkerIndex = addMarker(\n {\n strokeColor: lineConnectorConf.editingStrokeColor,\n markerType: lineConnectorConf.markerType,\n },\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 {\n strokeColor: lineConf.strokeColor,\n markerType: lineConf.markerType,\n },\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(): EdgeLineConf {\n return {\n type: \"straight\",\n markerType: \"arrow\",\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-dashedoffset:96;--stroke-dottedoffset:24;--dasharray:4;--dotted:1}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}@keyframes solidAnimation{to{stroke-dashoffset:0}}@keyframes dashedAnimation{0%{stroke-dashoffset:var(--stroke-dashedoffset)}to{stroke-dashoffset:0}}@keyframes dottedAnimation{0%{stroke-dashoffset:var(--stroke-dottedoffset)}to{stroke-dashoffset:0}}.solid-animation{stroke-dasharray:var(--solid-length);stroke-dashoffset:var(--solid-length);animation:solidAnimation var(--time) linear infinite}.dashed-animation{animation:dashedAnimation var(--time) linear infinite}.dotted-animation{animation:dottedAnimation var(--time) linear infinite}.decorator-area .area,\n.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)}.line.dotted{stroke-dasharray:var(--dotted)}.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","_edge$view","isStraightType","view","type","some","_cell$view","isEdgeCell","linePoints","x","getSmartLinePoints","line","fixedLineType","curveLine","curveType","useEffect","prev","lineType","lineCurveType","React","d","fill","stroke","strokeWidth","interactStrokeWidth","ref","className","classNames","dashed","dotted","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","activeCells","actives","filter","c","forEach","a","push","isContainerDecoratorCell","isNodeCell","containerId","includes","isAutoLayout","movableActiveCells","isDecoratorCell","length","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","onChangeEdgeView","gRef","unrelated","sameTarget","containerRect","containCells","isEdgeSide","exitPosition","isEntry","entryPosition","handleContextMenu","handleCellClick","handleMouseEnter","handleMouseLeave","faded","onContextMenu","onClick","onMouseEnter","onMouseLeave","ConnectLineComponent","connectLineState","connectLineTo","setConnectLineTo","getConnectTo","offset","reset","capture","connecting","join","getNewLineVertices","control","newVertices","x1","y1","exitPoint","entryPoint","i","vertex","simplifyVertices","EditingLineComponent","options","activeEditableLine","hoverState","movedRef","diff","axis","original","otherPoints","_","snapDistance","point","newDiff","movementX","movementY","newConnectTo","vertices","handleBodyClick","body","_lineEditorState$edge","points","activePointIndex","lineSettings","pick","relativePoints","getEditingLinePoints","editingStrokeColor","$editingMarkerUrl","HoverStateContext","rootRef","unsetHoverStateTimeoutRef","setHoverState","HELPER_IMAGE","HELPER_RADIUS","HELPER_BG_RADIUS","HALF_HELPER_RADIUS","LineConnectorComponent","disabled","unsetTimeout","clearTimeout","unsetActivePointIndex","unsetHoverState","available","targets","hasActiveEdge","DEFAULT_NODE_PADDING_FOR_SMART_LINES","halfPadding","pointerEvents","fillOpacity","ConnectPointComponent","key","getBoundingClientRect","originalPoint","left","top","handleMouseUp","xlinkHref","preserveAspectRatio","POINT_HELPER_IMAGE","ANCHORED_POINT_HELPER_IMAGE","VERTEX_HELPER_IMAGE","POINT_HELPER_BG_SIZE","LineEditorComponent","exitRef","entryRef","controlPointsRef","exit","entry","handleMouseDownFactory","handleStartMouseDown","handleEndMouseDown","controlPoints","_activeEditableLine$e","cursor","next","ns","ew","getControlPoints","controlElements","handlers","el","commonProps","_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","DEFAULT_NODE_PADDING_FOR_LINES","isInitialNodeCell","isNodeOrEdgeCell","isTextDecoratorCell","getUnrelatedCells","existedTargets","Set","add","has","nodesMap","Map","activeNodeIds","relatedNodeIds","set","handleKeyboard","keyCode","which","handleLasso","onLassoing","onLassoed","ctrlKey","button","x0","y0","handleNodeContainedChange","onContainerContainerChange","nodeCells","containerIds","p","v","nodePayloads","nodeCell","includeNodeFlag","payload","right","bottom","containerDecoratorCells","containerCell","containerLeft","containerRight","containerTop","containerBottom","containedChanges","_payload$containerCel","initializeCells","initialCells","defaultNodeSize","_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","nodeViewToNodeRect","DEFAULT_DIRECTIONS","targetView","edgeView","_connectPoints$find","_connectPoints$find2","originalExit","originalEntry","getDirectLinePoints","firstVertex","lastVertex","exitDirection","entryDirection","getAbsolutePosition","possibleFirstNextPoint","getDefaultAbsolutePosition","prefer","fitEndpointAndDirection","possibleLastPreviousPoint","reverse","sourceX","sourceY","targetX","targetY","newLinePoints","unshift","getDefaultPosition","connectPoints","getConnectPointsOfRectangleWithDirection","originalSourceDirections","originalTargetDirections","sourceDirections","targetDirections","pull","sourceDirection","targetDirection","sourcePosition","targetPosition","getPolyLinePoints","simplifiedVertices","prevDirection","isHorizontal","isVertical","isHorizontalNext","isVerticalNext","flip","xAxis","yAxis","xSize","ySize","xPosition","oppositeView","nsDirection","ewDirection","nextVertex","RectangleRelativeConnectPointsWithDirection","RectangleRelativeConnectPoints","getConnectPointsOfRectangle","useActiveTarget","_activeTarget","onActiveTargetChange","newActiveTarget","setActiveTarget","previous","activeTargetChangeInitialized","resetActiveTarget","composedPath","indexOf","KeywordMap","normalizeAlignAxis","newX","matches","match","Number","useLayout","zoomable","zoomer","dispatch","layoutInitialized","setLayoutInitialized","layoutKeyRef","getNextLayoutKey","centered","setCentered","root","select","ZoomTransform","useAutoCenter","previousLayoutRef","alignOrigin","origin","normalizeAlignOrigin","nodeView","useLineMarkers","defaultEdgeLines","markerPrefix","lineConnector","markers","markerType","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":""}
|