@next-bricks/diagram 0.32.3 → 0.32.4

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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunks/709.5f97613d.js","mappings":"mKAYO,SAASA,EAAeC,GAIO,IAChCC,GAL0B,GAC9BC,EAAE,KACFC,EAAI,YACJC,GACqBJ,EAGrB,OAAQG,GACN,IAAK,OACHF,EAAYI,EACZ,MACF,IAAK,OACHJ,EAAYK,EACZ,MACF,QACEL,EAAYM,EAGhB,OAAOC,IAAAA,cAACP,EAAS,CAACC,GAAIA,EAAIE,YAAaA,GACzC,CAEA,SAASG,EAAWE,GAGsB,IAHrB,GACnBP,EAAE,YACFE,GACyBK,EACzB,OACED,IAAAA,cAAA,UACEN,GAAIA,EACJQ,QAAQ,UACRC,KAAM,EACNC,KAAM,EACNC,YAAa,EACbC,aAAc,EACdC,OAAO,qBACPC,eAAe,SAEfR,IAAAA,cAAA,QACES,EAAE,gCACFC,OAAQd,EACRe,YAAa,EACbC,KAAMhB,IAId,CAEA,SAASC,EAA6BgB,GAGI,IAHH,GACrCnB,EAAE,YACFE,GACyBiB,EACzB,OACEb,IAAAA,cAAA,UACEN,GAAIA,EACJQ,QAAQ,YACRC,KAAM,GACNC,KAAM,IACNC,YAAa,GACbC,aAAc,GACdC,OAAO,sBAEPP,IAAAA,cAAA,QACES,EAAE,yFACFC,OAAQd,EACRe,YAAa,EACbC,KAAK,SAIb,CAEA,SAASd,EAA8BgB,GAGG,IAHF,GACtCpB,EAAE,YACFE,GACyBkB,EACzB,OACEd,IAAAA,cAAA,UACEN,GAAIA,EACJQ,QAAQ,YACRC,KAAM,GACNC,KAAM,IACNC,YAAa,GACbC,aAAc,GACdC,OAAO,sBAEPP,IAAAA,cAAA,QACES,EAAE,yGACFC,OAAQd,EACRe,YAAa,EACbC,KAAK,SAIb,C,+CCnGO,SAASG,EACdC,EACAC,EACAC,GAIA,GAAIF,IAAW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,EAAYnC,EAAUC,IAEtC,CAAEqC,WAAUhQ,YAAW2N,SAAQtH,aACxC,C,kEClIIwK,E,MAA0B,GAA4B,KAE1DA,EAAwBla,KAAK,CAACma,EAAOtd,GAAI,o6CAK2E,KAEpH,QAAeqd,EAAwBE,U,kECTnCF,E,MAA0B,GAA4B,KAE1DA,EAAwBla,KAAK,CAACma,EAAOtd,GAAI,q7DAOO,KAEhD,QAAeqd,EAAwBE,U","sources":["webpack:///./src/diagram/MarkerComponent.tsx","webpack:///./src/diagram/lines/getDirectLinePoints.ts","webpack:///./src/diagram/processors/doTwoNodesOverlap.ts","webpack:///./src/diagram/processors/extractPartialRectTuple.ts","webpack:///./src/draw-canvas/processors/findNode.ts","webpack:///./src/draw-canvas/EdgeComponent.tsx","webpack:///./src/draw-canvas/NodeComponent.tsx","webpack:///./src/draw-canvas/processors/cellToTarget.ts","webpack:///./src/draw-canvas/processors/handleMouseDown.ts","webpack:///./src/draw-canvas/decorators/DecoratorArea.tsx","webpack:///./src/draw-canvas/decorators/DecoratorText.tsx","webpack:///./src/draw-canvas/decorators/index.tsx","webpack:///./src/draw-canvas/CellComponent.tsx","webpack:///./src/draw-canvas/constants.ts","webpack:///./src/draw-canvas/processors/asserts.ts","webpack:///./src/draw-canvas/processors/getUnrelatedCells.ts","webpack:///./src/draw-canvas/processors/initializeCells.ts","webpack:///./src/draw-canvas/processors/sameTarget.ts","webpack:///./src/draw-canvas/processors/transformToCenter.ts","webpack:///./src/draw-canvas/reducers/cells.ts","webpack:///./src/draw-canvas/reducers/index.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/useActiveTarget.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 React from \"react\";\nimport type { LineMarkerType } from \"./interfaces\";\n\nexport interface MarkerComponentProps extends BaseMarkerComponentProps {\n type: LineMarkerType;\n}\n\nexport interface BaseMarkerComponentProps {\n id: string;\n strokeColor?: string;\n}\n\nexport function MarkerComponent({\n id,\n type,\n strokeColor,\n}: MarkerComponentProps): JSX.Element {\n let Component: (props: BaseMarkerComponentProps) => JSX.Element;\n\n switch (type) {\n case \"0..1\":\n Component = EntityRelationZeroOrOneMarker;\n break;\n case \"0..N\":\n Component = EntityRelationZeroOrManyMarker;\n break;\n default:\n Component = ArrowMarker;\n }\n\n return <Component id={id} strokeColor={strokeColor} />;\n}\n\nfunction ArrowMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 6 6\"\n refX={5}\n refY={3}\n markerWidth={6}\n markerHeight={6}\n orient=\"auto-start-reverse\"\n strokeLinejoin=\"round\"\n >\n <path\n d=\"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z\"\n stroke={strokeColor}\n strokeWidth={1}\n fill={strokeColor}\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrOneMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrManyMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n","import type { NodePosition, NodeRect, PositionTuple } from \"../interfaces\";\nimport { doTwoNodesOverlap } from \"../processors/doTwoNodesOverlap\";\n\ntype LineTuple = [start: PositionTuple, end: PositionTuple];\n\nexport function getDirectLinePoints(\n source: NodeRect,\n target: NodeRect,\n parallelGap?: number\n): NodePosition[] | null {\n // Ignore if two nodes are the same.\n // Ignore if two nodes overlap.\n if (source === target || doTwoNodesOverlap(source, target, 0, 0)) {\n return null;\n }\n\n let p0: PositionTuple;\n let p1: PositionTuple;\n\n let xDiff = 0;\n let yDiff = 0;\n\n if (parallelGap) {\n const dx = target.x - source.x;\n const dy = target.y - source.y;\n const angle = Math.atan2(dy, dx);\n xDiff = (parallelGap / 2) * Math.cos(angle + Math.PI / 2);\n yDiff = (parallelGap / 2) * Math.sin(angle + Math.PI / 2);\n }\n\n const line: LineTuple = [\n [source.x + xDiff, source.y + yDiff],\n [target.x + xDiff, target.y + yDiff],\n ];\n const sourceIntersections = getIntersections(source, line);\n const targetIntersections = getIntersections(target, line);\n\n // Todo: handle when more than one intersection\n if (sourceIntersections.length > 0) {\n p0 = sourceIntersections[0];\n } else {\n p0 = [source.x, source.y];\n }\n if (targetIntersections.length > 0) {\n p1 = targetIntersections[0];\n } else {\n p1 = [target.x, target.y];\n }\n\n return [\n { x: p0[0], y: p0[1] },\n { x: p1[0], y: p1[1] },\n ];\n}\n\nfunction getIntersections(rect: NodeRect, line: LineTuple) {\n const vertices: PositionTuple[] = [\n [rect.x - rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y + rect.height / 2],\n [rect.x - rect.width / 2, rect.y + rect.height / 2],\n ];\n const possibleLines: [start: PositionTuple, end: PositionTuple][] = [];\n for (let i = 0; i < 4; i++) {\n possibleLines.push([vertices[i], vertices[(i + 1) % 4]]);\n }\n const intersections: PositionTuple[] = [];\n for (const item of possibleLines) {\n const intersection = intersect(line[0], line[1], item[0], item[1]);\n if (intersection) {\n intersections.push(intersection);\n }\n }\n return intersections;\n}\n\n// https://paulbourke.net/geometry/pointlineplane/javascript.txt\nfunction intersect(\n [x1, y1]: PositionTuple,\n [x2, y2]: PositionTuple,\n [x3, y3]: PositionTuple,\n [x4, y4]: PositionTuple\n): null | PositionTuple {\n // Check if none of the lines are of length 0\n if ((x1 === x2 && y1 === y2) || (x3 === x4 && y3 === y4)) {\n return null;\n }\n\n const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);\n\n // Lines are parallel\n if (denominator === 0) {\n return null;\n }\n\n const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;\n const ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denominator;\n\n // is the intersection along the segments\n if (ua < 0 || ua > 1 || ub < 0 || ub > 1) {\n return null;\n }\n\n // Return a object with the x and y coordinates of the intersection\n const x = x1 + ua * (x2 - x1);\n const y = y1 + ua * (y2 - y1);\n\n return [x, y];\n}\n","import type { NodeRect } from \"../interfaces\";\n\nexport function doTwoNodesOverlap(\n a: NodeRect,\n b: NodeRect,\n paddingA: number,\n paddingB: number\n): boolean {\n const A = paddingA ? getNodesWithPadding(a, paddingA) : a;\n const B = paddingB ? getNodesWithPadding(b, paddingB) : b;\n const left = Math.min(A.x - A.width / 2, B.x - B.width / 2);\n const right = Math.max(A.x + A.width / 2, B.x + B.width / 2);\n const top = Math.min(A.y - A.height / 2, B.y - B.height / 2);\n const bottom = Math.max(A.y + A.height / 2, B.y + B.height / 2);\n return right - left < A.width + B.width && bottom - top < A.height + B.height;\n}\n\nfunction getNodesWithPadding(node: NodeRect, padding: number) {\n return {\n x: node.x - node.width / 2 - padding,\n y: node.y - node.height / 2 - padding,\n width: node.width + padding * 2,\n height: node.height + padding * 2,\n };\n}\n","import type { FullRectTuple, PartialRectTuple } from \"../interfaces\";\n\nexport function extractPartialRectTuple(\n value: PartialRectTuple\n): FullRectTuple {\n if (Array.isArray(value)) {\n const v0 = value[0];\n const v1 = value.length > 1 ? value[1]! : v0;\n const v2 = value.length > 2 ? value[2]! : v0;\n const v3 = value.length > 3 ? value[3]! : v1;\n return [v0, v1, v2, v3];\n }\n return new Array(4).fill(value) as FullRectTuple;\n}\n","import type { Cell, NodeCell, NodeId } from \"../interfaces\";\nimport { isNodeCell } from \"./asserts\";\n\nexport function findNode(cells: Cell[], id: NodeId): NodeCell | undefined {\n return cells.find((cell) => isNodeCell(cell) && cell.id === id) as\n | NodeCell\n | undefined;\n}\n","import React, { useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n EdgeCell,\n NodeView,\n} from \"./interfaces\";\nimport { getDirectLinePoints } from \"../diagram/lines/getDirectLinePoints\";\nimport type { NodeRect } from \"../diagram/interfaces\";\nimport { findNode } from \"./processors/findNode\";\nimport { isEdgeCell } from \"./processors/asserts\";\nimport { DEFAULT_LINE_INTERACT_ANIMATE_DURATION } from \"./constants\";\n\nexport interface EdgeComponentProps {\n edge: EdgeCell;\n cells: Cell[];\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n}\n\nexport function EdgeComponent({\n edge,\n cells,\n lineConfMap,\n}: EdgeComponentProps): JSX.Element | null {\n const pathRef = useRef<SVGPathElement>(null);\n const sourceNode = useMemo(\n () => findNode(cells, edge.source),\n [cells, edge.source]\n );\n const targetNode = useMemo(\n () => findNode(cells, edge.target),\n [cells, edge.target]\n );\n const lineConf = useMemo(() => lineConfMap.get(edge)!, [edge, lineConfMap]);\n\n const parallelGap = useMemo(() => {\n const hasOppositeEdge = cells.some(\n (cell) =>\n isEdgeCell(cell) &&\n cell.source === edge.target &&\n cell.target === edge.source\n );\n return hasOppositeEdge ? lineConf.parallelGap : 0;\n }, [cells, edge, lineConf.parallelGap]);\n\n const padding = 5;\n\n const line = useMemo(\n () =>\n sourceNode &&\n targetNode &&\n sourceNode.view.x != null &&\n targetNode.view.x != null\n ? getDirectLinePoints(\n nodeViewToNodeRect(sourceNode.view, padding),\n nodeViewToNodeRect(targetNode.view, padding),\n parallelGap\n )\n : null,\n [parallelGap, sourceNode, targetNode]\n );\n\n if (!line) {\n // This happens when source or target is not found,\n // or when source or target has not been positioned yet.\n return null;\n }\n const d = `M${line[0].x} ${line[0].y}L${line[1].x} ${line[1].y}`;\n return (\n <>\n <path\n // This `path` is made for expanding interaction area of graph lines.\n d={d}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={lineConf.interactStrokeWidth}\n />\n <path\n ref={pathRef}\n className={classNames(\"line\", {\n dashed: lineConf.dashed,\n [`${lineConf.dashed ? \"dashed\" : \"solid\"}-animation`]:\n lineConf.animate.useAnimate,\n })}\n style={\n {\n \"--time\": `${lineConf.animate.duration ?? DEFAULT_LINE_INTERACT_ANIMATE_DURATION}s`,\n \"--solid-length\": pathRef.current?.getTotalLength?.(),\n } as React.CSSProperties\n }\n d={d}\n fill=\"none\"\n stroke={lineConf.strokeColor}\n strokeWidth={lineConf.strokeWidth}\n markerStart={lineConf.showStartArrow ? lineConf.markerArrow : \"\"}\n markerEnd={lineConf.showEndArrow ? lineConf.markerArrow : \"\"}\n />\n <path className=\"line-active-bg\" d={d} fill=\"none\" />\n </>\n );\n}\n\nfunction nodeViewToNodeRect(view: NodeView, padding: number): NodeRect {\n return {\n x: view.x + view.width / 2,\n y: view.y + view.height / 2,\n width: view.width + padding,\n height: view.height + padding,\n };\n}\n","import React, {\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 { pick } from \"lodash\";\nimport type { ActiveTarget, Cell } from \"../interfaces\";\n\nexport function cellToTarget(cell: Cell): ActiveTarget {\n return cell.type === \"edge\"\n ? pick(cell, [\"type\", \"source\", \"target\", \"data\"])\n : pick(cell, [\"type\", \"id\", \"data\"]);\n}\n","import type { PositionTuple } from \"../../diagram/interfaces\";\nimport type { ActiveTarget, Cell, LayoutType } from \"../interfaces\";\nimport type {\n MoveCellPayload,\n ResizeCellPayload,\n} from \"../reducers/interfaces\";\nimport { isEdgeCell, isNodeCell } from \"./asserts\";\nimport { cellToTarget } from \"./cellToTarget\";\n\nexport function handleMouseDown(\n event: MouseEvent,\n {\n action,\n cell,\n scale,\n layout,\n onCellMoving,\n onCellMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n }: {\n action: \"move\" | \"resize\";\n cell: Cell;\n scale: number;\n layout?: LayoutType;\n onCellMoving?(info: MoveCellPayload): void;\n onCellMoved?(info: MoveCellPayload): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget?(activeTarget: ActiveTarget | null): void;\n }\n) {\n event.stopPropagation();\n // Drag node\n onSwitchActiveTarget?.(cellToTarget(cell));\n\n if (\n isEdgeCell(cell) ||\n ((layout === \"force\" || layout === \"dagre\") && isNodeCell(cell))\n ) {\n return;\n }\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const original =\n action === \"move\"\n ? [cell.view.x, cell.view.y]\n : [cell.view.width, cell.view.height];\n\n function getMovement(e: MouseEvent): PositionTuple {\n return [(e.clientX - from[0]) / scale, (e.clientY - from[1]) / scale];\n }\n\n let moved = false;\n\n const handleMove = (e: MouseEvent, finished?: boolean) => {\n // Respect the scale\n const movement = getMovement(e);\n if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n }\n // const [x, y] = getNewPosition(movement);\n // adjustCellPosition(x, y);\n if (moved) {\n if (action === \"move\") {\n (finished ? onCellMoved : onCellMoving)?.({\n type: cell.type,\n id: cell.id,\n x: original[0] + movement[0],\n y: original[1] + movement[1],\n });\n } else {\n (finished ? onCellResized : onCellResizing)?.({\n type: cell.type,\n id: cell.id,\n width: original[0] + movement[0],\n height: original[1] + movement[1],\n });\n }\n }\n };\n\n const onMouseMove = (e: MouseEvent) => {\n handleMove(e);\n };\n const onMouseUp = (e: MouseEvent) => {\n handleMove(e, true);\n moved = false;\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n}\n","import React, { useEffect } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\n\nexport function DecoratorArea({\n cell,\n transform,\n readOnly,\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 onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n cell,\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\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\nfunction selectAllText(element: HTMLElement) {\n const range = document.createRange();\n range.selectNodeContents(element);\n const selection = window.getSelection()!;\n selection.removeAllRanges();\n selection.addRange(range);\n}\n","import React from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { DecoratorArea } from \"./DecoratorArea\";\nimport { DecoratorText } from \"./DecoratorText\";\n\nexport function DecoratorComponent({\n cell,\n transform,\n readOnly,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: BasicDecoratorProps): JSX.Element | null {\n let SpecifiedComponent: (props: BasicDecoratorProps) => JSX.Element | null;\n\n switch (cell.decorator) {\n case \"area\":\n SpecifiedComponent = DecoratorArea;\n break;\n case \"text\":\n SpecifiedComponent = DecoratorText;\n break;\n // istanbul ignore next\n default:\n // eslint-disable-next-line no-console\n console.error(`Unknown decorator: ${cell.decorator}`);\n return null;\n }\n\n return (\n <SpecifiedComponent\n cell={cell}\n transform={transform}\n readOnly={readOnly}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\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 EdgeCell,\n LayoutType,\n NodeBrickConf,\n} from \"./interfaces\";\nimport { isDecoratorCell, isEdgeCell, isNodeCell } from \"./processors/asserts\";\nimport { EdgeComponent } from \"./EdgeComponent\";\nimport { NodeComponent } from \"./NodeComponent\";\nimport { handleMouseDown } from \"./processors/handleMouseDown\";\nimport type { MoveCellPayload, ResizeCellPayload } from \"./reducers/interfaces\";\nimport { DecoratorComponent } from \"./decorators\";\nimport { cellToTarget } from \"./processors/cellToTarget\";\nimport type { SizeTuple, TransformLiteral } from \"../diagram/interfaces\";\nimport { sameTarget } from \"./processors/sameTarget\";\n\nexport interface CellComponentProps {\n layout: LayoutType;\n cell: Cell;\n cells: Cell[];\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n transform: TransformLiteral;\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n active: boolean;\n readOnly?: boolean;\n unrelatedCells: Cell[];\n onCellMoving?(info: MoveCellPayload): void;\n onCellMoved?(info: MoveCellPayload): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget(target: ActiveTarget | null): void;\n onCellContextMenu(detail: CellContextMenuDetail): void;\n onDecoratorTextEditing?(detail: { id: string; editing: boolean }): void;\n onDecoratorTextChange?(detail: DecoratorTextChangeDetail): void;\n 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 cell,\n cells,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n lineConfMap,\n active,\n readOnly,\n transform,\n unrelatedCells,\n onCellMoving,\n onCellMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onCellContextMenu,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n onNodeBrickResize,\n onCellMouseEnter,\n onCellMouseLeave,\n}: CellComponentProps): JSX.Element | null {\n const gRef = useRef<SVGGElement>(null);\n\n const unrelated = useMemo(\n () => unrelatedCells.some((item) => sameTarget(item, cell)),\n [cell, unrelatedCells]\n );\n\n useEffect(() => {\n const g = gRef.current;\n if (!g || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n layout,\n action: \"move\",\n cell,\n scale: transform.k,\n onCellMoving,\n onCellMoved,\n onSwitchActiveTarget,\n });\n };\n g.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n g.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n layout,\n cell,\n onCellMoved,\n onCellMoving,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\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 handleMouseEnter = useCallback(() => {\n onCellMouseEnter?.(cell);\n }, [cell, onCellMouseEnter]);\n\n const handleMouseLeave = useCallback(() => {\n onCellMouseLeave?.(cell);\n }, [cell, onCellMouseLeave]);\n\n return (\n <g\n className={classNames(\"cell\", {\n active,\n faded: unrelated,\n \"read-only\": readOnly,\n })}\n ref={gRef}\n transform={\n cell.type === \"edge\" || cell.view.x == null\n ? undefined\n : `translate(${cell.view.x} ${cell.view.y})`\n }\n onContextMenu={handleContextMenu}\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 edge={cell} cells={cells} lineConfMap={lineConfMap} />\n ) : isDecoratorCell(cell) ? (\n <DecoratorComponent\n cell={cell}\n transform={transform}\n readOnly={readOnly}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n ) : null}\n </g>\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 = 100;\nexport const DEFAULT_AREA_HEIGHT = 60;\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;\n","import type {\n Cell,\n DecoratorCell,\n EdgeCell,\n InitialCell,\n InitialNodeCell,\n NodeCell,\n} from \"../interfaces\";\n\nexport function isNodeCell(cell: Cell): cell is NodeCell {\n return cell.type === \"node\";\n}\n\nexport function isDecoratorCell(cell: Cell): cell is DecoratorCell {\n return cell.type === \"decorator\";\n}\n\nexport function isInitialNodeCell(cell: InitialCell): cell is InitialNodeCell {\n return cell.type === \"node\";\n}\n\nexport function isEdgeCell(cell: Cell): cell is EdgeCell {\n return cell.type === \"edge\";\n}\n\nexport function isNodeOrEdgeCell(cell: Cell): cell is NodeCell | EdgeCell {\n return cell.type === \"node\" || cell.type === \"edge\";\n}\n","import type { ActiveTarget, Cell, ConnectLineState } from \"../interfaces\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport function getUnrelatedCells(\n cells: Cell[],\n connectLineState: ConnectLineState | null,\n activeTarget: ActiveTarget | null\n): Cell[] {\n const unrelated: Cell[] = [];\n\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 default:\n unrelated.push(cell);\n }\n }\n } else {\n switch (activeTarget?.type) {\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 ? sameTarget(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 { SizeTuple } from \"../../diagram/interfaces\";\nimport type { Cell, InitialCell, NodeCell } from \"../interfaces\";\nimport { isInitialNodeCell } from \"./asserts\";\n\nexport function initializeCells(\n initialCells: InitialCell[] | undefined,\n {\n defaultNodeSize,\n }: {\n defaultNodeSize: SizeTuple;\n }\n): Cell[] {\n const originalCells = initialCells ?? [];\n const finalCells: Cell[] = originalCells.map<Cell>((cell) => {\n if (\n !isInitialNodeCell(cell) ||\n (cell.view?.width !== undefined && cell.view?.height !== undefined)\n ) {\n return cell as NodeCell;\n }\n return {\n ...cell,\n view: {\n width: defaultNodeSize[0],\n height: defaultNodeSize[1],\n ...cell.view,\n },\n } as NodeCell;\n });\n return finalCells;\n}\n","import type {\n ActiveTarget,\n ActiveTargetOfEdge,\n ActiveTargetOfNode,\n} from \"../interfaces\";\n\nexport function sameTarget(\n a: ActiveTarget | null | undefined,\n b: ActiveTarget | null | undefined\n): boolean {\n return a\n ? !!b &&\n a.type === b.type &&\n (a.type === \"node\" || a.type === \"decorator\"\n ? a.id === (b as ActiveTargetOfNode).id\n : a.source === (b as ActiveTargetOfEdge).source &&\n a.target === (b as ActiveTargetOfEdge).target)\n : !b;\n}\n","import type { TransformLiteral } from \"../../diagram/interfaces\";\nimport type { Cell } from \"../interfaces\";\nimport { isEdgeCell } from \"./asserts\";\n\nexport interface TransformToCenterOptions {\n canvasWidth: number;\n canvasHeight: number;\n scaleRange?: [min: number, max: number];\n}\n\nexport function transformToCenter(\n cells: Cell[],\n { canvasWidth, canvasHeight, scaleRange }: TransformToCenterOptions\n): TransformLiteral {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n let empty = true;\n for (const cell of cells) {\n if (!isEdgeCell(cell)) {\n empty = false;\n const { view } = cell;\n const r = view.x + view.width;\n const b = view.y + view.height;\n if (view.x < left) {\n left = view.x;\n }\n if (r > right) {\n right = r;\n }\n if (view.y < top) {\n top = view.y;\n }\n if (b > bottom) {\n bottom = b;\n }\n }\n }\n\n const width = right - left;\n const height = bottom - top;\n\n const scale =\n scaleRange && !empty && (width > canvasWidth || height > canvasHeight)\n ? Math.max(\n Math.min(canvasWidth / width, canvasHeight / height, scaleRange[1]),\n scaleRange[0]\n )\n : 1;\n\n const x = empty ? 0 : (canvasWidth - width * scale) / 2 - left * scale;\n const y = empty ? 0 : (canvasHeight - height * scale) / 2 - top * scale;\n\n return { x, y, k: scale };\n}\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\nimport type { Cell, 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 // Add the edge to just next to the previous last edge or area decorator.\n // If not found, append to the start.\n return insertCellAfter(\n state,\n action.payload,\n (cell) =>\n cell.type === \"edge\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n case \"move-cell\": {\n const { type, id, x, y } = action.payload;\n const index = state.findIndex(\n (cell) => cell.type === type && cell.id === id\n );\n if (index !== -1) {\n const node = state[index] as NodeCell;\n return [\n ...state.slice(0, index),\n { ...node, view: { ...node.view, x, y } },\n ...state.slice(index + 1),\n ];\n }\n return state;\n }\n case \"resize-cell\": {\n const { type, id, width, height } = action.payload;\n const index = state.findIndex(\n (cell) => cell.type === type && cell.id === id\n );\n if (index !== -1) {\n const node = state[index] as NodeCell;\n return [\n ...state.slice(0, index),\n { ...node, view: { ...node.view, width, height } },\n ...state.slice(index + 1),\n ];\n }\n return state;\n }\n case \"update-cells\":\n return action.payload;\n 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\";\n\ntype ReducersMapObject<S, A> = {\n [K in keyof S]: Reducer<S[K], A>;\n};\n\nfunction combineReducers<S, A>(\n reducers: ReducersMapObject<S, A>\n): Reducer<S, A> {\n return ((state, action) =>\n Object.fromEntries(\n Object.entries<Reducer<any, A>>(reducers).map(([key, value]) => [\n key,\n value(state[key as keyof S], action),\n ])\n )) as Reducer<S, A>;\n}\n\nexport const rootReducer = combineReducers<DrawCanvasState, DrawCanvasAction>({\n cells,\n});\n","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 { isEdgeCell, isNodeCell } from \"../../draw-canvas/processors/asserts\";\nimport type { FullRectTuple } from \"../../diagram/interfaces\";\n\nexport interface DagreLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsDagre;\n}\n\nexport function dagreLayout({ cells, layoutOptions }: 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 (isNodeCell(cell)) {\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 { isEdgeCell, isNodeCell } 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}\n\nexport function forceLayout({\n cells,\n layoutOptions,\n center,\n fixedPosition,\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 (isNodeCell(cell)) {\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 React, { useEffect, useRef, useState } from \"react\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\nimport { sameTarget } from \"../../draw-canvas/processors/sameTarget\";\n\nexport interface UseActiveTargetOptions {\n cellsRef: React.RefObject<SVGGElement>;\n activeTarget?: ActiveTarget | null;\n onActiveTargetChange(target: ActiveTarget | null): void;\n}\n\nexport type UseActiveTargetResult = ActiveTarget | null;\n\nexport function useActiveTarget({\n cellsRef,\n activeTarget: _activeTarget,\n onActiveTargetChange,\n}: UseActiveTargetOptions): UseActiveTargetResult {\n const newActiveTarget = _activeTarget ?? null;\n const [activeTarget, setActiveTarget] = useState<ActiveTarget | null>(\n newActiveTarget\n );\n\n useEffect(() => {\n setActiveTarget((previous) =>\n sameTarget(previous, newActiveTarget) ? previous : newActiveTarget\n );\n }, [newActiveTarget]);\n\n const activeTargetChangeInitialized = useRef(false);\n useEffect(() => {\n if (!activeTargetChangeInitialized.current) {\n activeTargetChangeInitialized.current = true;\n return;\n }\n onActiveTargetChange(activeTarget);\n }, [activeTarget, onActiveTargetChange]);\n\n useEffect(() => {\n if (!activeTarget) {\n return;\n }\n const resetActiveTarget = (e: MouseEvent) => {\n const path = e.composedPath();\n const cellsContainerIndex = path.indexOf(cellsRef.current!);\n // Reset active target to null when clicking outside of the cells container,\n // Or inside the cells container but not on any cell.\n if (cellsContainerIndex <= 0) {\n setActiveTarget(null);\n }\n };\n document.addEventListener(\"click\", resetActiveTarget);\n return () => {\n document.removeEventListener(\"click\", resetActiveTarget);\n };\n }, [activeTarget, cellsRef]);\n\n return activeTarget;\n}\n","import { 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 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\";\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 dispatch: (value: DrawCanvasAction) => void;\n}\n\nexport function useLayout({\n layout,\n layoutOptions,\n rootRef,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n dispatch,\n}: UseLayoutOptions) {\n const [layoutInitialized, setLayoutInitialized] = useState(\n layout !== \"force\" && layout !== \"dagre\"\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 ) {\n return;\n }\n\n if (layout !== \"force\" && layout !== \"dagre\") {\n setLayoutInitialized(true);\n return;\n }\n\n // Do not re-layout if nodes and edges not changed.\n if (\n isSameArray(previousLayoutRef.current, cells.filter(isNodeOrEdgeCell))\n ) {\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 }));\n } else {\n ({ getNodeView, nodePaddings } = dagreLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsDagre,\n }));\n }\n\n const newCells: Cell[] = cells.map((cell) => {\n if (isNodeCell(cell)) {\n const nodeView = getNodeView(cell.id);\n return {\n ...cell,\n view: {\n ...cell.view,\n x: nodeView.x! - nodeView.width / 2 + nodePaddings[3],\n y: nodeView.y! - nodeView.height / 2 + nodePaddings[0],\n },\n [SYMBOL_FOR_LAYOUT_INITIALIZED]: true,\n };\n }\n return cell;\n });\n previousLayoutRef.current = newCells.filter(isNodeOrEdgeCell);\n dispatch({ type: \"update-cells\", payload: newCells });\n\n setCentered(false);\n setLayoutInitialized(true);\n }, [cells, dispatch, layout, layoutOptions, setCentered]);\n\n return { centered, setCentered };\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 EdgeCell,\n EdgeLineConf,\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}\n\nexport function useLineMarkers({\n cells,\n defaultEdgeLines,\n markerPrefix,\n}: UseLineMarkersOptions): [\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>,\n markers: LineMarker[],\n] {\n return useMemo(() => {\n // Always put the default stroke marker at the first position,\n // since the connecting line will use it.\n const markers: LineMarker[] = [{ strokeColor: DEFAULT_LINE_STROKE_COLOR }];\n 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 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 ...omitBy(computedLineConf, isUndefined),\n } as ComputedEdgeLineConf;\n if (lineConf.parallelGap === undefined) {\n lineConf.parallelGap = lineConf.interactStrokeWidth;\n }\n const markerEndIndex = addMarker(\n { strokeColor: lineConf.strokeColor },\n markers\n );\n lineConf.markerArrow = `url(#${markerPrefix}${markerEndIndex})`;\n map.set(cell, lineConf);\n }\n }\n return [map, markers];\n }, [cells, defaultEdgeLines, 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","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 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 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 }, [onSwitchActiveTarget, scaleRange, zoomable, zoomer]);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n const root = rootRef.current;\n if (!root) {\n return;\n }\n\n const rootSelection = select(root);\n\n const unsetZoom = () => {\n rootSelection\n .on(\".zoom\", null)\n .on(\".zoom.custom\", null)\n .on(\"wheel\", null);\n };\n\n if (!(zoomable || scrollable || pannable)) {\n unsetZoom();\n return;\n }\n\n if (zoomable || scrollable) {\n // Do not override default d3 zoom handler.\n // Only handles *panning*\n rootSelection.on(\n \"wheel.zoom.custom\",\n (e: WheelEvent & { wheelDeltaX: number; wheelDeltaY: number }) => {\n // Mac OS trackpad pinch event is emitted as a wheel.zoom and d3.event.ctrlKey set to true\n if (!e.ctrlKey) {\n // Stop immediate propagation for default d3 zoom handler\n e.stopImmediatePropagation();\n if (scrollable) {\n e.preventDefault();\n zoomer.translateBy(\n rootSelection,\n e.wheelDeltaX / 5,\n e.wheelDeltaY / 5\n );\n }\n }\n // zoomer.scaleBy(rootSelection, Math.pow(2, defaultWheelDelta(e)))\n }\n );\n }\n\n rootSelection\n .call(zoomer)\n .on(\"wheel\", (e: WheelEvent) => e.preventDefault())\n .on(\"dblclick.zoom\", null)\n .on(\"mousedown.zoom\", null);\n\n if (!pannable) {\n rootSelection\n .on(\"touchstart.zoom\", null)\n .on(\"touchmove.zoom\", null)\n .on(\"touchend.zoom\", null);\n }\n\n return unsetZoom;\n }, [pannable, rootRef, scrollable, zoomable, zoomer]);\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}.zoom-slider,\n.center-button{width:100%;display:flex;align-items:center;border:1px solid var(--antd-background-color-base);border-radius:var(--larger-border-radius);box-shadow:var(--connected-overlay-shadow);background-color:var(--color-fill-bg-container-4)}.zoom-slider{height:140px;padding:8px 0;flex-direction:column}[role=\"button\"]{cursor:pointer}.center-button{justify-content:center;margin-bottom:8px;height:40px}.center-button:hover{border-color:var(--antd-btn-default-hover-border-color)}.center-button path{fill:var(--antd-link-hover-color)}.center-button:hover path{fill:var(--palette-blue-7)}.zoom-button{font-size:16px;line-height:0}.zoom-button svg{width:1em;height:1em;fill:var(--antd-link-hover-color)}.zoom-slider .ant-slider-vertical{padding-inline:5px}.zoom-slider .ant-slider-vertical .ant-slider-rail{width:2px}.zoom-slider .ant-slider-vertical .ant-slider-handle{width:6px;height:6px;inset-inline-start:3px}.zoom-slider .ant-slider .ant-slider-handle:hover::before,\n.zoom-slider .ant-slider .ant-slider-handle:focus::before,\n.zoom-slider .ant-slider .ant-slider-handle::before{width:10px;height:10px;inset-inline-start:-2px}.zoom-slider .ant-slider .ant-slider-handle:hover::after,\n.zoom-slider .ant-slider .ant-slider-handle:focus::after,\n.zoom-slider .ant-slider .ant-slider-handle::after{width:6px;height:6px;inset-block-start:0;inset-inline-start:0}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden;--animation-dasharray:48;--stroke-dashoffset:96;--dasharray:4}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}@keyframes dashedAnimation{0%{stroke-dashoffset:var(--stroke-dashoffset)}to{stroke-dashoffset:0}}@keyframes solidAnimation{to{stroke-dashoffset:0}}.solid-animation{stroke-dasharray:var(--solid-length);stroke-dashoffset:var(--solid-length);animation:solidAnimation var(--time) linear infinite}.dashed-animation{animation:dashedAnimation var(--time) linear infinite}.decorator-area .area{fill:rgba(119,141,195,0.1);stroke:none;stroke-width:0}.node,\n.decorator-text{overflow:visible}.cell.active .decorator-area .area,\n.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:var(--dasharray);stroke-width:1}.cell:not(.read-only){-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-handle{cursor:nwse-resize;opacity:0}.resize-handle rect{fill:transparent;stroke:none}.resize-handle path{fill:none;stroke:var(--palette-gray-5);stroke-width:1.5}.cell.active .decorator-area .resize-handle,\n.decorator-area:hover .resize-handle{opacity:1}.connect-line{pointer-events:none}.connect-line:not(.connecting){display:none}.line.dashed{stroke-dasharray:var(--dasharray)}.cell.active .decorator-text .text-container{outline:1px dashed var(--palette-blue-5)}.decorator-text .text-container{width:-webkit-max-content;width:-moz-max-content;width:max-content;padding:0.5em}.decorator-text .text:focus{outline:none}.cell.faded{opacity:0.3}.cell .node{pointer-events:none}.cell .node > *{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)}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n"],"names":["MarkerComponent","_ref","Component","id","type","strokeColor","EntityRelationZeroOrOneMarker","EntityRelationZeroOrManyMarker","ArrowMarker","React","_ref2","viewBox","refX","refY","markerWidth","markerHeight","orient","strokeLinejoin","d","stroke","strokeWidth","fill","_ref3","_ref4","getDirectLinePoints","source","target","parallelGap","doTwoNodesOverlap","p0","p1","xDiff","yDiff","dx","x","dy","y","angle","Math","atan2","cos","PI","sin","line","sourceIntersections","getIntersections","targetIntersections","length","rect","vertices","width","height","possibleLines","i","push","intersections","item","intersection","intersect","x1","y1","x2","y2","x3","y3","x4","y4","denominator","ua","ub","a","b","paddingA","paddingB","A","getNodesWithPadding","B","left","min","right","max","top","bottom","node","padding","extractPartialRectTuple","value","Array","isArray","v0","v1","findNode","cells","find","cell","isNodeCell","EdgeComponent","_lineConf$animate$dur","_pathRef$current","_pathRef$current$getT","edge","lineConfMap","pathRef","useRef","sourceNode","useMemo","targetNode","lineConf","get","some","isEdgeCell","view","nodeViewToNodeRect","concat","interactStrokeWidth","ref","className","classNames","dashed","animate","useAnimate","style","duration","DEFAULT_LINE_INTERACT_ANIMATE_DURATION","current","getTotalLength","call","markerStart","showStartArrow","markerArrow","markerEnd","showEndArrow","NodeComponent","degraded","degradedNodeLabel","defaultNodeBricks","onResize","memoizedData","memoizedValue","setMemoizedValue","useState","useEffect","prev","isEqual","useDeepMemo","data","specifiedUseBrick","useBrick","observerRef","_defaultNodeBricks$fi","checkIfByTransform","label","String","__secret_internals","legacyDoTransform","refCallback","useCallback","element","prevObserver","disconnect","setTimeout","observer","ResizeObserver","offsetWidth","offsetHeight","observe","degradedRefCallBack","g","size","getBBox","ReactUseBrick","cx","cy","r","cellToTarget","pick","handleMouseDown","event","action","scale","layout","onCellMoving","onCellMoved","onCellResizing","onCellResized","onSwitchActiveTarget","stopPropagation","from","clientX","clientY","original","moved","handleMove","e","finished","movement","getMovement","onMouseMove","onMouseUp","document","removeEventListener","addEventListener","DecoratorArea","transform","readOnly","resizeHandleRef","resizeHandle","onMouseDown","k","DecoratorText","_cell$view$text","onDecoratorTextEditing","onDecoratorTextChange","text","currentLabel","setCurrentLabel","editingLabel","setEditingLabel","editingLabelInitialized","shouldEmitLabelChange","setShouldEmitLabelChange","handleEnableEdit","preventDefault","textContent","focus","range","createRange","selectNodeContents","selection","window","getSelection","removeAllRanges","addRange","selectAllText","editing","handleInput","handleBlur","_objectSpread","onDoubleClick","contentEditable","onInput","onBlur","DecoratorComponent","SpecifiedComponent","decorator","console","error","CellComponent","active","unrelatedCells","onCellContextMenu","onNodeBrickResize","onCellMouseEnter","onCellMouseLeave","gRef","unrelated","sameTarget","handleContextMenu","handleMouseEnter","handleMouseLeave","faded","undefined","onContextMenu","onMouseEnter","onMouseLeave","isDecoratorCell","SYMBOL_FOR_SIZE_INITIALIZED","Symbol","for","SYMBOL_FOR_LAYOUT_INITIALIZED","DEFAULT_NODE_SIZE","DEFAULT_NODE_GAP","DEFAULT_AREA_WIDTH","DEFAULT_AREA_HEIGHT","DEFAULT_SCALE_RANGE_MIN","DEFAULT_SCALE_RANGE_MAX","DEFAULT_LINE_STROKE_COLOR","DEFAULT_LINE_STROKE_WIDTH","DEFAULT_LINE_INTERACT_STROKE_WIDTH","DEFAULT_LINE_INTERACT_SHOW_START_ARROW","DEFAULT_LINE_INTERACT_SHOW_END_ARROW","DEFAULT_DEGRADED_THRESHOLD","isInitialNodeCell","isNodeOrEdgeCell","getUnrelatedCells","connectLineState","activeTarget","existedTargets","Set","add","has","nodesMap","Map","relatedNodeIds","set","initializeCells","initialCells","defaultNodeSize","map","_cell$view","_cell$view2","transformToCenter","canvasWidth","canvasHeight","scaleRange","Infinity","empty","insertCellAfter","newCell","after","index","findLastIndex","slice","reducers","rootReducer","state","payload","findIndex","Object","fromEntries","entries","key","props","_extends","xmlns","ZoomBarComponent","shadowRoot","onZoomChange","onReCenter","currentTheme","useCurrentTheme","cache","createCache","zoomBarRef","tooltip","formatter","placement","getPopupContainer","onZoomIn","onZoomOut","ConfigProvider","theme","algorithm","darkAlgorithm","defaultAlgorithm","StyleProvider","container","autoClear","hashPriority","onClick","role","CenterSVG","ZoomInSVG","Slider","step","vertical","included","onChange","ZoomOutSVG","dagreLayout","layoutOptions","_nodePadding$rankdir$","nodePadding","rankdir","ranksep","edgesep","nodesep","dagreGraphOptions","_objectWithoutProperties","_excluded","nodePaddings","getNodeView","graph","dagre","Graph","setGraph","setDefaultEdgeLabel","setNode","setEdge","forceLayout","center","fixedPosition","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","useActiveTarget","cellsRef","_activeTarget","onActiveTargetChange","newActiveTarget","setActiveTarget","previous","activeTargetChangeInitialized","resetActiveTarget","composedPath","indexOf","useLayout","rootRef","zoomable","zoomer","dispatch","layoutInitialized","setLayoutInitialized","centered","setCentered","root","clientWidth","clientHeight","select","ZoomTransform","useAutoCenter","previousLayoutRef","filter","every","v","newCells","nodeView","useLineMarkers","defaultEdgeLines","markerPrefix","markers","WeakMap","_loop","_secret_internals$le","computedLineConf","omitBy","isUndefined","markerEndIndex","marker","markerIndex","addMarker","useReady","useZoom","scrollable","pannable","_scaleRange","grabbing","setGrabbing","setTransform","zoom","scaleExtent","on","rootSelection","unsetZoom","ctrlKey","stopImmediatePropagation","translateBy","wheelDeltaX","wheelDeltaY","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_next_bricks_diagram=self.webpackChunk_next_bricks_diagram||[]).push([[9823],{6094:(e,t,a)=>{a.r(t),a.d(t,{EoDisplayCanvas:()=>we});var n,s,r,i,l,o,c,d,u,h,g,f,p,b,m,v,y,w,k,A,C,N,T,E,M,R,z,W,S,L,x,B,O,j,P,U,_,D,I=a(4635),H=a(918),Y=a(1369),q=a(8449),F=a(4521),J=a(8769),Z=a.n(J),G=a(9929),K=a(9938),Q=(a(330),a(1030)),V=a(3373),X=a.n(V),$=a(7566),ee=a(3739),te=a(8185),ae=a(2830),ne=a(3783),se=a(3033),re=a(8091),ie=a(1819),le=a(1083),oe=a(227),ce=a(531),de=a(7099),ue=a(2361),he=a(8197),ge=a(7531),fe=a(3012),pe=a(8618);function be(e,t,a){return a(ye(e,t))}function me(e,t,a){return e.set(ye(e,t),a),a}function ve(e,t){return e.get(ye(e,t))}function ye(e,t,a){if("function"==typeof e?e===t:e.has(t))return arguments.length<3?t:a;throw new TypeError("Private element is not present on this object")}var we,{defineElement:ke,property:Ae,event:Ce}=(0,G.createDecorators)(),Ne=new WeakMap,Te=new WeakMap,Ee=new WeakMap,Me=new WeakMap,Re=new WeakMap,ze=new WeakMap,We=new WeakMap,Se=new WeakMap,Le=new WeakMap,xe=new WeakMap,Be=new WeakMap,Oe=new WeakMap,je=new WeakMap,Pe=new WeakMap,Ue=new WeakMap,_e=new WeakSet,De=new WeakMap,Ie=new WeakMap,He=new WeakMap,Ye=new WeakMap;class qe extends K.ReactNextElement{constructor(){super(...arguments),(0,I.A)(this,_e),(0,H.A)(this,Ne,s(this)),(0,H.A)(this,Te,(r(this),i(this))),(0,H.A)(this,Ee,(l(this),o(this))),(0,H.A)(this,Me,(c(this),d(this,[se.HP,se.HP]))),(0,H.A)(this,Re,(u(this),h(this))),(0,H.A)(this,ze,(g(this),f(this))),(0,H.A)(this,We,(p(this),b(this))),(0,H.A)(this,Se,(m(this),v(this))),(0,H.A)(this,Le,(y(this),w(this))),(0,H.A)(this,xe,(k(this),A(this))),(0,H.A)(this,Be,(C(this),N(this,!0))),(0,H.A)(this,Oe,(T(this),E(this,!0))),(0,H.A)(this,je,(M(this),R(this,!0))),(0,H.A)(this,Pe,(z(this),W(this))),(0,H.A)(this,Ue,(S(this),L(this))),(0,H.A)(this,De,(O(this),e=>{be(_e,this,x).emit(e)})),(0,H.A)(this,Ie,(e=>{(0,te.c)(e,this.activeTarget)||(this.activeTarget=e)})),(0,H.A)(this,He,j(this)),(0,H.A)(this,Ye,(_(this),e=>{be(_e,this,P).emit(e)}))}get cells(){return ve(Ne,this)}set cells(e){me(Ne,this,e)}get layout(){return ve(Te,this)}set layout(e){me(Te,this,e)}get layoutOptions(){return ve(Ee,this)}set layoutOptions(e){me(Ee,this,e)}get defaultNodeSize(){return ve(Me,this)}set defaultNodeSize(e){me(Me,this,e)}get defaultNodeBricks(){return ve(Re,this)}set defaultNodeBricks(e){me(Re,this,e)}get degradedThreshold(){return ve(ze,this)}set degradedThreshold(e){me(ze,this,e)}get degradedNodeLabel(){return ve(We,this)}set degradedNodeLabel(e){me(We,this,e)}get defaultEdgeLines(){return ve(Se,this)}set defaultEdgeLines(e){me(Se,this,e)}get activeTarget(){return ve(Le,this)}set activeTarget(e){me(Le,this,e)}get fadeUnrelatedCells(){return ve(xe,this)}set fadeUnrelatedCells(e){me(xe,this,e)}get zoomable(){return ve(Be,this)}set zoomable(e){me(Be,this,e)}get scrollable(){return ve(Oe,this)}set scrollable(e){me(Oe,this,e)}get pannable(){return ve(je,this)}set pannable(e){me(je,this,e)}get scaleRange(){return ve(Pe,this)}set scaleRange(e){me(Pe,this,e)}render(){return Z().createElement(Fe,{shadowRoot:this.shadowRoot,cells:this.cells,layout:this.layout,layoutOptions:this.layoutOptions,defaultNodeSize:this.defaultNodeSize,defaultNodeBricks:this.defaultNodeBricks,defaultEdgeLines:this.defaultEdgeLines,degradedThreshold:this.degradedThreshold,degradedNodeLabel:this.degradedNodeLabel,activeTarget:this.activeTarget,fadeUnrelatedCells:this.fadeUnrelatedCells,zoomable:this.zoomable,scrollable:this.scrollable,pannable:this.pannable,scaleRange:this.scaleRange,onActiveTargetChange:ve(De,this),onSwitchActiveTarget:ve(Ie,this),onCellContextMenu:ve(Ye,this)})}}function Fe(e){var{shadowRoot:t,cells:a,layout:n,layoutOptions:s,defaultNodeSize:r,defaultNodeBricks:i,defaultEdgeLines:l,degradedThreshold:o,degradedNodeLabel:c,activeTarget:d,fadeUnrelatedCells:u,zoomable:h,scrollable:g,pannable:f,scaleRange:p,onActiveTargetChange:b,onSwitchActiveTarget:m,onCellContextMenu:v}=e,[{cells:y},w]=(0,J.useReducer)(le.d,a,(e=>({cells:(0,ne.C)(e,{defaultNodeSize:r})}))),k=(0,J.useMemo)((()=>y.filter(ce.N).length>=(null!=o?o:se.pC)),[y,o]),A=(0,J.useRef)(null),C=(0,J.useRef)(null),{grabbing:N,transform:T,zoomer:E,scaleRange:M}=(0,re.f)({rootRef:A,zoomable:h,scrollable:g,pannable:f,scaleRange:p,onSwitchActiveTarget:m}),{centered:R,setCentered:z}=(0,ue.g)({layout:n,layoutOptions:s,rootRef:A,cells:y,zoomable:h,zoomer:E,scaleRange:M,dispatch:w}),W=(0,ie.J)({cellsRef:C,activeTarget:d,onActiveTargetChange:b}),S=(0,J.useMemo)((()=>"".concat((0,Q.uniqueId)("diagram-"),"-")),[]),L="".concat(S,"line-arrow-"),x=(0,J.useCallback)(((e,t)=>{w({type:"update-node-size",payload:{id:e,size:t}})}),[]),[B,O]=(0,J.useState)(null),j=(0,J.useCallback)((e=>{O(e)}),[]),P=(0,J.useCallback)((e=>{O((t=>t===e?null:t))}),[]),[U,_]=(0,J.useState)([]);(0,J.useEffect)((()=>{var e=u?(0,oe.Y)(y,null,B):[];_((t=>0===t.length&&0===e.length?t:e))}),[y,u,B]);var D=(0,J.useCallback)((e=>{E.scaleTo((0,$.A)(A.current),e/100)}),[E]),I=(0,J.useCallback)((()=>{z(!1)}),[z]),[H,Y]=(0,ge.d)({cells:y,defaultEdgeLines:l,markerPrefix:L}),q=(0,he.H)({cells:y,layout:n,centered:R});return Z().createElement(Z().Fragment,null,Z().createElement("svg",{width:"100%",height:"100%",ref:A,className:X()("root",{grabbing:N,pannable:f,ready:q}),tabIndex:-1},Z().createElement("defs",null,Y.map(((e,t)=>Z().createElement(ee.c,{key:t,id:"".concat(L).concat(t),type:"arrow",strokeColor:e.strokeColor})))),Z().createElement("g",{transform:"translate(".concat(T.x," ").concat(T.y,") scale(").concat(T.k,")")},Z().createElement("g",{className:"cells",ref:C},y.map((e=>Z().createElement(ae.m,{key:"".concat(e.type,":").concat((0,ce.WW)(e)?"".concat(e.source,"~").concat(e.target):e.id),layout:void 0,cell:e,cells:y,degraded:k,degradedNodeLabel:c,defaultNodeBricks:i,lineConfMap:H,transform:T,active:(0,te.c)(W,e),readOnly:!0,unrelatedCells:U,onSwitchActiveTarget:m,onCellContextMenu:v,onNodeBrickResize:x,onCellMouseEnter:u&&(0,ce.N)(e)?j:void 0,onCellMouseLeave:u&&(0,ce.N)(e)?P:void 0})))))),Z().createElement(de.Y,{shadowRoot:t,scale:T.k,scaleRange:M,onZoomChange:D,onReCenter:I}))}D=qe,({e:[s,r,i,l,o,c,d,u,h,g,f,p,b,m,v,y,w,k,A,C,N,T,E,M,R,z,W,S,L,x,B,O,j,P,U,_],c:[we,n]}=function(e,t,a,n,s,r){var i,l,o,c,d,u,h,g=Symbol.metadata||Symbol.for("Symbol.metadata"),f=Object.defineProperty,p=Object.create,b=[p(null),p(null)],m=t.length;function v(t,a,n){return function(s,r){a&&(r=s,s=e);for(var i=0;i<t.length;i++)r=t[i].apply(s,n?[r]:[]);return n?r:s}}function y(e,t,a,n){if("function"!=typeof e&&(n||void 0!==e))throw new TypeError(t+" must "+(a||"be")+" a function"+(n?"":" or undefined"));return e}function w(e,t,a,n,s,r,o,c,d,u,h){function g(e){if(!h(e))throw new TypeError("Attempted to access private element on non-instance")}var p=[].concat(t[0]),m=t[3],w=!o,k=1===s,A=3===s,C=4===s,N=2===s;function T(t,a,n){return function(s,r){return a&&(r=s,s=e),n&&n(s),E[t].call(s,r)}}if(!w){var E={},M=[],R=A?"get":C||k?"set":"value";if(d?(u||k?E={get:(0,q.A)((function(){return m(this)}),n,"get"),set:function(e){t[4](this,e)}}:E[R]=m,u||(0,q.A)(E[R],n,N?"":R)):u||(E=Object.getOwnPropertyDescriptor(e,n)),!u&&!d){if((l=b[+c][n])&&7!=(l^s))throw new Error("Decorating two elements with the same name ("+E[R].name+") is not supported yet");b[+c][n]=s<3?1:s}}for(var z=e,W=p.length-1;W>=0;W-=a?2:1){var S=p[W],L=a?p[W-1]:void 0,x={},B={kind:["field","accessor","method","getter","setter","class"][s],name:n,metadata:i,addInitializer:function(e,t){if(e.v)throw new Error("attempted to call addInitializer after decoration was finished");y(t,"An initializer","be",!0),r.push(t)}.bind(null,x)};if(w)l=S.call(L,z,B),x.v=1,y(l,"class decorators","return")&&(z=l);else if(B.static=c,B.private=d,l=B.access={has:d?h.bind():function(e){return n in e}},C||(l.get=d?N?function(e){return g(e),E.value}:T("get",0,g):function(e){return e[n]}),N||A||(l.set=d?T("set",0,g):function(e,t){e[n]=t}),z=S.call(L,k?{get:E.get,set:E.set}:E[R],B),x.v=1,k){if("object"==typeof z&&z)(l=y(z.get,"accessor.get"))&&(E.get=l),(l=y(z.set,"accessor.set"))&&(E.set=l),(l=y(z.init,"accessor.init"))&&M.unshift(l);else if(void 0!==z)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else y(z,(u?"field":"method")+" decorators","return")&&(u?M.unshift(z):E[R]=z)}return s<2&&o.push(v(M,c,1),v(r,c,0)),u||w||(d?k?o.splice(-1,0,T("get",c),T("set",c)):o.push(N?E[R]:y.call.bind(E[R])):f(e,n,E)),z}function k(e){return f(e,g,{configurable:!0,enumerable:!0,value:i})}return void 0!==r&&(i=r[g]),i=p(null==i?null:i),d=[],u=function(e){e&&d.push(v(e))},(h=function(t,n){for(var r=0;r<a.length;r++){var i=a[r],l=i[1],u=7&l;if((8&l)==t&&!u==n){var h=i[2],g=!!i[3],f=16&l;w(t?e:e.prototype,i,f,g?"#"+h:(0,Y.A)(h),u,u<2?[]:t?c=c||[]:o=o||[],d,!!t,g,n,t&&g?function(t){return(0,F.A)(t)===e}:s)}}})(8,0),h(0,0),h(8,1),h(0,1),u(o),u(c),l=d,m||k(e),{e:l,get c(){var a=[];return m&&[k(e=w(e,[t],0,e.name,5,a)),v(a,1)]}}}(D,[ke("eo-display-canvas",{styleTexts:[fe.A,pe.A]})],[[Ae({attribute:!1}),1,"cells"],[Ae({type:String}),1,"layout"],[Ae({attribute:!1}),1,"layoutOptions"],[Ae({attribute:!1}),1,"defaultNodeSize"],[Ae({attribute:!1}),1,"defaultNodeBricks"],[Ae({type:Number}),1,"degradedThreshold"],[Ae({attribute:!1}),1,"degradedNodeLabel"],[Ae({attribute:!1}),1,"defaultEdgeLines"],[Ae({attribute:!1}),1,"activeTarget"],[Ae({type:Boolean}),1,"fadeUnrelatedCells"],[Ae({type:Boolean}),1,"zoomable"],[Ae({type:Boolean}),1,"scrollable"],[Ae({type:Boolean}),1,"pannable"],[Ae({attribute:!1}),1,"scaleRange"],[Ce({type:"activeTarget.change"}),1,"activeTargetChangeEvent",e=>ve(Ue,e),(e,t)=>me(Ue,e,t)],[Ce({type:"cell.contextmenu"}),1,"cellContextMenu",e=>ve(He,e),(e,t)=>me(He,e,t)]],0,(e=>Ye.has((0,F.A)(e))),K.ReactNext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AC,EAAAC,EAAAC,EAAAC,EAAAK,EAAAuH,EAAA3H,EAAAQ,EAAAG,EAAAiH,EAAAnH,GAAAoH,GAAA5L,GAAA6L,I,yqFA/BqC,E,uBA+BrCC,CAAAN,EAAA,CAtHAvL,GAAc,oBAAqB,CAClC8L,WAAY,CAACC,GAAAA,EAAWC,GAAAA,MACxB,EAKC/L,GAAS,CAAEgM,WAAW,IAAQ,YAG9BhM,GAAS,CAAEiI,KAAMgE,SAAS,aAG1BjM,GAAS,CAAEgM,WAAW,IAAQ,oBAG9BhM,GAAS,CAAEgM,WAAW,IAAQ,sBAG9BhM,GAAS,CAAEgM,WAAW,IAAQ,wBAQ9BhM,GAAS,CAAEiI,KAAMiE,SAAS,wBAW1BlM,GAAS,CAAEgM,WAAW,IAAQ,wBAY9BhM,GAAS,CAAEgM,WAAW,IAAQ,uBAG9BhM,GAAS,CAAEgM,WAAW,IAAQ,mBAM9BhM,GAAS,CAAEiI,KAAMkE,UAAU,yBAG3BnM,GAAS,CAAEiI,KAAMkE,UAAU,eAG3BnM,GAAS,CAAEiI,KAAMkE,UAAU,iBAG3BnM,GAAS,CAAEiI,KAAMkE,UAAU,eAG3BnM,GAAS,CAAEgM,WAAW,IAAQ,iBAG9B/L,GAAM,CAAEgI,KAAM,wBAAwB,4BAAAmE,GAAA1H,GAAAxD,GAAAkL,GAAA,CAAAA,EAAAzH,IAAAC,GAAA1D,GAAAkL,EAAAzH,IAAA,CAatC1E,GAAM,CAAEgI,KAAM,qBAAqB,oBAAAmE,GAAA1H,GAAAnD,GAAA6K,GAAA,CAAAA,EAAAzH,IAAAC,GAAArD,GAAA6K,EAAAzH,KAAA,GAAA0H,GAAA7K,GAAA8K,KAAAC,EAAAA,EAAAA,GAAAF,KApFR3K,EAAAA,mBAAgBiK,G","sources":["webpack:///./src/display-canvas/index.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useMemo,\n useReducer,\n useRef,\n useState,\n} from \"react\";\nimport { createDecorators, type EventEmitter } from \"@next-core/element\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport \"@next-core/theme\";\nimport { uniqueId } from \"lodash\";\nimport classNames from \"classnames\";\nimport { select } from \"d3-selection\";\nimport type { RangeTuple, SizeTuple } from \"../diagram/interfaces\";\nimport type {\n ActiveTarget,\n InitialCell,\n NodeBrickConf,\n CellContextMenuDetail,\n EdgeLineConf,\n Cell,\n LayoutType,\n LayoutOptions,\n} from \"../draw-canvas/interfaces\";\nimport { MarkerComponent } from \"../diagram/MarkerComponent\";\nimport { sameTarget } from \"../draw-canvas/processors/sameTarget\";\nimport { CellComponent } from \"../draw-canvas/CellComponent\";\nimport { initializeCells } from \"../draw-canvas/processors/initializeCells\";\nimport {\n DEFAULT_DEGRADED_THRESHOLD,\n DEFAULT_NODE_SIZE,\n} from \"../draw-canvas/constants\";\nimport { useZoom } from \"../shared/canvas/useZoom\";\nimport { useActiveTarget } from \"../shared/canvas/useActiveTarget\";\nimport { rootReducer } from \"../draw-canvas/reducers\";\nimport { getUnrelatedCells } from \"../draw-canvas/processors/getUnrelatedCells\";\nimport { isEdgeCell, isNodeCell } from \"../draw-canvas/processors/asserts\";\nimport { ZoomBarComponent } from \"../shared/canvas/ZoomBarComponent\";\nimport { useLayout } from \"../shared/canvas/useLayout\";\nimport { useReady } from \"../shared/canvas/useReady\";\nimport { useLineMarkers } from \"../shared/canvas/useLineMarkers\";\nimport styleText from \"../shared/canvas/styles.shadow.css\";\nimport zoomBarStyleText from \"../shared/canvas/ZoomBarComponent.shadow.css\";\n\nconst { defineElement, property, event } = createDecorators();\n\nexport interface EoDisplayCanvasProps {\n cells: InitialCell[] | undefined;\n layout: LayoutType;\n layoutOptions?: LayoutOptions;\n defaultNodeSize: SizeTuple;\n defaultNodeBricks?: NodeBrickConf[];\n defaultEdgeLines?: EdgeLineConf[];\n degradedThreshold?: number;\n degradedNodeLabel?: string;\n activeTarget?: ActiveTarget | null;\n fadeUnrelatedCells?: boolean;\n zoomable?: boolean;\n scrollable?: boolean;\n pannable?: boolean;\n scaleRange?: RangeTuple;\n}\n\n/**\n * 用于展示查看的画布。\n */\nexport\n@defineElement(\"eo-display-canvas\", {\n styleTexts: [styleText, zoomBarStyleText],\n})\nclass EoDisplayCanvas extends ReactNextElement implements EoDisplayCanvasProps {\n /**\n * 仅当初始化时使用,渲染后重新设置 `cells` 将无效。\n */\n @property({ attribute: false })\n accessor cells: InitialCell[] | undefined;\n\n @property({ type: String })\n accessor layout: LayoutType;\n\n @property({ attribute: false })\n accessor layoutOptions: LayoutOptions | undefined;\n\n @property({ attribute: false })\n accessor defaultNodeSize: SizeTuple = [DEFAULT_NODE_SIZE, DEFAULT_NODE_SIZE];\n\n @property({ attribute: false })\n accessor defaultNodeBricks: NodeBrickConf[] | undefined;\n\n /**\n * 当节点数量达到或超过 `degradedThreshold` 时,节点将被降级展示。\n *\n * @default 500\n */\n @property({ type: Number })\n accessor degradedThreshold: number | undefined;\n\n // Set `attribute` to `false` event if it accepts string value.\n // Because when passing like \"<% DATA.node.data.name %>\", it will be\n // evaluated as object temporarily.\n /**\n * 设置节点将降级展示时显示的名称。\n *\n * @default \"<% DATA.node.id %>\"\n */\n @property({ attribute: false })\n accessor degradedNodeLabel: string | undefined;\n\n /**\n * 使用条件判断设置默认的边对应的连线。在 `if` 表达式中 `DATA` 为 `{ edge }`,例如:\n *\n * ```yaml\n * defaultEdgeLines:\n * - if: <% DATA.edge.data?.virtual %>\n * dashed: true\n * ```\n */\n @property({ attribute: false })\n accessor defaultEdgeLines: EdgeLineConf[] | undefined;\n\n @property({ attribute: false })\n accessor activeTarget: ActiveTarget | null | undefined;\n\n /**\n * 当鼠标悬浮到某节点上时,隐藏其他跟该节点无关的元素。\n */\n @property({ type: Boolean })\n accessor fadeUnrelatedCells: boolean | undefined;\n\n @property({ type: Boolean })\n accessor zoomable: boolean | undefined = true;\n\n @property({ type: Boolean })\n accessor scrollable: boolean | undefined = true;\n\n @property({ type: Boolean })\n accessor pannable: boolean | undefined = true;\n\n @property({ attribute: false })\n accessor scaleRange: RangeTuple | undefined;\n\n @event({ type: \"activeTarget.change\" })\n accessor #activeTargetChangeEvent!: EventEmitter<ActiveTarget | null>;\n\n #handleActiveTargetChange = (target: ActiveTarget | null) => {\n this.#activeTargetChangeEvent.emit(target);\n };\n\n #handleSwitchActiveTarget = (target: ActiveTarget | null) => {\n if (!sameTarget(target, this.activeTarget)) {\n this.activeTarget = target;\n }\n };\n\n @event({ type: \"cell.contextmenu\" })\n accessor #cellContextMenu!: EventEmitter<CellContextMenuDetail>;\n\n #handleCellContextMenu = (detail: CellContextMenuDetail) => {\n this.#cellContextMenu.emit(detail);\n };\n\n render() {\n return (\n <EoDisplayCanvasComponent\n shadowRoot={this.shadowRoot!}\n cells={this.cells}\n layout={this.layout}\n layoutOptions={this.layoutOptions}\n defaultNodeSize={this.defaultNodeSize}\n defaultNodeBricks={this.defaultNodeBricks}\n defaultEdgeLines={this.defaultEdgeLines}\n degradedThreshold={this.degradedThreshold}\n degradedNodeLabel={this.degradedNodeLabel}\n activeTarget={this.activeTarget}\n fadeUnrelatedCells={this.fadeUnrelatedCells}\n zoomable={this.zoomable}\n scrollable={this.scrollable}\n pannable={this.pannable}\n scaleRange={this.scaleRange}\n onActiveTargetChange={this.#handleActiveTargetChange}\n onSwitchActiveTarget={this.#handleSwitchActiveTarget}\n onCellContextMenu={this.#handleCellContextMenu}\n />\n );\n }\n}\n\nexport interface EoDisplayCanvasComponentProps extends EoDisplayCanvasProps {\n shadowRoot: ShadowRoot;\n onActiveTargetChange(target: ActiveTarget | null): void;\n onSwitchActiveTarget(target: ActiveTarget | null): void;\n onCellContextMenu(detail: CellContextMenuDetail): void;\n}\n\nfunction EoDisplayCanvasComponent({\n shadowRoot,\n cells: initialCells,\n layout,\n layoutOptions,\n defaultNodeSize,\n defaultNodeBricks,\n defaultEdgeLines,\n degradedThreshold,\n degradedNodeLabel,\n activeTarget: _activeTarget,\n fadeUnrelatedCells,\n zoomable,\n scrollable,\n pannable,\n scaleRange: _scaleRange,\n onActiveTargetChange,\n onSwitchActiveTarget,\n onCellContextMenu,\n}: EoDisplayCanvasComponentProps) {\n const [{ cells }, dispatch] = useReducer(\n rootReducer,\n initialCells,\n (initialCells) => ({\n cells: initializeCells(initialCells, { defaultNodeSize }),\n })\n );\n\n // When nodes are greater or equal to threshold, the diagram will be degraded.\n // Thus all nodes will be displayed as simple svg elements instead of bricks.\n const degraded = useMemo(\n () =>\n cells.filter(isNodeCell).length >=\n (degradedThreshold ?? DEFAULT_DEGRADED_THRESHOLD),\n [cells, degradedThreshold]\n );\n\n const rootRef = useRef<SVGSVGElement>(null);\n const cellsRef = useRef<SVGGElement>(null);\n\n const { grabbing, transform, zoomer, scaleRange } = useZoom({\n rootRef,\n zoomable,\n scrollable,\n pannable,\n scaleRange: _scaleRange,\n onSwitchActiveTarget,\n });\n\n const { centered, setCentered } = useLayout({\n layout,\n layoutOptions,\n rootRef,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n dispatch,\n });\n\n const activeTarget = useActiveTarget({\n cellsRef,\n activeTarget: _activeTarget,\n onActiveTargetChange,\n });\n\n const defPrefix = useMemo(() => `${uniqueId(\"diagram-\")}-`, []);\n const markerPrefix = `${defPrefix}line-arrow-`;\n\n const handleNodeBrickResize = useCallback(\n (id: string, size: SizeTuple | null) => {\n dispatch({ type: \"update-node-size\", payload: { id, size } });\n },\n []\n );\n\n const [hoverCell, setHoverCell] = useState<Cell | null>(null);\n const handleCellMouseEnter = useCallback((cell: Cell) => {\n setHoverCell(cell);\n }, []);\n const handleCellMouseLeave = useCallback((cell: Cell) => {\n setHoverCell((prev) => (prev === cell ? null : prev));\n }, []);\n\n const [unrelatedCells, setUnrelatedCells] = useState<Cell[]>([]);\n useEffect(() => {\n const nextUnrelated = fadeUnrelatedCells\n ? getUnrelatedCells(cells, null, hoverCell)\n : [];\n // Do not update the state when prev and next are both empty.\n setUnrelatedCells((prev) =>\n prev.length === 0 && nextUnrelated.length === 0 ? prev : nextUnrelated\n );\n }, [cells, fadeUnrelatedCells, hoverCell]);\n\n const handleZoomSlide = useCallback(\n (value: number) => {\n // istanbul ignore next\n if (process.env.NODE_ENV !== \"test\") {\n zoomer.scaleTo(select(rootRef.current!), value / 100);\n }\n },\n [zoomer]\n );\n\n const reCenter = useCallback(() => {\n setCentered(false);\n }, [setCentered]);\n\n const [lineConfMap, markers] = useLineMarkers({\n cells,\n defaultEdgeLines,\n markerPrefix,\n });\n\n const ready = useReady({ cells, layout, centered });\n\n return (\n <>\n <svg\n width=\"100%\"\n height=\"100%\"\n ref={rootRef}\n className={classNames(\"root\", { grabbing, pannable, ready })}\n tabIndex={-1}\n >\n <defs>\n {markers.map((marker, index) => (\n <MarkerComponent\n key={index}\n id={`${markerPrefix}${index}`}\n type=\"arrow\"\n strokeColor={marker.strokeColor}\n />\n ))}\n </defs>\n <g\n transform={`translate(${transform.x} ${transform.y}) scale(${transform.k})`}\n >\n <g className=\"cells\" ref={cellsRef}>\n {cells.map((cell) => (\n <CellComponent\n key={`${cell.type}:${isEdgeCell(cell) ? `${cell.source}~${cell.target}` : cell.id}`}\n layout={undefined}\n cell={cell}\n cells={cells}\n degraded={degraded}\n degradedNodeLabel={degradedNodeLabel}\n defaultNodeBricks={defaultNodeBricks}\n lineConfMap={lineConfMap}\n transform={transform}\n active={sameTarget(activeTarget, cell)}\n readOnly\n unrelatedCells={unrelatedCells}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onCellContextMenu={onCellContextMenu}\n onNodeBrickResize={handleNodeBrickResize}\n onCellMouseEnter={\n fadeUnrelatedCells && isNodeCell(cell)\n ? handleCellMouseEnter\n : undefined\n }\n onCellMouseLeave={\n fadeUnrelatedCells && isNodeCell(cell)\n ? handleCellMouseLeave\n : undefined\n }\n />\n ))}\n </g>\n </g>\n </svg>\n <ZoomBarComponent\n shadowRoot={shadowRoot}\n scale={transform.k}\n scaleRange={scaleRange}\n onZoomChange={handleZoomSlide}\n onReCenter={reCenter}\n />\n </>\n );\n}\n"],"names":["_EoDisplayCanvas","defineElement","property","event","createDecorators","_A","WeakMap","_B","_C","_D","_E","_F","_G","_H","_I","_J","_K","_L","_M","_N","_O","_EoDisplayCanvas_brand","WeakSet","_handleActiveTargetChange","_handleSwitchActiveTarget","_P","_handleCellContextMenu","EoDisplayCanvas","ReactNextElement","constructor","arguments","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_init_cells","_init_extra_cells","_init_layout","_init_extra_layout","_init_layoutOptions","_init_extra_layoutOptions","_init_defaultNodeSize","DEFAULT_NODE_SIZE","_init_extra_defaultNodeSize","_init_defaultNodeBricks","_init_extra_defaultNodeBricks","_init_degradedThreshold","_init_extra_degradedThreshold","_init_degradedNodeLabel","_init_extra_degradedNodeLabel","_init_defaultEdgeLines","_init_extra_defaultEdgeLines","_init_activeTarget","_init_extra_activeTarget","_init_fadeUnrelatedCells","_init_extra_fadeUnrelatedCells","_init_zoomable","_init_extra_zoomable","_init_scrollable","_init_extra_scrollable","_init_pannable","_init_extra_pannable","_init_scaleRange","_init_extra_scaleRange","_init_activeTargetChangeEvent","_init_extra_activeTargetChangeEvent","target","_classPrivateGetter","this","_get_activeTargetChangeEvent","emit","sameTarget","activeTarget","_init_cellContextMenu","_init_extra_cellContextMenu","detail","_get_cellContextMenu","cells","_classPrivateFieldGet","v","_classPrivateFieldSet","layout","layoutOptions","defaultNodeSize","defaultNodeBricks","degradedThreshold","degradedNodeLabel","defaultEdgeLines","fadeUnrelatedCells","zoomable","scrollable","pannable","scaleRange","render","React","EoDisplayCanvasComponent","shadowRoot","onActiveTargetChange","onSwitchActiveTarget","onCellContextMenu","_ref","initialCells","_activeTarget","_scaleRange","dispatch","useReducer","rootReducer","initializeCells","degraded","useMemo","filter","isNodeCell","length","DEFAULT_DEGRADED_THRESHOLD","rootRef","useRef","cellsRef","grabbing","transform","zoomer","useZoom","centered","setCentered","useLayout","useActiveTarget","defPrefix","concat","uniqueId","markerPrefix","handleNodeBrickResize","useCallback","id","size","type","payload","hoverCell","setHoverCell","useState","handleCellMouseEnter","cell","handleCellMouseLeave","prev","unrelatedCells","setUnrelatedCells","useEffect","nextUnrelated","getUnrelatedCells","handleZoomSlide","value","scaleTo","select","current","reCenter","lineConfMap","markers","useLineMarkers","ready","useReady","width","height","ref","className","classNames","tabIndex","map","marker","index","MarkerComponent","key","strokeColor","x","y","k","CellComponent","isEdgeCell","source","undefined","active","readOnly","onNodeBrickResize","onCellMouseEnter","onCellMouseLeave","ZoomBarComponent","scale","onZoomChange","onReCenter","_EoDisplayCanvas2","e","_set_activeTargetChangeEvent","_set_cellContextMenu","c","_initClass","_applyDecs","styleTexts","styleText","zoomBarStyleText","attribute","String","Number","Boolean","o","_","has","_checkInRHS"],"sourceRoot":""}