@xyflow/react 12.0.0-next.3 → 12.0.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/additional-components/Background/Background.d.ts +5 -5
- package/dist/esm/additional-components/Background/Background.d.ts.map +1 -1
- package/dist/esm/additional-components/Background/index.d.ts +2 -2
- package/dist/esm/additional-components/Background/index.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/ControlButton.d.ts +1 -3
- package/dist/esm/additional-components/Controls/ControlButton.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/Controls.d.ts +7 -3
- package/dist/esm/additional-components/Controls/Controls.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/Icons/FitView.d.ts +1 -2
- package/dist/esm/additional-components/Controls/Icons/FitView.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/Icons/Lock.d.ts +1 -2
- package/dist/esm/additional-components/Controls/Icons/Lock.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/Icons/Minus.d.ts +1 -2
- package/dist/esm/additional-components/Controls/Icons/Minus.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/Icons/Plus.d.ts +1 -2
- package/dist/esm/additional-components/Controls/Icons/Plus.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/Icons/Unlock.d.ts +1 -2
- package/dist/esm/additional-components/Controls/Icons/Unlock.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/index.d.ts +3 -3
- package/dist/esm/additional-components/Controls/index.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/types.d.ts +2 -1
- package/dist/esm/additional-components/Controls/types.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/MiniMap.d.ts +4 -4
- package/dist/esm/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/MiniMapNode.d.ts +3 -3
- package/dist/esm/additional-components/MiniMap/MiniMapNode.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/index.d.ts +1 -1
- package/dist/esm/additional-components/MiniMap/index.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts +7 -0
- package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -0
- package/dist/esm/additional-components/NodeResizer/NodeResizer.d.ts +2 -2
- package/dist/esm/additional-components/NodeResizer/NodeResizer.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/ResizeControl.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/index.d.ts +2 -2
- package/dist/esm/additional-components/NodeResizer/index.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/types.d.ts +1 -23
- package/dist/esm/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeToolbar/NodeToolbar.d.ts +2 -3
- package/dist/esm/additional-components/NodeToolbar/NodeToolbar.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeToolbar/NodeToolbarPortal.d.ts +1 -2
- package/dist/esm/additional-components/NodeToolbar/NodeToolbarPortal.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeToolbar/index.d.ts +2 -2
- package/dist/esm/additional-components/NodeToolbar/index.d.ts.map +1 -1
- package/dist/esm/components/A11yDescriptions/index.d.ts +1 -2
- package/dist/esm/components/A11yDescriptions/index.d.ts.map +1 -1
- package/dist/esm/components/Attribution/index.d.ts +2 -2
- package/dist/esm/components/Attribution/index.d.ts.map +1 -1
- package/dist/esm/components/ConnectionLine/index.d.ts +2 -2
- package/dist/esm/components/ConnectionLine/index.d.ts.map +1 -1
- package/dist/esm/components/EdgeLabelRenderer/index.d.ts +1 -2
- package/dist/esm/components/EdgeLabelRenderer/index.d.ts.map +1 -1
- package/dist/esm/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +2 -2
- package/dist/esm/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
- package/dist/esm/components/EdgeWrapper/index.d.ts +1 -6
- package/dist/esm/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/esm/components/Edges/BaseEdge.d.ts +1 -5
- package/dist/esm/components/Edges/BaseEdge.d.ts.map +1 -1
- package/dist/esm/components/Edges/EdgeAnchor.d.ts +2 -2
- package/dist/esm/components/Edges/EdgeAnchor.d.ts.map +1 -1
- package/dist/esm/components/Edges/EdgeText.d.ts +7 -3
- package/dist/esm/components/Edges/EdgeText.d.ts.map +1 -1
- package/dist/esm/components/Handle/index.d.ts +1 -2
- package/dist/esm/components/Handle/index.d.ts.map +1 -1
- package/dist/esm/components/NodeWrapper/index.d.ts +1 -6
- package/dist/esm/components/NodeWrapper/index.d.ts.map +1 -1
- package/dist/esm/components/Nodes/DefaultNode.d.ts +1 -6
- package/dist/esm/components/Nodes/DefaultNode.d.ts.map +1 -1
- package/dist/esm/components/Nodes/GroupNode.d.ts +1 -5
- package/dist/esm/components/Nodes/GroupNode.d.ts.map +1 -1
- package/dist/esm/components/Nodes/InputNode.d.ts +1 -6
- package/dist/esm/components/Nodes/InputNode.d.ts.map +1 -1
- package/dist/esm/components/Nodes/OutputNode.d.ts +1 -6
- package/dist/esm/components/Nodes/OutputNode.d.ts.map +1 -1
- package/dist/esm/components/Nodes/utils.d.ts.map +1 -1
- package/dist/esm/components/NodesSelection/index.d.ts +1 -3
- package/dist/esm/components/NodesSelection/index.d.ts.map +1 -1
- package/dist/esm/components/Panel/index.d.ts +2 -3
- package/dist/esm/components/Panel/index.d.ts.map +1 -1
- package/dist/esm/components/ReactFlowProvider/index.d.ts +1 -5
- package/dist/esm/components/ReactFlowProvider/index.d.ts.map +1 -1
- package/dist/esm/components/SelectionListener/index.d.ts +2 -2
- package/dist/esm/components/SelectionListener/index.d.ts.map +1 -1
- package/dist/esm/components/StoreUpdater/index.d.ts +2 -2
- package/dist/esm/components/StoreUpdater/index.d.ts.map +1 -1
- package/dist/esm/components/UserSelection/index.d.ts +1 -2
- package/dist/esm/components/UserSelection/index.d.ts.map +1 -1
- package/dist/esm/components/ViewportPortal/index.d.ts +1 -2
- package/dist/esm/components/ViewportPortal/index.d.ts.map +1 -1
- package/dist/esm/container/EdgeRenderer/MarkerSymbols.d.ts +1 -1
- package/dist/esm/container/EdgeRenderer/MarkerSymbols.d.ts.map +1 -1
- package/dist/esm/container/EdgeRenderer/index.d.ts +6 -5
- package/dist/esm/container/EdgeRenderer/index.d.ts.map +1 -1
- package/dist/esm/container/FlowRenderer/index.d.ts +1 -2
- package/dist/esm/container/FlowRenderer/index.d.ts.map +1 -1
- package/dist/esm/container/GraphView/index.d.ts +6 -5
- package/dist/esm/container/GraphView/index.d.ts.map +1 -1
- package/dist/esm/container/GraphView/useNodeOrEdgeTypesWarning.d.ts +0 -1
- package/dist/esm/container/GraphView/useNodeOrEdgeTypesWarning.d.ts.map +1 -1
- package/dist/esm/container/NodeRenderer/index.d.ts +1 -2
- package/dist/esm/container/NodeRenderer/index.d.ts.map +1 -1
- package/dist/esm/container/NodeRenderer/useResizeObserver.d.ts +1 -1
- package/dist/esm/container/NodeRenderer/useResizeObserver.d.ts.map +1 -1
- package/dist/esm/container/Pane/index.d.ts +2 -2
- package/dist/esm/container/Pane/index.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/Wrapper.d.ts +1 -5
- package/dist/esm/container/ReactFlow/Wrapper.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/index.d.ts +1 -1
- package/dist/esm/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/esm/container/Viewport/index.d.ts +1 -1
- package/dist/esm/container/Viewport/index.d.ts.map +1 -1
- package/dist/esm/container/ZoomPane/index.d.ts +2 -2
- package/dist/esm/container/ZoomPane/index.d.ts.map +1 -1
- package/dist/esm/hooks/useColorModeClass.d.ts +1 -1
- package/dist/esm/hooks/useColorModeClass.d.ts.map +1 -1
- package/dist/esm/hooks/useDrag.d.ts +2 -2
- package/dist/esm/hooks/useDrag.d.ts.map +1 -1
- package/dist/esm/hooks/useEdges.d.ts +1 -2
- package/dist/esm/hooks/useEdges.d.ts.map +1 -1
- package/dist/esm/hooks/useGlobalKeyHandler.d.ts +2 -3
- package/dist/esm/hooks/useGlobalKeyHandler.d.ts.map +1 -1
- package/dist/esm/hooks/useKeyPress.d.ts +1 -2
- package/dist/esm/hooks/useKeyPress.d.ts.map +1 -1
- package/dist/esm/hooks/useNodes.d.ts +1 -2
- package/dist/esm/hooks/useNodes.d.ts.map +1 -1
- package/dist/esm/hooks/useNodesInitialized.d.ts +1 -2
- package/dist/esm/hooks/useNodesInitialized.d.ts.map +1 -1
- package/dist/esm/hooks/useOnInitHandler.d.ts +1 -2
- package/dist/esm/hooks/useOnInitHandler.d.ts.map +1 -1
- package/dist/esm/hooks/useOnSelectionChange.d.ts +1 -2
- package/dist/esm/hooks/useOnSelectionChange.d.ts.map +1 -1
- package/dist/esm/hooks/useOnViewportChange.d.ts +1 -2
- package/dist/esm/hooks/useOnViewportChange.d.ts.map +1 -1
- package/dist/esm/hooks/useReactFlow.d.ts +1 -1
- package/dist/esm/hooks/useReactFlow.d.ts.map +1 -1
- package/dist/esm/hooks/useResizeHandler.d.ts +1 -2
- package/dist/esm/hooks/useResizeHandler.d.ts.map +1 -1
- package/dist/esm/hooks/useUpdateNodeInternals.d.ts +1 -2
- package/dist/esm/hooks/useUpdateNodeInternals.d.ts.map +1 -1
- package/dist/esm/hooks/useUpdateNodePositions.d.ts +1 -2
- package/dist/esm/hooks/useUpdateNodePositions.d.ts.map +1 -1
- package/dist/esm/hooks/useViewport.d.ts +1 -2
- package/dist/esm/hooks/useViewport.d.ts.map +1 -1
- package/dist/esm/hooks/useViewportSync.d.ts +1 -1
- package/dist/esm/hooks/useViewportSync.d.ts.map +1 -1
- package/dist/esm/hooks/useVisibleEdgeIds.d.ts +1 -2
- package/dist/esm/hooks/useVisibleEdgeIds.d.ts.map +1 -1
- package/dist/esm/hooks/useVisibleNodeIds.d.ts +1 -2
- package/dist/esm/hooks/useVisibleNodeIds.d.ts.map +1 -1
- package/dist/esm/index.d.ts +18 -18
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +267 -355
- package/dist/esm/index.mjs +267 -355
- package/dist/esm/types/changes.d.ts +0 -1
- package/dist/esm/types/changes.d.ts.map +1 -1
- package/dist/esm/types/component-props.d.ts +1 -1
- package/dist/esm/utils/changes.d.ts +2 -2
- package/dist/esm/utils/changes.d.ts.map +1 -1
- package/dist/style.css +3 -2
- package/dist/umd/additional-components/Background/Background.d.ts +5 -5
- package/dist/umd/additional-components/Background/Background.d.ts.map +1 -1
- package/dist/umd/additional-components/Background/index.d.ts +2 -2
- package/dist/umd/additional-components/Background/index.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/ControlButton.d.ts +1 -3
- package/dist/umd/additional-components/Controls/ControlButton.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/Controls.d.ts +7 -3
- package/dist/umd/additional-components/Controls/Controls.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/Icons/FitView.d.ts +1 -2
- package/dist/umd/additional-components/Controls/Icons/FitView.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/Icons/Lock.d.ts +1 -2
- package/dist/umd/additional-components/Controls/Icons/Lock.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/Icons/Minus.d.ts +1 -2
- package/dist/umd/additional-components/Controls/Icons/Minus.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/Icons/Plus.d.ts +1 -2
- package/dist/umd/additional-components/Controls/Icons/Plus.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/Icons/Unlock.d.ts +1 -2
- package/dist/umd/additional-components/Controls/Icons/Unlock.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/index.d.ts +3 -3
- package/dist/umd/additional-components/Controls/index.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/types.d.ts +2 -1
- package/dist/umd/additional-components/Controls/types.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/MiniMap.d.ts +4 -4
- package/dist/umd/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/MiniMapNode.d.ts +3 -3
- package/dist/umd/additional-components/MiniMap/MiniMapNode.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/index.d.ts +1 -1
- package/dist/umd/additional-components/MiniMap/index.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts +7 -0
- package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -0
- package/dist/umd/additional-components/NodeResizer/NodeResizer.d.ts +2 -2
- package/dist/umd/additional-components/NodeResizer/NodeResizer.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/ResizeControl.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/index.d.ts +2 -2
- package/dist/umd/additional-components/NodeResizer/index.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/types.d.ts +1 -23
- package/dist/umd/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeToolbar/NodeToolbar.d.ts +2 -3
- package/dist/umd/additional-components/NodeToolbar/NodeToolbar.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeToolbar/NodeToolbarPortal.d.ts +1 -2
- package/dist/umd/additional-components/NodeToolbar/NodeToolbarPortal.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeToolbar/index.d.ts +2 -2
- package/dist/umd/additional-components/NodeToolbar/index.d.ts.map +1 -1
- package/dist/umd/components/A11yDescriptions/index.d.ts +1 -2
- package/dist/umd/components/A11yDescriptions/index.d.ts.map +1 -1
- package/dist/umd/components/Attribution/index.d.ts +2 -2
- package/dist/umd/components/Attribution/index.d.ts.map +1 -1
- package/dist/umd/components/ConnectionLine/index.d.ts +2 -2
- package/dist/umd/components/ConnectionLine/index.d.ts.map +1 -1
- package/dist/umd/components/EdgeLabelRenderer/index.d.ts +1 -2
- package/dist/umd/components/EdgeLabelRenderer/index.d.ts.map +1 -1
- package/dist/umd/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +2 -2
- package/dist/umd/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
- package/dist/umd/components/EdgeWrapper/index.d.ts +1 -6
- package/dist/umd/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/umd/components/Edges/BaseEdge.d.ts +1 -5
- package/dist/umd/components/Edges/BaseEdge.d.ts.map +1 -1
- package/dist/umd/components/Edges/EdgeAnchor.d.ts +2 -2
- package/dist/umd/components/Edges/EdgeAnchor.d.ts.map +1 -1
- package/dist/umd/components/Edges/EdgeText.d.ts +7 -3
- package/dist/umd/components/Edges/EdgeText.d.ts.map +1 -1
- package/dist/umd/components/Handle/index.d.ts +1 -2
- package/dist/umd/components/Handle/index.d.ts.map +1 -1
- package/dist/umd/components/NodeWrapper/index.d.ts +1 -6
- package/dist/umd/components/NodeWrapper/index.d.ts.map +1 -1
- package/dist/umd/components/Nodes/DefaultNode.d.ts +1 -6
- package/dist/umd/components/Nodes/DefaultNode.d.ts.map +1 -1
- package/dist/umd/components/Nodes/GroupNode.d.ts +1 -5
- package/dist/umd/components/Nodes/GroupNode.d.ts.map +1 -1
- package/dist/umd/components/Nodes/InputNode.d.ts +1 -6
- package/dist/umd/components/Nodes/InputNode.d.ts.map +1 -1
- package/dist/umd/components/Nodes/OutputNode.d.ts +1 -6
- package/dist/umd/components/Nodes/OutputNode.d.ts.map +1 -1
- package/dist/umd/components/Nodes/utils.d.ts.map +1 -1
- package/dist/umd/components/NodesSelection/index.d.ts +1 -3
- package/dist/umd/components/NodesSelection/index.d.ts.map +1 -1
- package/dist/umd/components/Panel/index.d.ts +2 -3
- package/dist/umd/components/Panel/index.d.ts.map +1 -1
- package/dist/umd/components/ReactFlowProvider/index.d.ts +1 -5
- package/dist/umd/components/ReactFlowProvider/index.d.ts.map +1 -1
- package/dist/umd/components/SelectionListener/index.d.ts +2 -2
- package/dist/umd/components/SelectionListener/index.d.ts.map +1 -1
- package/dist/umd/components/StoreUpdater/index.d.ts +2 -2
- package/dist/umd/components/StoreUpdater/index.d.ts.map +1 -1
- package/dist/umd/components/UserSelection/index.d.ts +1 -2
- package/dist/umd/components/UserSelection/index.d.ts.map +1 -1
- package/dist/umd/components/ViewportPortal/index.d.ts +1 -2
- package/dist/umd/components/ViewportPortal/index.d.ts.map +1 -1
- package/dist/umd/container/EdgeRenderer/MarkerSymbols.d.ts +1 -1
- package/dist/umd/container/EdgeRenderer/MarkerSymbols.d.ts.map +1 -1
- package/dist/umd/container/EdgeRenderer/index.d.ts +6 -5
- package/dist/umd/container/EdgeRenderer/index.d.ts.map +1 -1
- package/dist/umd/container/FlowRenderer/index.d.ts +1 -2
- package/dist/umd/container/FlowRenderer/index.d.ts.map +1 -1
- package/dist/umd/container/GraphView/index.d.ts +6 -5
- package/dist/umd/container/GraphView/index.d.ts.map +1 -1
- package/dist/umd/container/GraphView/useNodeOrEdgeTypesWarning.d.ts +0 -1
- package/dist/umd/container/GraphView/useNodeOrEdgeTypesWarning.d.ts.map +1 -1
- package/dist/umd/container/NodeRenderer/index.d.ts +1 -2
- package/dist/umd/container/NodeRenderer/index.d.ts.map +1 -1
- package/dist/umd/container/NodeRenderer/useResizeObserver.d.ts +1 -1
- package/dist/umd/container/NodeRenderer/useResizeObserver.d.ts.map +1 -1
- package/dist/umd/container/Pane/index.d.ts +2 -2
- package/dist/umd/container/Pane/index.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/Wrapper.d.ts +1 -5
- package/dist/umd/container/ReactFlow/Wrapper.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/index.d.ts +1 -1
- package/dist/umd/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/umd/container/Viewport/index.d.ts +1 -1
- package/dist/umd/container/Viewport/index.d.ts.map +1 -1
- package/dist/umd/container/ZoomPane/index.d.ts +2 -2
- package/dist/umd/container/ZoomPane/index.d.ts.map +1 -1
- package/dist/umd/hooks/useColorModeClass.d.ts +1 -1
- package/dist/umd/hooks/useColorModeClass.d.ts.map +1 -1
- package/dist/umd/hooks/useDrag.d.ts +2 -2
- package/dist/umd/hooks/useDrag.d.ts.map +1 -1
- package/dist/umd/hooks/useEdges.d.ts +1 -2
- package/dist/umd/hooks/useEdges.d.ts.map +1 -1
- package/dist/umd/hooks/useGlobalKeyHandler.d.ts +2 -3
- package/dist/umd/hooks/useGlobalKeyHandler.d.ts.map +1 -1
- package/dist/umd/hooks/useKeyPress.d.ts +1 -2
- package/dist/umd/hooks/useKeyPress.d.ts.map +1 -1
- package/dist/umd/hooks/useNodes.d.ts +1 -2
- package/dist/umd/hooks/useNodes.d.ts.map +1 -1
- package/dist/umd/hooks/useNodesInitialized.d.ts +1 -2
- package/dist/umd/hooks/useNodesInitialized.d.ts.map +1 -1
- package/dist/umd/hooks/useOnInitHandler.d.ts +1 -2
- package/dist/umd/hooks/useOnInitHandler.d.ts.map +1 -1
- package/dist/umd/hooks/useOnSelectionChange.d.ts +1 -2
- package/dist/umd/hooks/useOnSelectionChange.d.ts.map +1 -1
- package/dist/umd/hooks/useOnViewportChange.d.ts +1 -2
- package/dist/umd/hooks/useOnViewportChange.d.ts.map +1 -1
- package/dist/umd/hooks/useReactFlow.d.ts +1 -1
- package/dist/umd/hooks/useReactFlow.d.ts.map +1 -1
- package/dist/umd/hooks/useResizeHandler.d.ts +1 -2
- package/dist/umd/hooks/useResizeHandler.d.ts.map +1 -1
- package/dist/umd/hooks/useUpdateNodeInternals.d.ts +1 -2
- package/dist/umd/hooks/useUpdateNodeInternals.d.ts.map +1 -1
- package/dist/umd/hooks/useUpdateNodePositions.d.ts +1 -2
- package/dist/umd/hooks/useUpdateNodePositions.d.ts.map +1 -1
- package/dist/umd/hooks/useViewport.d.ts +1 -2
- package/dist/umd/hooks/useViewport.d.ts.map +1 -1
- package/dist/umd/hooks/useViewportSync.d.ts +1 -1
- package/dist/umd/hooks/useViewportSync.d.ts.map +1 -1
- package/dist/umd/hooks/useVisibleEdgeIds.d.ts +1 -2
- package/dist/umd/hooks/useVisibleEdgeIds.d.ts.map +1 -1
- package/dist/umd/hooks/useVisibleNodeIds.d.ts +1 -2
- package/dist/umd/hooks/useVisibleNodeIds.d.ts.map +1 -1
- package/dist/umd/index.d.ts +18 -18
- package/dist/umd/index.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/types/changes.d.ts +0 -1
- package/dist/umd/types/changes.d.ts.map +1 -1
- package/dist/umd/types/component-props.d.ts +1 -1
- package/dist/umd/utils/changes.d.ts +2 -2
- package/dist/umd/utils/changes.d.ts.map +1 -1
- package/package.json +3 -10
package/dist/esm/index.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
import {
|
|
3
|
-
import { createContext, useContext, useMemo,
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { createContext, useContext, useMemo, useEffect, useRef, useState, useCallback, forwardRef, memo } from 'react';
|
|
4
4
|
import cc from 'classcat';
|
|
5
|
-
import { errorMessages, infiniteExtent, isInputDOMNode, fitView, getViewportForBounds, pointToRendererPoint, rendererPointToPoint, isNodeBase, isEdgeBase, getOutgoersBase, getIncomersBase, addEdgeBase, updateEdgeBase, getConnectedEdgesBase, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, XYDrag, snapPosition, calcNextPosition, Position, isMouseEvent, XYHandle, getHostForElement, getNodesBounds, clampPosition, internalsSymbol, getPositionWithOrigin, elementSelectionKeys, isEdgeVisible, MarkerType, createMarkerIds, isNumeric, getBezierEdgeCenter, getSmoothStepPath, getStraightPath, getBezierPath, getEdgePosition, getElevatedEdgeZIndex, getMarkerId, ConnectionMode, ConnectionLineType, updateConnectionLookup, adoptUserProvidedNodes, updateNodeDimensions, updateAbsolutePositions, panBy, isMacOs, areConnectionMapsEqual, handleConnectionChange, getNodePositionWithOrigin, XYMinimap, getBoundsOfRects,
|
|
5
|
+
import { errorMessages, infiniteExtent, isInputDOMNode, fitView, getViewportForBounds, pointToRendererPoint, rendererPointToPoint, isNodeBase, isEdgeBase, getOutgoersBase, getIncomersBase, addEdgeBase, updateEdgeBase, getConnectedEdgesBase, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, XYDrag, snapPosition, calcNextPosition, Position, isMouseEvent, XYHandle, getHostForElement, getNodesBounds, clampPosition, internalsSymbol, getPositionWithOrigin, elementSelectionKeys, isEdgeVisible, MarkerType, createMarkerIds, isNumeric, getBezierEdgeCenter, getSmoothStepPath, getStraightPath, getBezierPath, getEdgePosition, getElevatedEdgeZIndex, getMarkerId, ConnectionMode, ConnectionLineType, updateConnectionLookup, adoptUserProvidedNodes, updateNodeDimensions, updateAbsolutePositions, panBy, isMacOs, areConnectionMapsEqual, handleConnectionChange, getNodePositionWithOrigin, XYMinimap, getBoundsOfRects, ResizeControlVariant, XYResizer, XY_RESIZER_LINE_POSITIONS, XY_RESIZER_HANDLE_POSITIONS, getNodeToolbarTransform } from '@xyflow/system';
|
|
6
6
|
export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, SelectionMode, getBezierEdgeCenter, getBezierPath, getEdgeCenter, getNodesBounds, getSmoothStepPath, getStraightPath, getViewportForBounds, internalsSymbol } from '@xyflow/system';
|
|
7
7
|
import { useStoreWithEqualityFn, createWithEqualityFn } from 'zustand/traditional';
|
|
8
8
|
import { shallow } from 'zustand/shallow';
|
|
9
9
|
import { createPortal } from 'react-dom';
|
|
10
|
-
import { drag } from 'd3-drag';
|
|
11
|
-
import { select } from 'd3-selection';
|
|
12
10
|
|
|
13
11
|
const StoreContext = createContext(null);
|
|
14
12
|
const Provider$1 = StoreContext.Provider;
|
|
@@ -42,9 +40,33 @@ const useStoreApi = () => {
|
|
|
42
40
|
}), [store]);
|
|
43
41
|
};
|
|
44
42
|
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
const style = { display: 'none' };
|
|
44
|
+
const ariaLiveStyle = {
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
width: 1,
|
|
47
|
+
height: 1,
|
|
48
|
+
margin: -1,
|
|
49
|
+
border: 0,
|
|
50
|
+
padding: 0,
|
|
51
|
+
overflow: 'hidden',
|
|
52
|
+
clip: 'rect(0px, 0px, 0px, 0px)',
|
|
53
|
+
clipPath: 'inset(100%)',
|
|
54
|
+
};
|
|
55
|
+
const ARIA_NODE_DESC_KEY = 'react-flow__node-desc';
|
|
56
|
+
const ARIA_EDGE_DESC_KEY = 'react-flow__edge-desc';
|
|
57
|
+
const ARIA_LIVE_MESSAGE = 'react-flow__aria-live';
|
|
58
|
+
const selector$q = (s) => s.ariaLiveMessage;
|
|
59
|
+
function AriaLiveMessage({ rfId }) {
|
|
60
|
+
const ariaLiveMessage = useStore(selector$q);
|
|
61
|
+
return (jsx("div", { id: `${ARIA_LIVE_MESSAGE}-${rfId}`, "aria-live": "assertive", "aria-atomic": "true", style: ariaLiveStyle, children: ariaLiveMessage }));
|
|
62
|
+
}
|
|
63
|
+
function A11yDescriptions({ rfId, disableKeyboardA11y }) {
|
|
64
|
+
return (jsxs(Fragment, { children: [jsxs("div", { id: `${ARIA_NODE_DESC_KEY}-${rfId}`, style: style, children: ["Press enter or space to select a node.", !disableKeyboardA11y && 'You can then use the arrow keys to move the node around.', " Press delete to remove it and escape to cancel.", ' '] }), jsx("div", { id: `${ARIA_EDGE_DESC_KEY}-${rfId}`, style: style, children: "Press enter or space to select an edge. You can then press delete to remove it or escape to cancel." }), !disableKeyboardA11y && jsx(AriaLiveMessage, { rfId: rfId })] }));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const selector$p = (s) => (s.userSelectionActive ? 'none' : 'all');
|
|
68
|
+
function Panel({ position = 'top-left', children, className, style, ...rest }) {
|
|
69
|
+
const pointerEvents = useStore(selector$p);
|
|
48
70
|
const positionClasses = `${position}`.split('-');
|
|
49
71
|
return (jsx("div", { className: cc(['react-flow__panel', className, ...positionClasses]), style: { ...style, pointerEvents }, ...rest, children: children }));
|
|
50
72
|
}
|
|
@@ -56,7 +78,7 @@ function Attribution({ proOptions, position = 'bottom-right' }) {
|
|
|
56
78
|
return (jsx(Panel, { position: position, className: "react-flow__attribution", "data-message": "Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev", children: jsx("a", { href: "https://reactflow.dev", target: "_blank", rel: "noopener noreferrer", "aria-label": "React Flow attribution", children: "React Flow" }) }));
|
|
57
79
|
}
|
|
58
80
|
|
|
59
|
-
const selector$
|
|
81
|
+
const selector$o = (s) => ({
|
|
60
82
|
selectedNodes: s.nodes.filter((n) => n.selected),
|
|
61
83
|
selectedEdges: s.edges.filter((e) => e.selected),
|
|
62
84
|
});
|
|
@@ -65,22 +87,21 @@ function areEqual(a, b) {
|
|
|
65
87
|
return (shallow(a.selectedNodes.map(selectId), b.selectedNodes.map(selectId)) &&
|
|
66
88
|
shallow(a.selectedEdges.map(selectId), b.selectedEdges.map(selectId)));
|
|
67
89
|
}
|
|
68
|
-
|
|
90
|
+
function SelectionListenerInner({ onSelectionChange }) {
|
|
69
91
|
const store = useStoreApi();
|
|
70
|
-
const { selectedNodes, selectedEdges } = useStore(selector$
|
|
92
|
+
const { selectedNodes, selectedEdges } = useStore(selector$o, areEqual);
|
|
71
93
|
useEffect(() => {
|
|
72
94
|
const params = { nodes: selectedNodes, edges: selectedEdges };
|
|
73
95
|
onSelectionChange?.(params);
|
|
74
96
|
store.getState().onSelectionChangeHandlers.forEach((fn) => fn(params));
|
|
75
97
|
}, [selectedNodes, selectedEdges, onSelectionChange]);
|
|
76
98
|
return null;
|
|
77
|
-
}
|
|
78
|
-
SelectionListener.displayName = 'SelectionListener';
|
|
99
|
+
}
|
|
79
100
|
const changeSelector = (s) => !!s.onSelectionChangeHandlers;
|
|
80
|
-
function
|
|
101
|
+
function SelectionListener({ onSelectionChange }) {
|
|
81
102
|
const storeHasSelectionChangeHandlers = useStore(changeSelector);
|
|
82
103
|
if (onSelectionChange || storeHasSelectionChangeHandlers) {
|
|
83
|
-
return jsx(
|
|
104
|
+
return jsx(SelectionListenerInner, { onSelectionChange: onSelectionChange });
|
|
84
105
|
}
|
|
85
106
|
return null;
|
|
86
107
|
}
|
|
@@ -147,7 +168,7 @@ const reactFlowFieldsToTrack = [
|
|
|
147
168
|
];
|
|
148
169
|
// rfId doesn't exist in ReactFlowProps, but it's one of the fields we want to update
|
|
149
170
|
const fieldsToTrack = [...reactFlowFieldsToTrack, 'rfId'];
|
|
150
|
-
const selector$
|
|
171
|
+
const selector$n = (s) => ({
|
|
151
172
|
setNodes: s.setNodes,
|
|
152
173
|
setEdges: s.setEdges,
|
|
153
174
|
setDefaultNodesAndEdges: s.setDefaultNodesAndEdges,
|
|
@@ -157,8 +178,8 @@ const selector$o = (s) => ({
|
|
|
157
178
|
setNodeExtent: s.setNodeExtent,
|
|
158
179
|
reset: s.reset,
|
|
159
180
|
});
|
|
160
|
-
|
|
161
|
-
const { setNodes, setEdges, setDefaultNodesAndEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, } = useStore(selector$
|
|
181
|
+
function StoreUpdater(props) {
|
|
182
|
+
const { setNodes, setEdges, setDefaultNodesAndEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, } = useStore(selector$n, shallow);
|
|
162
183
|
const store = useStoreApi();
|
|
163
184
|
useEffect(() => {
|
|
164
185
|
const edgesWithDefaults = props.defaultEdges?.map((e) => ({ ...e, ...props.defaultEdgeOptions }));
|
|
@@ -214,30 +235,36 @@ const StoreUpdater = (props) => {
|
|
|
214
235
|
// Only re-run the effect if one of the fields we track changes
|
|
215
236
|
fieldsToTrack.map((fieldName) => props[fieldName]));
|
|
216
237
|
return null;
|
|
217
|
-
}
|
|
238
|
+
}
|
|
218
239
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
margin: -1,
|
|
225
|
-
border: 0,
|
|
226
|
-
padding: 0,
|
|
227
|
-
overflow: 'hidden',
|
|
228
|
-
clip: 'rect(0px, 0px, 0px, 0px)',
|
|
229
|
-
clipPath: 'inset(100%)',
|
|
230
|
-
};
|
|
231
|
-
const ARIA_NODE_DESC_KEY = 'react-flow__node-desc';
|
|
232
|
-
const ARIA_EDGE_DESC_KEY = 'react-flow__edge-desc';
|
|
233
|
-
const ARIA_LIVE_MESSAGE = 'react-flow__aria-live';
|
|
234
|
-
const selector$n = (s) => s.ariaLiveMessage;
|
|
235
|
-
function AriaLiveMessage({ rfId }) {
|
|
236
|
-
const ariaLiveMessage = useStore(selector$n);
|
|
237
|
-
return (jsx("div", { id: `${ARIA_LIVE_MESSAGE}-${rfId}`, "aria-live": "assertive", "aria-atomic": "true", style: ariaLiveStyle, children: ariaLiveMessage }));
|
|
240
|
+
function getMediaQuery() {
|
|
241
|
+
if (typeof window === 'undefined' || !window.matchMedia) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
return window.matchMedia('(prefers-color-scheme: dark)');
|
|
238
245
|
}
|
|
239
|
-
|
|
240
|
-
|
|
246
|
+
/**
|
|
247
|
+
* Hook for receiving the current color mode class 'dark' or 'light'.
|
|
248
|
+
*
|
|
249
|
+
* @internal
|
|
250
|
+
* @param colorMode - The color mode to use ('dark', 'light' or 'system')
|
|
251
|
+
*/
|
|
252
|
+
function useColorModeClass(colorMode) {
|
|
253
|
+
const [colorModeClass, setColorModeClass] = useState(colorMode === 'system' ? null : colorMode);
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
if (colorMode !== 'system') {
|
|
256
|
+
setColorModeClass(colorMode);
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
259
|
+
const mediaQuery = getMediaQuery();
|
|
260
|
+
const updateColorModeClass = () => setColorModeClass(mediaQuery?.matches ? 'dark' : 'light');
|
|
261
|
+
updateColorModeClass();
|
|
262
|
+
mediaQuery?.addEventListener('change', updateColorModeClass);
|
|
263
|
+
return () => {
|
|
264
|
+
mediaQuery?.removeEventListener('change', updateColorModeClass);
|
|
265
|
+
};
|
|
266
|
+
}, [colorMode]);
|
|
267
|
+
return colorModeClass !== null ? colorModeClass : getMediaQuery()?.matches ? 'dark' : 'light';
|
|
241
268
|
}
|
|
242
269
|
|
|
243
270
|
const defaultDoc = typeof document !== 'undefined' ? document : null;
|
|
@@ -249,12 +276,12 @@ const defaultDoc = typeof document !== 'undefined' ? document : null;
|
|
|
249
276
|
* @param param.options - Options
|
|
250
277
|
* @returns boolean
|
|
251
278
|
*/
|
|
252
|
-
|
|
279
|
+
function useKeyPress(
|
|
253
280
|
// the keycode can be a string 'a' or an array of strings ['a', 'a+d']
|
|
254
281
|
// a string means a single key 'a' or a combination when '+' is used 'a+d'
|
|
255
282
|
// an array means different possibilites. Explainer: ['a', 'd+s'] here the
|
|
256
283
|
// user can use the single key 'a' or the combination 'd' + 's'
|
|
257
|
-
keyCode = null, options = { target: defaultDoc, actInsideInputWithModifier: true })
|
|
284
|
+
keyCode = null, options = { target: defaultDoc, actInsideInputWithModifier: true }) {
|
|
258
285
|
const [keyPressed, setKeyPressed] = useState(false);
|
|
259
286
|
// we need to remember if a modifier key is pressed in order to track it
|
|
260
287
|
const modifierPressed = useRef(false);
|
|
@@ -323,7 +350,7 @@ keyCode = null, options = { target: defaultDoc, actInsideInputWithModifier: true
|
|
|
323
350
|
}
|
|
324
351
|
}, [keyCode, setKeyPressed]);
|
|
325
352
|
return keyPressed;
|
|
326
|
-
}
|
|
353
|
+
}
|
|
327
354
|
// utils
|
|
328
355
|
function isMatchingKey(keyCodes, pressedKeys, isUp) {
|
|
329
356
|
return (keyCodes
|
|
@@ -427,38 +454,41 @@ const useViewportHelper = () => {
|
|
|
427
454
|
return viewportHelperFunctions;
|
|
428
455
|
};
|
|
429
456
|
|
|
430
|
-
function handleParentExpand(
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
parent.computed
|
|
435
|
-
|
|
436
|
-
const extendWidth = updateItem.position.x + updateItem.computed.width - parent.computed.width;
|
|
437
|
-
const extendHeight = updateItem.position.y + updateItem.computed.height - parent.computed.height;
|
|
438
|
-
if (extendWidth > 0 || extendHeight > 0 || updateItem.position.x < 0 || updateItem.position.y < 0) {
|
|
439
|
-
parent.style = { ...parent.style } || {};
|
|
440
|
-
parent.style.width = parent.style.width ?? parent.computed.width;
|
|
441
|
-
parent.style.height = parent.style.height ?? parent.computed.height;
|
|
442
|
-
if (extendWidth > 0) {
|
|
443
|
-
parent.style.width += extendWidth;
|
|
457
|
+
function handleParentExpand(updatedElements, updateItem) {
|
|
458
|
+
for (const [index, item] of updatedElements.entries()) {
|
|
459
|
+
if (item.id === updateItem.parentNode) {
|
|
460
|
+
const parent = { ...item };
|
|
461
|
+
if (!parent.computed) {
|
|
462
|
+
parent.computed = {};
|
|
444
463
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
464
|
+
const extendWidth = updateItem.position.x + updateItem.computed.width - parent.computed.width;
|
|
465
|
+
const extendHeight = updateItem.position.y + updateItem.computed.height - parent.computed.height;
|
|
466
|
+
if (extendWidth > 0 || extendHeight > 0 || updateItem.position.x < 0 || updateItem.position.y < 0) {
|
|
467
|
+
parent.width = parent.width ?? parent.computed.width;
|
|
468
|
+
parent.height = parent.height ?? parent.computed.height;
|
|
469
|
+
if (extendWidth > 0) {
|
|
470
|
+
parent.width += extendWidth;
|
|
471
|
+
}
|
|
472
|
+
if (extendHeight > 0) {
|
|
473
|
+
parent.height += extendHeight;
|
|
474
|
+
}
|
|
475
|
+
if (updateItem.position.x < 0) {
|
|
476
|
+
const xDiff = Math.abs(updateItem.position.x);
|
|
477
|
+
parent.position.x = parent.position.x - xDiff;
|
|
478
|
+
parent.width += xDiff;
|
|
479
|
+
updateItem.position.x = 0;
|
|
480
|
+
}
|
|
481
|
+
if (updateItem.position.y < 0) {
|
|
482
|
+
const yDiff = Math.abs(updateItem.position.y);
|
|
483
|
+
parent.position.y = parent.position.y - yDiff;
|
|
484
|
+
parent.height += yDiff;
|
|
485
|
+
updateItem.position.y = 0;
|
|
486
|
+
}
|
|
487
|
+
parent.computed.width = parent.width;
|
|
488
|
+
parent.computed.height = parent.height;
|
|
489
|
+
updatedElements[index] = parent;
|
|
459
490
|
}
|
|
460
|
-
|
|
461
|
-
parent.computed.height = parent.style.height;
|
|
491
|
+
break;
|
|
462
492
|
}
|
|
463
493
|
}
|
|
464
494
|
}
|
|
@@ -470,20 +500,25 @@ function applyChanges(changes, elements) {
|
|
|
470
500
|
if (changes.some((c) => c.type === 'reset')) {
|
|
471
501
|
return changes.filter((c) => c.type === 'reset').map((c) => c.item);
|
|
472
502
|
}
|
|
473
|
-
let remainingChanges =
|
|
503
|
+
let remainingChanges = [];
|
|
474
504
|
const updatedElements = [];
|
|
505
|
+
for (const change of changes) {
|
|
506
|
+
if (change.type === 'add') {
|
|
507
|
+
updatedElements.push(change.item);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
remainingChanges.push(change);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
475
513
|
for (const item of elements) {
|
|
476
514
|
const nextChanges = [];
|
|
477
515
|
const _remainingChanges = [];
|
|
478
|
-
for (const
|
|
479
|
-
if (
|
|
480
|
-
|
|
481
|
-
}
|
|
482
|
-
else if (c.id === item.id) {
|
|
483
|
-
nextChanges.push(c);
|
|
516
|
+
for (const change of remainingChanges) {
|
|
517
|
+
if (change.id === item.id) {
|
|
518
|
+
nextChanges.push(change);
|
|
484
519
|
}
|
|
485
520
|
else {
|
|
486
|
-
_remainingChanges.push(
|
|
521
|
+
_remainingChanges.push(change);
|
|
487
522
|
}
|
|
488
523
|
}
|
|
489
524
|
remainingChanges = _remainingChanges;
|
|
@@ -492,6 +527,7 @@ function applyChanges(changes, elements) {
|
|
|
492
527
|
continue;
|
|
493
528
|
}
|
|
494
529
|
const updateItem = { ...item };
|
|
530
|
+
let isDeletion = false;
|
|
495
531
|
for (const currentChange of nextChanges) {
|
|
496
532
|
if (currentChange) {
|
|
497
533
|
switch (currentChange.type) {
|
|
@@ -524,9 +560,11 @@ function applyChanges(changes, elements) {
|
|
|
524
560
|
}
|
|
525
561
|
updateItem.computed.width = currentChange.dimensions.width;
|
|
526
562
|
updateItem.computed.height = currentChange.dimensions.height;
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
563
|
+
// this is needed for the node resizer to work
|
|
564
|
+
if (currentChange.resizing) {
|
|
565
|
+
updateItem.width = currentChange.dimensions.width;
|
|
566
|
+
updateItem.height = currentChange.dimensions.height;
|
|
567
|
+
}
|
|
530
568
|
}
|
|
531
569
|
if (typeof currentChange.resizing === 'boolean') {
|
|
532
570
|
updateItem.resizing = currentChange.resizing;
|
|
@@ -537,10 +575,13 @@ function applyChanges(changes, elements) {
|
|
|
537
575
|
break;
|
|
538
576
|
}
|
|
539
577
|
case 'remove': {
|
|
578
|
+
isDeletion = true;
|
|
540
579
|
continue;
|
|
541
580
|
}
|
|
542
581
|
}
|
|
543
582
|
}
|
|
583
|
+
}
|
|
584
|
+
if (!isDeletion) {
|
|
544
585
|
updatedElements.push(updateItem);
|
|
545
586
|
}
|
|
546
587
|
}
|
|
@@ -586,7 +627,7 @@ function applyNodeChanges(changes, nodes) {
|
|
|
586
627
|
);
|
|
587
628
|
|
|
588
629
|
return (
|
|
589
|
-
<
|
|
630
|
+
<ReactFlow nodes={nodes} edges={edges} onEdgesChange={onEdgesChange} />
|
|
590
631
|
);
|
|
591
632
|
*/
|
|
592
633
|
function applyEdgeChanges(changes, edges) {
|
|
@@ -886,7 +927,7 @@ const deleteKeyOptions = { actInsideInputWithModifier: false };
|
|
|
886
927
|
*
|
|
887
928
|
* @internal
|
|
888
929
|
*/
|
|
889
|
-
|
|
930
|
+
function useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode, }) {
|
|
890
931
|
const store = useStoreApi();
|
|
891
932
|
const { deleteElements } = useReactFlow();
|
|
892
933
|
const deleteKeyPressed = useKeyPress(deleteKeyCode, deleteKeyOptions);
|
|
@@ -901,7 +942,7 @@ var useGlobalKeyHandler = ({ deleteKeyCode, multiSelectionKeyCode, }) => {
|
|
|
901
942
|
useEffect(() => {
|
|
902
943
|
store.setState({ multiSelectionActive: multiSelectionKeyPressed });
|
|
903
944
|
}, [multiSelectionKeyPressed]);
|
|
904
|
-
}
|
|
945
|
+
}
|
|
905
946
|
|
|
906
947
|
/**
|
|
907
948
|
* Hook for handling resize events.
|
|
@@ -948,7 +989,7 @@ const selector$l = (s) => ({
|
|
|
948
989
|
userSelectionActive: s.userSelectionActive,
|
|
949
990
|
lib: s.lib,
|
|
950
991
|
});
|
|
951
|
-
|
|
992
|
+
function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, defaultViewport, translateExtent, minZoom, maxZoom, zoomActivationKeyCode, preventScrolling = true, children, noWheelClassName, noPanClassName, onViewportChange, isControlledViewport, }) {
|
|
952
993
|
const store = useStoreApi();
|
|
953
994
|
const zoomPane = useRef(null);
|
|
954
995
|
const { userSelectionActive, lib } = useStore(selector$l, shallow);
|
|
@@ -1031,7 +1072,7 @@ const ZoomPane = ({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
|
|
|
1031
1072
|
lib,
|
|
1032
1073
|
]);
|
|
1033
1074
|
return (jsx("div", { className: "react-flow__renderer", ref: zoomPane, style: containerStyle, children: children }));
|
|
1034
|
-
}
|
|
1075
|
+
}
|
|
1035
1076
|
|
|
1036
1077
|
const selector$k = (s) => ({
|
|
1037
1078
|
userSelectionActive: s.userSelectionActive,
|
|
@@ -1063,7 +1104,7 @@ const selector$j = (s) => ({
|
|
|
1063
1104
|
elementsSelectable: s.elementsSelectable,
|
|
1064
1105
|
dragging: s.paneDragging,
|
|
1065
1106
|
});
|
|
1066
|
-
|
|
1107
|
+
function Pane({ isSelecting, selectionMode = SelectionMode.Full, panOnDrag, onSelectionStart, onSelectionEnd, onPaneClick, onPaneContextMenu, onPaneScroll, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, children, }) {
|
|
1067
1108
|
const container = useRef(null);
|
|
1068
1109
|
const store = useStoreApi();
|
|
1069
1110
|
const prevSelectedNodesCount = useRef(0);
|
|
@@ -1180,8 +1221,7 @@ const Pane = memo(({ isSelecting, selectionMode = SelectionMode.Full, panOnDrag,
|
|
|
1180
1221
|
};
|
|
1181
1222
|
const hasActiveSelection = elementsSelectable && (isSelecting || userSelectionActive);
|
|
1182
1223
|
return (jsxs("div", { className: cc(['react-flow__pane', { dragging, selection: isSelecting }]), onClick: hasActiveSelection ? undefined : wrapHandler(onClick, container), onContextMenu: wrapHandler(onContextMenu, container), onWheel: wrapHandler(onWheel, container), onMouseEnter: hasActiveSelection ? undefined : onPaneMouseEnter, onMouseDown: hasActiveSelection ? onMouseDown : undefined, onMouseMove: hasActiveSelection ? onMouseMove : onPaneMouseMove, onMouseUp: hasActiveSelection ? onMouseUp : undefined, onMouseLeave: hasActiveSelection ? onMouseLeave : onPaneMouseLeave, ref: container, style: containerStyle, children: [children, jsx(UserSelection, {})] }));
|
|
1183
|
-
}
|
|
1184
|
-
Pane.displayName = 'Pane';
|
|
1224
|
+
}
|
|
1185
1225
|
|
|
1186
1226
|
// this handler is called by
|
|
1187
1227
|
// 1. the click handler when node is not draggable or selectNodesOnDrag = false
|
|
@@ -1209,7 +1249,7 @@ function handleNodeClick({ id, store, unselect = false, nodeRef, }) {
|
|
|
1209
1249
|
*
|
|
1210
1250
|
* @internal
|
|
1211
1251
|
*/
|
|
1212
|
-
function useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, nodeId, isSelectable }) {
|
|
1252
|
+
function useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, nodeId, isSelectable, }) {
|
|
1213
1253
|
const store = useStoreApi();
|
|
1214
1254
|
const [dragging, setDragging] = useState(false);
|
|
1215
1255
|
const xyDrag = useRef();
|
|
@@ -1317,7 +1357,7 @@ const connectingSelector = (nodeId, handleId, type) => (state) => {
|
|
|
1317
1357
|
clickConnecting: clickHandle?.nodeId === nodeId && clickHandle?.handleId === handleId && clickHandle?.type === type,
|
|
1318
1358
|
};
|
|
1319
1359
|
};
|
|
1320
|
-
const
|
|
1360
|
+
const HandleComponent = forwardRef(({ type = 'source', position = Position.Top, isValidConnection, isConnectable = true, isConnectableStart = true, isConnectableEnd = true, id, onConnect, children, className, onMouseDown, onTouchStart, ...rest }, ref) => {
|
|
1321
1361
|
const handleId = id || null;
|
|
1322
1362
|
const isTarget = type === 'target';
|
|
1323
1363
|
const store = useStoreApi();
|
|
@@ -1425,25 +1465,24 @@ const Handle = forwardRef(({ type = 'source', position = Position.Top, isValidCo
|
|
|
1425
1465
|
},
|
|
1426
1466
|
]), onMouseDown: onPointerDown, onTouchStart: onPointerDown, onClick: connectOnClick ? onClick : undefined, ref: ref, ...rest, children: children }));
|
|
1427
1467
|
});
|
|
1428
|
-
|
|
1429
|
-
|
|
1468
|
+
HandleComponent.displayName = 'Handle';
|
|
1469
|
+
const Handle = memo(HandleComponent);
|
|
1430
1470
|
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1471
|
+
function InputNode({ data, isConnectable, sourcePosition = Position.Bottom }) {
|
|
1472
|
+
return (jsxs(Fragment, { children: [data?.label, jsx(Handle, { type: "source", position: sourcePosition, isConnectable: isConnectable })] }));
|
|
1473
|
+
}
|
|
1434
1474
|
|
|
1435
|
-
|
|
1436
|
-
return (jsxs(Fragment, { children: [jsx(Handle
|
|
1437
|
-
}
|
|
1438
|
-
DefaultNode.displayName = 'DefaultNode';
|
|
1439
|
-
var DefaultNode$1 = memo(DefaultNode);
|
|
1475
|
+
function DefaultNode({ data, isConnectable, targetPosition = Position.Top, sourcePosition = Position.Bottom, }) {
|
|
1476
|
+
return (jsxs(Fragment, { children: [jsx(Handle, { type: "target", position: targetPosition, isConnectable: isConnectable }), data?.label, jsx(Handle, { type: "source", position: sourcePosition, isConnectable: isConnectable })] }));
|
|
1477
|
+
}
|
|
1440
1478
|
|
|
1441
|
-
|
|
1442
|
-
|
|
1479
|
+
function GroupNode() {
|
|
1480
|
+
return null;
|
|
1481
|
+
}
|
|
1443
1482
|
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1483
|
+
function OutputNode({ data, isConnectable, targetPosition = Position.Top }) {
|
|
1484
|
+
return (jsxs(Fragment, { children: [jsx(Handle, { type: "target", position: targetPosition, isConnectable: isConnectable }), data?.label] }));
|
|
1485
|
+
}
|
|
1447
1486
|
|
|
1448
1487
|
const arrowKeyDiffs = {
|
|
1449
1488
|
ArrowUp: { x: 0, y: -1 },
|
|
@@ -1452,9 +1491,9 @@ const arrowKeyDiffs = {
|
|
|
1452
1491
|
ArrowRight: { x: 1, y: 0 },
|
|
1453
1492
|
};
|
|
1454
1493
|
const builtinNodeTypes = {
|
|
1455
|
-
input: InputNode
|
|
1456
|
-
default: DefaultNode
|
|
1457
|
-
output: OutputNode
|
|
1494
|
+
input: InputNode,
|
|
1495
|
+
default: DefaultNode,
|
|
1496
|
+
output: OutputNode,
|
|
1458
1497
|
group: GroupNode,
|
|
1459
1498
|
};
|
|
1460
1499
|
|
|
@@ -1508,10 +1547,9 @@ function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboar
|
|
|
1508
1547
|
height,
|
|
1509
1548
|
} }) }));
|
|
1510
1549
|
}
|
|
1511
|
-
var NodesSelection$1 = memo(NodesSelection);
|
|
1512
1550
|
|
|
1513
1551
|
const selector$g = (s) => s.nodesSelectionActive;
|
|
1514
|
-
const
|
|
1552
|
+
const FlowRendererComponent = ({ children, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, deleteKeyCode, selectionKeyCode, selectionOnDrag, selectionMode, onSelectionStart, onSelectionEnd, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, elementsSelectable, zoomOnScroll, zoomOnPinch, panOnScroll: _panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag: _panOnDrag, defaultViewport, translateExtent, minZoom, maxZoom, preventScrolling, onSelectionContextMenu, noWheelClassName, noPanClassName, disableKeyboardA11y, onViewportChange, isControlledViewport, }) => {
|
|
1515
1553
|
const nodesSelectionActive = useStore(selector$g);
|
|
1516
1554
|
const selectionKeyPressed = useKeyPress(selectionKeyCode);
|
|
1517
1555
|
const panActivationKeyPressed = useKeyPress(panActivationKeyCode);
|
|
@@ -1519,10 +1557,10 @@ const FlowRenderer = ({ children, onPaneClick, onPaneMouseEnter, onPaneMouseMove
|
|
|
1519
1557
|
const panOnScroll = panActivationKeyPressed || _panOnScroll;
|
|
1520
1558
|
const isSelecting = selectionKeyPressed || (selectionOnDrag && panOnDrag !== true);
|
|
1521
1559
|
useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });
|
|
1522
|
-
return (jsx(ZoomPane, { onPaneContextMenu: onPaneContextMenu, elementsSelectable: elementsSelectable, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, zoomOnDoubleClick: zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, zoomActivationKeyCode: zoomActivationKeyCode, preventScrolling: preventScrolling, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, onViewportChange: onViewportChange, isControlledViewport: isControlledViewport, children: jsxs(Pane, { onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneContextMenu: onPaneContextMenu, onPaneScroll: onPaneScroll, panOnDrag: panOnDrag, isSelecting: !!isSelecting, selectionMode: selectionMode, children: [children, nodesSelectionActive && (jsx(NodesSelection
|
|
1560
|
+
return (jsx(ZoomPane, { onPaneContextMenu: onPaneContextMenu, elementsSelectable: elementsSelectable, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, zoomOnDoubleClick: zoomOnDoubleClick, panOnDrag: !selectionKeyPressed && panOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, zoomActivationKeyCode: zoomActivationKeyCode, preventScrolling: preventScrolling, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, onViewportChange: onViewportChange, isControlledViewport: isControlledViewport, children: jsxs(Pane, { onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneContextMenu: onPaneContextMenu, onPaneScroll: onPaneScroll, panOnDrag: panOnDrag, isSelecting: !!isSelecting, selectionMode: selectionMode, children: [children, nodesSelectionActive && (jsx(NodesSelection, { onSelectionContextMenu: onSelectionContextMenu, noPanClassName: noPanClassName, disableKeyboardA11y: disableKeyboardA11y }))] }) }));
|
|
1523
1561
|
};
|
|
1524
|
-
|
|
1525
|
-
|
|
1562
|
+
FlowRendererComponent.displayName = 'FlowRenderer';
|
|
1563
|
+
const FlowRenderer = memo(FlowRendererComponent);
|
|
1526
1564
|
|
|
1527
1565
|
const selector$f = (onlyRenderVisible) => (s) => {
|
|
1528
1566
|
return onlyRenderVisible
|
|
@@ -1572,7 +1610,7 @@ function useResizeObserver() {
|
|
|
1572
1610
|
return resizeObserver;
|
|
1573
1611
|
}
|
|
1574
1612
|
|
|
1575
|
-
|
|
1613
|
+
function NodeWrapper({ id, onClick, onMouseEnter, onMouseMove, onMouseLeave, onContextMenu, onDoubleClick, nodesDraggable, elementsSelectable, nodesConnectable, nodesFocusable, resizeObserver, noDragClassName, noPanClassName, disableKeyboardA11y, rfId, nodeTypes, nodeExtent, nodeOrigin, onError, }) {
|
|
1576
1614
|
const { node, positionAbsoluteX, positionAbsoluteY, zIndex, isParent } = useStore((s) => {
|
|
1577
1615
|
const node = s.nodeLookup.get(id);
|
|
1578
1616
|
const positionAbsolute = nodeExtent
|
|
@@ -1722,13 +1760,11 @@ const NodeWrapper = ({ id, onClick, onMouseEnter, onMouseMove, onMouseLeave, onC
|
|
|
1722
1760
|
transform: `translate(${positionAbsoluteOrigin.x}px,${positionAbsoluteOrigin.y}px)`,
|
|
1723
1761
|
pointerEvents: hasPointerEvents ? 'all' : 'none',
|
|
1724
1762
|
visibility: initialized ? 'visible' : 'hidden',
|
|
1725
|
-
width,
|
|
1726
|
-
height,
|
|
1727
1763
|
...node.style,
|
|
1764
|
+
width: width ?? node.style?.width,
|
|
1765
|
+
height: height ?? node.style?.height,
|
|
1728
1766
|
}, "data-id": id, "data-testid": `rf__node-${id}`, onMouseEnter: onMouseEnterHandler, onMouseMove: onMouseMoveHandler, onMouseLeave: onMouseLeaveHandler, onContextMenu: onContextMenuHandler, onClick: onSelectNodeHandler, onDoubleClick: onDoubleClickHandler, onKeyDown: isFocusable ? onKeyDown : undefined, tabIndex: isFocusable ? 0 : undefined, role: isFocusable ? 'button' : undefined, "aria-describedby": disableKeyboardA11y ? undefined : `${ARIA_NODE_DESC_KEY}-${rfId}`, "aria-label": node.ariaLabel, children: jsx(Provider, { value: id, children: jsx(NodeComponent, { id: id, data: node.data, type: nodeType, width: computedWidth, height: computedHeight, positionAbsoluteX: positionAbsoluteX, positionAbsoluteY: positionAbsoluteY, selected: node.selected, isConnectable: isConnectable, sourcePosition: node.sourcePosition, targetPosition: node.targetPosition, dragging: dragging, dragHandle: node.dragHandle, zIndex: zIndex }) }) }));
|
|
1729
|
-
}
|
|
1730
|
-
NodeWrapper.displayName = 'NodeWrapper';
|
|
1731
|
-
var NodeWrapper$1 = memo(NodeWrapper);
|
|
1767
|
+
}
|
|
1732
1768
|
|
|
1733
1769
|
const selector$d = (s) => ({
|
|
1734
1770
|
nodesDraggable: s.nodesDraggable,
|
|
@@ -1737,7 +1773,7 @@ const selector$d = (s) => ({
|
|
|
1737
1773
|
elementsSelectable: s.elementsSelectable,
|
|
1738
1774
|
onError: s.onError,
|
|
1739
1775
|
});
|
|
1740
|
-
const
|
|
1776
|
+
const NodeRendererComponent = (props) => {
|
|
1741
1777
|
const { nodesDraggable, nodesConnectable, nodesFocusable, elementsSelectable, onError } = useStore(selector$d, shallow);
|
|
1742
1778
|
const nodeIds = useVisibleNodeIds(props.onlyRenderVisibleElements);
|
|
1743
1779
|
const resizeObserver = useResizeObserver();
|
|
@@ -1766,11 +1802,11 @@ const NodeRenderer = (props) => {
|
|
|
1766
1802
|
// moved into `NodeComponentWrapper`. This ensures they are
|
|
1767
1803
|
// memorized – so if `NodeRenderer` *has* to rerender, it only
|
|
1768
1804
|
// needs to regenerate the list of nodes, nothing else.
|
|
1769
|
-
jsx(NodeWrapper
|
|
1805
|
+
jsx(NodeWrapper, { id: nodeId, nodeTypes: props.nodeTypes, nodeExtent: props.nodeExtent, nodeOrigin: props.nodeOrigin, onClick: props.onNodeClick, onMouseEnter: props.onNodeMouseEnter, onMouseMove: props.onNodeMouseMove, onMouseLeave: props.onNodeMouseLeave, onContextMenu: props.onNodeContextMenu, onDoubleClick: props.onNodeDoubleClick, noDragClassName: props.noDragClassName, noPanClassName: props.noPanClassName, rfId: props.rfId, disableKeyboardA11y: props.disableKeyboardA11y, resizeObserver: resizeObserver, nodesDraggable: nodesDraggable, nodesConnectable: nodesConnectable, nodesFocusable: nodesFocusable, elementsSelectable: elementsSelectable, onError: onError }, nodeId));
|
|
1770
1806
|
}) }));
|
|
1771
1807
|
};
|
|
1772
|
-
|
|
1773
|
-
|
|
1808
|
+
NodeRendererComponent.displayName = 'NodeRenderer';
|
|
1809
|
+
const NodeRenderer = memo(NodeRendererComponent);
|
|
1774
1810
|
|
|
1775
1811
|
/**
|
|
1776
1812
|
* Hook for getting the visible edge ids from the store.
|
|
@@ -1864,7 +1900,7 @@ const MarkerDefinitions = ({ defaultColor, rfId }) => {
|
|
|
1864
1900
|
MarkerDefinitions.displayName = 'MarkerDefinitions';
|
|
1865
1901
|
var MarkerDefinitions$1 = memo(MarkerDefinitions);
|
|
1866
1902
|
|
|
1867
|
-
|
|
1903
|
+
function EdgeTextComponent({ x, y, label, labelStyle = {}, labelShowBg = true, labelBgStyle = {}, labelBgPadding = [2, 4], labelBgBorderRadius = 2, children, className, ...rest }) {
|
|
1868
1904
|
const [edgeTextBbox, setEdgeTextBbox] = useState({ x: 1, y: 0, width: 0, height: 0 });
|
|
1869
1905
|
const edgeTextClasses = cc(['react-flow__edge-textwrapper', className]);
|
|
1870
1906
|
const onEdgeTextRefChange = useCallback((edgeRef) => {
|
|
@@ -1882,13 +1918,13 @@ const EdgeText = ({ x, y, label, labelStyle = {}, labelShowBg = true, labelBgSty
|
|
|
1882
1918
|
return null;
|
|
1883
1919
|
}
|
|
1884
1920
|
return (jsxs("g", { transform: `translate(${x - edgeTextBbox.width / 2} ${y - edgeTextBbox.height / 2})`, className: edgeTextClasses, visibility: edgeTextBbox.width ? 'visible' : 'hidden', ...rest, children: [labelShowBg && (jsx("rect", { width: edgeTextBbox.width + 2 * labelBgPadding[0], x: -labelBgPadding[0], y: -labelBgPadding[1], height: edgeTextBbox.height + 2 * labelBgPadding[1], className: "react-flow__edge-textbg", style: labelBgStyle, rx: labelBgBorderRadius, ry: labelBgBorderRadius })), jsx("text", { className: "react-flow__edge-text", y: edgeTextBbox.height / 2, dy: "0.3em", ref: onEdgeTextRefChange, style: labelStyle, children: label }), children] }));
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1921
|
+
}
|
|
1922
|
+
EdgeTextComponent.displayName = 'EdgeText';
|
|
1923
|
+
const EdgeText = memo(EdgeTextComponent);
|
|
1887
1924
|
|
|
1888
|
-
|
|
1889
|
-
return (jsxs(Fragment, { children: [jsx("path", { id: id, style: style, d: path, fill: "none", className: cc(['react-flow__edge-path', className]), markerEnd: markerEnd, markerStart: markerStart }), interactionWidth && (jsx("path", { d: path, fill: "none", strokeOpacity: 0, strokeWidth: interactionWidth, className: "react-flow__edge-interaction" })), label && isNumeric(labelX) && isNumeric(labelY) ? (jsx(EdgeText
|
|
1890
|
-
}
|
|
1891
|
-
BaseEdge.displayName = 'BaseEdge';
|
|
1925
|
+
function BaseEdge({ id, path, labelX, labelY, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, className, interactionWidth = 20, }) {
|
|
1926
|
+
return (jsxs(Fragment, { children: [jsx("path", { id: id, style: style, d: path, fill: "none", className: cc(['react-flow__edge-path', className]), markerEnd: markerEnd, markerStart: markerStart }), interactionWidth && (jsx("path", { d: path, fill: "none", strokeOpacity: 0, strokeWidth: interactionWidth, className: "react-flow__edge-interaction" })), label && isNumeric(labelX) && isNumeric(labelY) ? (jsx(EdgeText, { x: labelX, y: labelY, label: label, labelStyle: labelStyle, labelShowBg: labelShowBg, labelBgStyle: labelBgStyle, labelBgPadding: labelBgPadding, labelBgBorderRadius: labelBgBorderRadius })) : null] }));
|
|
1927
|
+
}
|
|
1892
1928
|
|
|
1893
1929
|
function getControl({ pos, x1, y1, x2, y2 }) {
|
|
1894
1930
|
if (pos === Position.Left || pos === Position.Right) {
|
|
@@ -2048,7 +2084,9 @@ const shiftY = (y, shift, position) => {
|
|
|
2048
2084
|
return y;
|
|
2049
2085
|
};
|
|
2050
2086
|
const EdgeUpdaterClassName = 'react-flow__edgeupdater';
|
|
2051
|
-
|
|
2087
|
+
function EdgeAnchor({ position, centerX, centerY, radius = 10, onMouseDown, onMouseEnter, onMouseOut, type, }) {
|
|
2088
|
+
return (jsx("circle", { onMouseDown: onMouseDown, onMouseEnter: onMouseEnter, onMouseOut: onMouseOut, className: cc([EdgeUpdaterClassName, `${EdgeUpdaterClassName}-${type}`]), cx: shiftX(centerX, radius, position), cy: shiftY(centerY, radius, position), r: radius, stroke: "transparent", fill: "transparent" }));
|
|
2089
|
+
}
|
|
2052
2090
|
|
|
2053
2091
|
function EdgeUpdateAnchors({ isUpdatable, edgeUpdaterRadius, edge, targetHandleId, sourceHandleId, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, onEdgeUpdate, onEdgeUpdateStart, onEdgeUpdateEnd, setUpdating, setUpdateHover, }) {
|
|
2054
2092
|
const store = useStoreApi();
|
|
@@ -2219,8 +2257,6 @@ function EdgeWrapper({ id, edgesFocusable, edgesUpdatable, elementsSelectable, o
|
|
|
2219
2257
|
},
|
|
2220
2258
|
]), onClick: onEdgeClick, onDoubleClick: onEdgeDoubleClick, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onKeyDown: isFocusable ? onKeyDown : undefined, tabIndex: isFocusable ? 0 : undefined, role: isFocusable ? 'button' : 'img', "data-id": id, "data-testid": `rf__edge-${id}`, "aria-label": edge.ariaLabel === null ? undefined : edge.ariaLabel || `Edge from ${edge.source} to ${edge.target}`, "aria-describedby": isFocusable ? `${ARIA_EDGE_DESC_KEY}-${rfId}` : undefined, ref: edgeRef, children: [!updating && (jsx(EdgeComponent, { id: id, source: edge.source, target: edge.target, selected: edge.selected, animated: edge.animated, label: edge.label, labelStyle: edge.labelStyle, labelShowBg: edge.labelShowBg, labelBgStyle: edge.labelBgStyle, labelBgPadding: edge.labelBgPadding, labelBgBorderRadius: edge.labelBgBorderRadius, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, data: edge.data, style: edge.style, sourceHandleId: edge.sourceHandle, targetHandleId: edge.targetHandle, markerStart: markerStartUrl, markerEnd: markerEndUrl, pathOptions: 'pathOptions' in edge ? edge.pathOptions : undefined, interactionWidth: edge.interactionWidth })), isUpdatable && (jsx(EdgeUpdateAnchors, { edge: edge, isUpdatable: isUpdatable, edgeUpdaterRadius: edgeUpdaterRadius, onEdgeUpdate: onEdgeUpdate, onEdgeUpdateStart: onEdgeUpdateStart, onEdgeUpdateEnd: onEdgeUpdateEnd, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, setUpdateHover: setUpdateHover, setUpdating: setUpdating, sourceHandleId: edge.sourceHandle, targetHandleId: edge.targetHandle }))] }) }));
|
|
2221
2259
|
}
|
|
2222
|
-
EdgeWrapper.displayName = 'EdgeWrapper';
|
|
2223
|
-
var EdgeWrapper$1 = memo(EdgeWrapper);
|
|
2224
2260
|
|
|
2225
2261
|
const selector$c = (s) => ({
|
|
2226
2262
|
width: s.width,
|
|
@@ -2231,15 +2267,15 @@ const selector$c = (s) => ({
|
|
|
2231
2267
|
connectionMode: s.connectionMode,
|
|
2232
2268
|
onError: s.onError,
|
|
2233
2269
|
});
|
|
2234
|
-
|
|
2270
|
+
function EdgeRendererComponent({ defaultMarkerColor, onlyRenderVisibleElements, rfId, edgeTypes, noPanClassName, onEdgeUpdate, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeClick, edgeUpdaterRadius, onEdgeDoubleClick, onEdgeUpdateStart, onEdgeUpdateEnd, }) {
|
|
2235
2271
|
const { edgesFocusable, edgesUpdatable, elementsSelectable, onError } = useStore(selector$c, shallow);
|
|
2236
2272
|
const edgeIds = useVisibleEdgeIds(onlyRenderVisibleElements);
|
|
2237
2273
|
return (jsxs("div", { className: "react-flow__edges", children: [jsx(MarkerDefinitions$1, { defaultColor: defaultMarkerColor, rfId: rfId }), edgeIds.map((id) => {
|
|
2238
|
-
return (jsx(EdgeWrapper
|
|
2239
|
-
})
|
|
2240
|
-
}
|
|
2241
|
-
|
|
2242
|
-
|
|
2274
|
+
return (jsx(EdgeWrapper, { id: id, edgesFocusable: edgesFocusable, edgesUpdatable: edgesUpdatable, elementsSelectable: elementsSelectable, noPanClassName: noPanClassName, onEdgeUpdate: onEdgeUpdate, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onClick: onEdgeClick, edgeUpdaterRadius: edgeUpdaterRadius, onDoubleClick: onEdgeDoubleClick, onEdgeUpdateStart: onEdgeUpdateStart, onEdgeUpdateEnd: onEdgeUpdateEnd, rfId: rfId, onError: onError, edgeTypes: edgeTypes }, id));
|
|
2275
|
+
})] }));
|
|
2276
|
+
}
|
|
2277
|
+
EdgeRendererComponent.displayName = 'EdgeRenderer';
|
|
2278
|
+
const EdgeRenderer = memo(EdgeRendererComponent);
|
|
2243
2279
|
|
|
2244
2280
|
const selector$b = (s) => `translate(${s.transform[0]}px,${s.transform[1]}px) scale(${s.transform[2]})`;
|
|
2245
2281
|
function Viewport({ children }) {
|
|
@@ -2380,15 +2416,15 @@ function useNodeOrEdgeTypesWarning(nodeOrEdgeTypes = emptyTypes) {
|
|
|
2380
2416
|
}, [nodeOrEdgeTypes]);
|
|
2381
2417
|
}
|
|
2382
2418
|
|
|
2383
|
-
|
|
2419
|
+
function GraphViewComponent({ nodeTypes, edgeTypes, onInit, onNodeClick, onEdgeClick, onNodeDoubleClick, onEdgeDoubleClick, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onSelectionContextMenu, onSelectionStart, onSelectionEnd, connectionLineType, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, selectionKeyCode, selectionOnDrag, selectionMode, multiSelectionKeyCode, panActivationKeyCode, zoomActivationKeyCode, deleteKeyCode, onlyRenderVisibleElements, elementsSelectable, defaultViewport, translateExtent, minZoom, maxZoom, preventScrolling, defaultMarkerColor, zoomOnScroll, zoomOnPinch, panOnScroll, panOnScrollSpeed, panOnScrollMode, zoomOnDoubleClick, panOnDrag, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, onEdgeUpdate, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, edgeUpdaterRadius, onEdgeUpdateStart, onEdgeUpdateEnd, noDragClassName, noWheelClassName, noPanClassName, disableKeyboardA11y, nodeOrigin, nodeExtent, rfId, viewport, onViewportChange, }) {
|
|
2384
2420
|
useNodeOrEdgeTypesWarning(nodeTypes);
|
|
2385
2421
|
useNodeOrEdgeTypesWarning(edgeTypes);
|
|
2386
2422
|
useOnInitHandler(onInit);
|
|
2387
2423
|
useViewportSync(viewport);
|
|
2388
|
-
return (jsx(FlowRenderer
|
|
2389
|
-
}
|
|
2390
|
-
|
|
2391
|
-
|
|
2424
|
+
return (jsx(FlowRenderer, { onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneContextMenu: onPaneContextMenu, onPaneScroll: onPaneScroll, deleteKeyCode: deleteKeyCode, selectionKeyCode: selectionKeyCode, selectionOnDrag: selectionOnDrag, selectionMode: selectionMode, onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, multiSelectionKeyCode: multiSelectionKeyCode, panActivationKeyCode: panActivationKeyCode, zoomActivationKeyCode: zoomActivationKeyCode, elementsSelectable: elementsSelectable, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, zoomOnDoubleClick: zoomOnDoubleClick, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, panOnDrag: panOnDrag, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, onSelectionContextMenu: onSelectionContextMenu, preventScrolling: preventScrolling, noDragClassName: noDragClassName, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, disableKeyboardA11y: disableKeyboardA11y, onViewportChange: onViewportChange, isControlledViewport: !!viewport, children: jsxs(Viewport, { children: [jsx(EdgeRenderer, { edgeTypes: edgeTypes, onEdgeClick: onEdgeClick, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeUpdate: onEdgeUpdate, onlyRenderVisibleElements: onlyRenderVisibleElements, onEdgeContextMenu: onEdgeContextMenu, onEdgeMouseEnter: onEdgeMouseEnter, onEdgeMouseMove: onEdgeMouseMove, onEdgeMouseLeave: onEdgeMouseLeave, onEdgeUpdateStart: onEdgeUpdateStart, onEdgeUpdateEnd: onEdgeUpdateEnd, edgeUpdaterRadius: edgeUpdaterRadius, defaultMarkerColor: defaultMarkerColor, noPanClassName: noPanClassName, disableKeyboardA11y: disableKeyboardA11y, rfId: rfId }), jsx(ConnectionLineWrapper, { style: connectionLineStyle, type: connectionLineType, component: connectionLineComponent, containerStyle: connectionLineContainerStyle }), jsx("div", { className: "react-flow__edgelabel-renderer" }), jsx("div", { className: "react-flow__viewport-portal" }), jsx(NodeRenderer, { nodeTypes: nodeTypes, onNodeClick: onNodeClick, onNodeDoubleClick: onNodeDoubleClick, onNodeMouseEnter: onNodeMouseEnter, onNodeMouseMove: onNodeMouseMove, onNodeMouseLeave: onNodeMouseLeave, onNodeContextMenu: onNodeContextMenu, onlyRenderVisibleElements: onlyRenderVisibleElements, noPanClassName: noPanClassName, noDragClassName: noDragClassName, disableKeyboardA11y: disableKeyboardA11y, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, rfId: rfId })] }) }));
|
|
2425
|
+
}
|
|
2426
|
+
GraphViewComponent.displayName = 'GraphView';
|
|
2427
|
+
const GraphView = memo(GraphViewComponent);
|
|
2392
2428
|
|
|
2393
2429
|
function handleControlledSelectionChange(changes, items) {
|
|
2394
2430
|
return items.map((item) => {
|
|
@@ -2750,7 +2786,6 @@ function ReactFlowProvider({ children, initialNodes, initialEdges, initialWidth,
|
|
|
2750
2786
|
}
|
|
2751
2787
|
return jsx(Provider$1, { value: storeRef.current, children: children });
|
|
2752
2788
|
}
|
|
2753
|
-
ReactFlowProvider.displayName = 'ReactFlowProvider';
|
|
2754
2789
|
|
|
2755
2790
|
function Wrapper({ children, nodes, edges, width, height, fitView, }) {
|
|
2756
2791
|
const isWrapped = useContext(StoreContext);
|
|
@@ -2761,37 +2796,6 @@ function Wrapper({ children, nodes, edges, width, height, fitView, }) {
|
|
|
2761
2796
|
}
|
|
2762
2797
|
return (jsx(ReactFlowProvider, { initialNodes: nodes, initialEdges: edges, initialWidth: width, initialHeight: height, fitView: fitView, children: children }));
|
|
2763
2798
|
}
|
|
2764
|
-
Wrapper.displayName = 'ReactFlowWrapper';
|
|
2765
|
-
|
|
2766
|
-
function getMediaQuery() {
|
|
2767
|
-
if (typeof window === 'undefined' || !window.matchMedia) {
|
|
2768
|
-
return null;
|
|
2769
|
-
}
|
|
2770
|
-
return window.matchMedia('(prefers-color-scheme: dark)');
|
|
2771
|
-
}
|
|
2772
|
-
/**
|
|
2773
|
-
* Hook for receiving the current color mode class 'dark' or 'light'.
|
|
2774
|
-
*
|
|
2775
|
-
* @internal
|
|
2776
|
-
* @param colorMode - The color mode to use ('dark', 'light' or 'system')
|
|
2777
|
-
*/
|
|
2778
|
-
function useColorModeClass(colorMode) {
|
|
2779
|
-
const [colorModeClass, setColorModeClass] = useState(colorMode === 'system' ? null : colorMode);
|
|
2780
|
-
useEffect(() => {
|
|
2781
|
-
if (colorMode !== 'system') {
|
|
2782
|
-
setColorModeClass(colorMode);
|
|
2783
|
-
return;
|
|
2784
|
-
}
|
|
2785
|
-
const mediaQuery = getMediaQuery();
|
|
2786
|
-
const updateColorModeClass = () => setColorModeClass(mediaQuery?.matches ? 'dark' : 'light');
|
|
2787
|
-
updateColorModeClass();
|
|
2788
|
-
mediaQuery?.addEventListener('change', updateColorModeClass);
|
|
2789
|
-
return () => {
|
|
2790
|
-
mediaQuery?.removeEventListener('change', updateColorModeClass);
|
|
2791
|
-
};
|
|
2792
|
-
}, [colorMode]);
|
|
2793
|
-
return colorModeClass !== null ? colorModeClass : getMediaQuery()?.matches ? 'dark' : 'light';
|
|
2794
|
-
}
|
|
2795
2799
|
|
|
2796
2800
|
const initNodeOrigin = [0, 0];
|
|
2797
2801
|
const initDefaultViewport = { x: 0, y: 0, zoom: 1 };
|
|
@@ -2805,7 +2809,7 @@ const wrapperStyle = {
|
|
|
2805
2809
|
const ReactFlow = forwardRef(({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes, edgeTypes, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = 'Backspace', selectionKeyCode = 'Shift', selectionOnDrag = false, selectionMode = SelectionMode.Full, panActivationKeyCode = 'Space', multiSelectionKeyCode = isMacOs() ? 'Meta' : 'Control', zoomActivationKeyCode = isMacOs() ? 'Meta' : 'Control', snapToGrid, snapGrid, onlyRenderVisibleElements = false, selectNodesOnDrag, nodesDraggable, nodesConnectable, nodesFocusable, nodeOrigin = initNodeOrigin, edgesFocusable, edgesUpdatable, elementsSelectable = true, defaultViewport = initDefaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = true, nodeExtent, defaultMarkerColor = '#b1b1b7', zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, children, onEdgeUpdate, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeUpdateStart, onEdgeUpdateEnd, edgeUpdaterRadius = 10, onNodesChange, onEdgesChange, noDragClassName = 'nodrag', noWheelClassName = 'nowheel', noPanClassName = 'nopan', fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = false, autoPanOnConnect, autoPanOnNodeDrag, connectionRadius, isValidConnection, onError, style, id, nodeDragThreshold, viewport, onViewportChange, width, height, colorMode = 'light', ...rest }, ref) => {
|
|
2806
2810
|
const rfId = id || '1';
|
|
2807
2811
|
const colorModeClassName = useColorModeClass(colorMode);
|
|
2808
|
-
return (jsx("div", { ...rest, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className, colorModeClassName]), "data-testid": "rf__wrapper", id: id, children: jsxs(Wrapper, { nodes: nodes, edges: edges, width: width, height: height, fitView: fitView, children: [jsx(GraphView
|
|
2812
|
+
return (jsx("div", { ...rest, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className, colorModeClassName]), "data-testid": "rf__wrapper", id: id, children: jsxs(Wrapper, { nodes: nodes, edges: edges, width: width, height: height, fitView: fitView, children: [jsx(GraphView, { onInit: onInit, onNodeClick: onNodeClick, onEdgeClick: onEdgeClick, onNodeMouseEnter: onNodeMouseEnter, onNodeMouseMove: onNodeMouseMove, onNodeMouseLeave: onNodeMouseLeave, onNodeContextMenu: onNodeContextMenu, onNodeDoubleClick: onNodeDoubleClick, nodeTypes: nodeTypes, edgeTypes: edgeTypes, connectionLineType: connectionLineType, connectionLineStyle: connectionLineStyle, connectionLineComponent: connectionLineComponent, connectionLineContainerStyle: connectionLineContainerStyle, selectionKeyCode: selectionKeyCode, selectionOnDrag: selectionOnDrag, selectionMode: selectionMode, deleteKeyCode: deleteKeyCode, multiSelectionKeyCode: multiSelectionKeyCode, panActivationKeyCode: panActivationKeyCode, zoomActivationKeyCode: zoomActivationKeyCode, onlyRenderVisibleElements: onlyRenderVisibleElements, defaultViewport: defaultViewport, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, preventScrolling: preventScrolling, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, zoomOnDoubleClick: zoomOnDoubleClick, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, panOnDrag: panOnDrag, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneScroll: onPaneScroll, onPaneContextMenu: onPaneContextMenu, onSelectionContextMenu: onSelectionContextMenu, onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onEdgeUpdate: onEdgeUpdate, onEdgeContextMenu: onEdgeContextMenu, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeMouseEnter: onEdgeMouseEnter, onEdgeMouseMove: onEdgeMouseMove, onEdgeMouseLeave: onEdgeMouseLeave, onEdgeUpdateStart: onEdgeUpdateStart, onEdgeUpdateEnd: onEdgeUpdateEnd, edgeUpdaterRadius: edgeUpdaterRadius, defaultMarkerColor: defaultMarkerColor, noDragClassName: noDragClassName, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, rfId: rfId, disableKeyboardA11y: disableKeyboardA11y, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, viewport: viewport, onViewportChange: onViewportChange }), jsx(StoreUpdater, { nodes: nodes, edges: edges, defaultNodes: defaultNodes, defaultEdges: defaultEdges, onConnect: onConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, onClickConnectStart: onClickConnectStart, onClickConnectEnd: onClickConnectEnd, nodesDraggable: nodesDraggable, nodesConnectable: nodesConnectable, nodesFocusable: nodesFocusable, edgesFocusable: edgesFocusable, edgesUpdatable: edgesUpdatable, elementsSelectable: elementsSelectable, elevateNodesOnSelect: elevateNodesOnSelect, elevateEdgesOnSelect: elevateEdgesOnSelect, minZoom: minZoom, maxZoom: maxZoom, nodeExtent: nodeExtent, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, snapToGrid: snapToGrid, snapGrid: snapGrid, connectionMode: connectionMode, translateExtent: translateExtent, connectOnClick: connectOnClick, defaultEdgeOptions: defaultEdgeOptions, fitView: fitView, fitViewOptions: fitViewOptions, onNodesDelete: onNodesDelete, onEdgesDelete: onEdgesDelete, onDelete: onDelete, onNodeDragStart: onNodeDragStart, onNodeDrag: onNodeDrag, onNodeDragStop: onNodeDragStop, onSelectionDrag: onSelectionDrag, onSelectionDragStart: onSelectionDragStart, onSelectionDragStop: onSelectionDragStop, onMove: onMove, onMoveStart: onMoveStart, onMoveEnd: onMoveEnd, noPanClassName: noPanClassName, nodeOrigin: nodeOrigin, rfId: rfId, autoPanOnConnect: autoPanOnConnect, autoPanOnNodeDrag: autoPanOnNodeDrag, onError: onError, connectionRadius: connectionRadius, isValidConnection: isValidConnection, selectNodesOnDrag: selectNodesOnDrag, nodeDragThreshold: nodeDragThreshold, onBeforeDelete: onBeforeDelete }), jsx(SelectionListener, { onSelectionChange: onSelectionChange }), children, jsx(Attribution, { proOptions: proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId: rfId, disableKeyboardA11y: disableKeyboardA11y })] }) }));
|
|
2809
2813
|
});
|
|
2810
2814
|
ReactFlow.displayName = 'ReactFlow';
|
|
2811
2815
|
|
|
@@ -3039,13 +3043,6 @@ function useConnection() {
|
|
|
3039
3043
|
return ongoingConnection;
|
|
3040
3044
|
}
|
|
3041
3045
|
|
|
3042
|
-
var BackgroundVariant;
|
|
3043
|
-
(function (BackgroundVariant) {
|
|
3044
|
-
BackgroundVariant["Lines"] = "lines";
|
|
3045
|
-
BackgroundVariant["Dots"] = "dots";
|
|
3046
|
-
BackgroundVariant["Cross"] = "cross";
|
|
3047
|
-
})(BackgroundVariant || (BackgroundVariant = {}));
|
|
3048
|
-
|
|
3049
3046
|
function LinePattern({ dimensions, lineWidth, variant, className }) {
|
|
3050
3047
|
return (jsx("path", { strokeWidth: lineWidth, d: `M${dimensions[0] / 2} 0 V${dimensions[1]} M0 ${dimensions[1] / 2} H${dimensions[0]}`, className: cc(['react-flow__background-pattern', variant, className]) }));
|
|
3051
3048
|
}
|
|
@@ -3053,13 +3050,20 @@ function DotPattern({ radius, className }) {
|
|
|
3053
3050
|
return (jsx("circle", { cx: radius, cy: radius, r: radius, className: cc(['react-flow__background-pattern', 'dots', className]) }));
|
|
3054
3051
|
}
|
|
3055
3052
|
|
|
3053
|
+
var BackgroundVariant;
|
|
3054
|
+
(function (BackgroundVariant) {
|
|
3055
|
+
BackgroundVariant["Lines"] = "lines";
|
|
3056
|
+
BackgroundVariant["Dots"] = "dots";
|
|
3057
|
+
BackgroundVariant["Cross"] = "cross";
|
|
3058
|
+
})(BackgroundVariant || (BackgroundVariant = {}));
|
|
3059
|
+
|
|
3056
3060
|
const defaultSize = {
|
|
3057
3061
|
[BackgroundVariant.Dots]: 1,
|
|
3058
3062
|
[BackgroundVariant.Lines]: 1,
|
|
3059
3063
|
[BackgroundVariant.Cross]: 6,
|
|
3060
3064
|
};
|
|
3061
3065
|
const selector$4 = (s) => ({ transform: s.transform, patternId: `pattern-${s.rfId}` });
|
|
3062
|
-
function
|
|
3066
|
+
function BackgroundComponent({ id, variant = BackgroundVariant.Dots,
|
|
3063
3067
|
// only used for dots and cross
|
|
3064
3068
|
gap = 20,
|
|
3065
3069
|
// only used for lines and cross
|
|
@@ -3084,8 +3088,8 @@ size, lineWidth = 1, offset = 2, color, bgColor, style, className, patternClassN
|
|
|
3084
3088
|
'--xy-background-pattern-color-props': color,
|
|
3085
3089
|
}, ref: ref, "data-testid": "rf__background", children: [jsx("pattern", { id: _patternId, x: transform[0] % scaledGap[0], y: transform[1] % scaledGap[1], width: scaledGap[0], height: scaledGap[1], patternUnits: "userSpaceOnUse", patternTransform: `translate(-${patternOffset[0]},-${patternOffset[1]})`, children: isDots ? (jsx(DotPattern, { radius: scaledSize / offset, className: patternClassName })) : (jsx(LinePattern, { dimensions: patternDimensions, lineWidth: lineWidth, variant: variant, className: patternClassName })) }), jsx("rect", { x: "0", y: "0", width: "100%", height: "100%", fill: `url(#${_patternId})` })] }));
|
|
3086
3090
|
}
|
|
3087
|
-
|
|
3088
|
-
|
|
3091
|
+
BackgroundComponent.displayName = 'Background';
|
|
3092
|
+
const Background = memo(BackgroundComponent);
|
|
3089
3093
|
|
|
3090
3094
|
function PlusIcon() {
|
|
3091
3095
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", children: jsx("path", { d: "M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z" }) }));
|
|
@@ -3107,15 +3111,16 @@ function UnlockIcon() {
|
|
|
3107
3111
|
return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 25 32", children: jsx("path", { d: "M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z" }) }));
|
|
3108
3112
|
}
|
|
3109
3113
|
|
|
3110
|
-
|
|
3111
|
-
|
|
3114
|
+
function ControlButton({ children, className, ...rest }) {
|
|
3115
|
+
return (jsx("button", { type: "button", className: cc(['react-flow__controls-button', className]), ...rest, children: children }));
|
|
3116
|
+
}
|
|
3112
3117
|
|
|
3113
3118
|
const selector$3 = (s) => ({
|
|
3114
3119
|
isInteractive: s.nodesDraggable || s.nodesConnectable || s.elementsSelectable,
|
|
3115
3120
|
minZoomReached: s.transform[2] <= s.minZoom,
|
|
3116
3121
|
maxZoomReached: s.transform[2] >= s.maxZoom,
|
|
3117
3122
|
});
|
|
3118
|
-
|
|
3123
|
+
function ControlsComponent({ style, showZoom = true, showFitView = true, showInteractive = true, fitViewOptions, onZoomIn, onZoomOut, onFitView, onInteractiveChange, className, children, position = 'bottom-left', }) {
|
|
3119
3124
|
const store = useStoreApi();
|
|
3120
3125
|
const { isInteractive, minZoomReached, maxZoomReached } = useStore(selector$3, shallow);
|
|
3121
3126
|
const { zoomIn, zoomOut, fitView } = useReactFlow();
|
|
@@ -3140,11 +3145,11 @@ const Controls = ({ style, showZoom = true, showFitView = true, showInteractive
|
|
|
3140
3145
|
onInteractiveChange?.(!isInteractive);
|
|
3141
3146
|
};
|
|
3142
3147
|
return (jsxs(Panel, { className: cc(['react-flow__controls', className]), position: position, style: style, "data-testid": "rf__controls", children: [showZoom && (jsxs(Fragment, { children: [jsx(ControlButton, { onClick: onZoomInHandler, className: "react-flow__controls-zoomin", title: "zoom in", "aria-label": "zoom in", disabled: maxZoomReached, children: jsx(PlusIcon, {}) }), jsx(ControlButton, { onClick: onZoomOutHandler, className: "react-flow__controls-zoomout", title: "zoom out", "aria-label": "zoom out", disabled: minZoomReached, children: jsx(MinusIcon, {}) })] })), showFitView && (jsx(ControlButton, { className: "react-flow__controls-fitview", onClick: onFitViewHandler, title: "fit view", "aria-label": "fit view", children: jsx(FitViewIcon, {}) })), showInteractive && (jsx(ControlButton, { className: "react-flow__controls-interactive", onClick: onToggleInteractivity, title: "toggle interactivity", "aria-label": "toggle interactivity", children: isInteractive ? jsx(UnlockIcon, {}) : jsx(LockIcon, {}) })), children] }));
|
|
3143
|
-
}
|
|
3144
|
-
|
|
3145
|
-
|
|
3148
|
+
}
|
|
3149
|
+
ControlsComponent.displayName = 'Controls';
|
|
3150
|
+
const Controls = memo(ControlsComponent);
|
|
3146
3151
|
|
|
3147
|
-
function
|
|
3152
|
+
function MiniMapNodeComponent({ id, x, y, width, height, style, color, strokeColor, strokeWidth, className, borderRadius, shapeRendering, selected, onClick, }) {
|
|
3148
3153
|
const { background, backgroundColor } = style || {};
|
|
3149
3154
|
const fill = (color || background || backgroundColor);
|
|
3150
3155
|
return (jsx("rect", { className: cc(['react-flow__minimap-node', { selected }, className]), x: x, y: y, rx: borderRadius, ry: borderRadius, width: width, height: height, style: {
|
|
@@ -3153,7 +3158,7 @@ function MiniMapNode({ id, x, y, width, height, style, color, strokeColor, strok
|
|
|
3153
3158
|
strokeWidth,
|
|
3154
3159
|
}, shapeRendering: shapeRendering, onClick: onClick ? (event) => onClick(event, id) : undefined }));
|
|
3155
3160
|
}
|
|
3156
|
-
|
|
3161
|
+
const MiniMapNode = memo(MiniMapNodeComponent);
|
|
3157
3162
|
|
|
3158
3163
|
const selector$2 = (s) => s.nodeOrigin;
|
|
3159
3164
|
const selectorNodeIds = (s) => s.nodes.map((node) => node.id);
|
|
@@ -3161,7 +3166,7 @@ const getAttrFunction = (func) => (func instanceof Function ? func : () => func)
|
|
|
3161
3166
|
function MiniMapNodes({ nodeStrokeColor, nodeColor, nodeClassName = '', nodeBorderRadius = 5, nodeStrokeWidth,
|
|
3162
3167
|
// We need to rename the prop to be `CapitalCase` so that JSX will render it as
|
|
3163
3168
|
// a component properly.
|
|
3164
|
-
nodeComponent: NodeComponent = MiniMapNode
|
|
3169
|
+
nodeComponent: NodeComponent = MiniMapNode, onClick, }) {
|
|
3165
3170
|
const nodeIds = useStore(selectorNodeIds, shallow);
|
|
3166
3171
|
const nodeOrigin = useStore(selector$2);
|
|
3167
3172
|
const nodeColorFunc = getAttrFunction(nodeColor);
|
|
@@ -3214,7 +3219,7 @@ const selector$1 = (s) => {
|
|
|
3214
3219
|
};
|
|
3215
3220
|
};
|
|
3216
3221
|
const ARIA_LABEL_KEY = 'react-flow__minimap-desc';
|
|
3217
|
-
function
|
|
3222
|
+
function MiniMapComponent({ style, className, nodeStrokeColor, nodeColor, nodeClassName = '', nodeBorderRadius = 5, nodeStrokeWidth,
|
|
3218
3223
|
// We need to rename the prop to be `CapitalCase` so that JSX will render it as
|
|
3219
3224
|
// a component properly.
|
|
3220
3225
|
nodeComponent, maskColor, maskStrokeColor = 'none', maskStrokeWidth = 1, position = 'bottom-right', onClick, onNodeClick, pannable = false, zoomable = false, ariaLabel = 'React Flow mini map', inversePan, zoomStep = 10, offsetScale = 5, }) {
|
|
@@ -3282,182 +3287,90 @@ nodeComponent, maskColor, maskStrokeColor = 'none', maskStrokeWidth = 1, positio
|
|
|
3282
3287
|
}, className: cc(['react-flow__minimap', className]), "data-testid": "rf__minimap", children: jsxs("svg", { width: elementWidth, height: elementHeight, viewBox: `${x} ${y} ${width} ${height}`, role: "img", "aria-labelledby": labelledBy, ref: svg, onClick: onSvgClick, children: [ariaLabel && jsx("title", { id: labelledBy, children: ariaLabel }), jsx(MiniMapNodes$1, { onClick: onSvgNodeClick, nodeColor: nodeColor, nodeStrokeColor: nodeStrokeColor, nodeBorderRadius: nodeBorderRadius, nodeClassName: nodeClassName, nodeStrokeWidth: nodeStrokeWidth, nodeComponent: nodeComponent }), jsx("path", { className: "react-flow__minimap-mask", d: `M${x - offset},${y - offset}h${width + offset * 2}v${height + offset * 2}h${-width - offset * 2}z
|
|
3283
3288
|
M${viewBB.x},${viewBB.y}h${viewBB.width}v${viewBB.height}h${-viewBB.width}z`, fillRule: "evenodd", stroke: maskStrokeColor, strokeWidth: maskStrokeWidth, pointerEvents: "none" })] }) }));
|
|
3284
3289
|
}
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
var ResizeControlVariant;
|
|
3289
|
-
(function (ResizeControlVariant) {
|
|
3290
|
-
ResizeControlVariant["Line"] = "line";
|
|
3291
|
-
ResizeControlVariant["Handle"] = "handle";
|
|
3292
|
-
})(ResizeControlVariant || (ResizeControlVariant = {}));
|
|
3293
|
-
|
|
3294
|
-
// returns an array of two numbers (0, 1 or -1) representing the direction of the resize
|
|
3295
|
-
// 0 = no change, 1 = increase, -1 = decrease
|
|
3296
|
-
function getDirection({ width, prevWidth, height, prevHeight, invertX, invertY }) {
|
|
3297
|
-
const deltaWidth = width - prevWidth;
|
|
3298
|
-
const deltaHeight = height - prevHeight;
|
|
3299
|
-
const direction = [deltaWidth > 0 ? 1 : deltaWidth < 0 ? -1 : 0, deltaHeight > 0 ? 1 : deltaHeight < 0 ? -1 : 0];
|
|
3300
|
-
if (deltaWidth && invertX) {
|
|
3301
|
-
direction[0] = direction[0] * -1;
|
|
3302
|
-
}
|
|
3303
|
-
if (deltaHeight && invertY) {
|
|
3304
|
-
direction[1] = direction[1] * -1;
|
|
3305
|
-
}
|
|
3306
|
-
return direction;
|
|
3307
|
-
}
|
|
3290
|
+
MiniMapComponent.displayName = 'MiniMap';
|
|
3291
|
+
const MiniMap = memo(MiniMapComponent);
|
|
3308
3292
|
|
|
3309
|
-
const initPrevValues = { width: 0, height: 0, x: 0, y: 0 };
|
|
3310
|
-
const initStartValues = {
|
|
3311
|
-
...initPrevValues,
|
|
3312
|
-
pointerX: 0,
|
|
3313
|
-
pointerY: 0,
|
|
3314
|
-
aspectRatio: 1,
|
|
3315
|
-
};
|
|
3316
3293
|
function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle, className, style = {}, children, color, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = false, shouldResize, onResizeStart, onResize, onResizeEnd, }) {
|
|
3317
3294
|
const contextNodeId = useNodeId();
|
|
3318
3295
|
const id = typeof nodeId === 'string' ? nodeId : contextNodeId;
|
|
3319
3296
|
const store = useStoreApi();
|
|
3320
3297
|
const resizeControlRef = useRef(null);
|
|
3321
|
-
const startValues = useRef(initStartValues);
|
|
3322
|
-
const prevValues = useRef(initPrevValues);
|
|
3323
3298
|
const defaultPosition = variant === ResizeControlVariant.Line ? 'right' : 'bottom-right';
|
|
3324
3299
|
const controlPosition = position ?? defaultPosition;
|
|
3300
|
+
const resizer = useRef(null);
|
|
3325
3301
|
useEffect(() => {
|
|
3326
3302
|
if (!resizeControlRef.current || !id) {
|
|
3327
3303
|
return;
|
|
3328
3304
|
}
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
...prevValues.current,
|
|
3347
|
-
pointerX: xSnapped,
|
|
3348
|
-
pointerY: ySnapped,
|
|
3349
|
-
aspectRatio: prevValues.current.width / prevValues.current.height,
|
|
3350
|
-
};
|
|
3351
|
-
onResizeStart?.(event, { ...prevValues.current });
|
|
3352
|
-
})
|
|
3353
|
-
.on('drag', (event) => {
|
|
3354
|
-
const { nodeLookup, transform, snapGrid, snapToGrid, triggerNodeChanges } = store.getState();
|
|
3355
|
-
const { xSnapped, ySnapped } = getPointerPosition(event.sourceEvent, { transform, snapGrid, snapToGrid });
|
|
3356
|
-
const node = nodeLookup.get(id);
|
|
3357
|
-
if (node) {
|
|
3358
|
-
const changes = [];
|
|
3359
|
-
const { pointerX: startX, pointerY: startY, width: startWidth, height: startHeight, x: startNodeX, y: startNodeY, aspectRatio, } = startValues.current;
|
|
3360
|
-
const { x: prevX, y: prevY, width: prevWidth, height: prevHeight } = prevValues.current;
|
|
3361
|
-
const distX = Math.floor(enableX ? xSnapped - startX : 0);
|
|
3362
|
-
const distY = Math.floor(enableY ? ySnapped - startY : 0);
|
|
3363
|
-
let width = clamp(startWidth + (invertX ? -distX : distX), minWidth, maxWidth);
|
|
3364
|
-
let height = clamp(startHeight + (invertY ? -distY : distY), minHeight, maxHeight);
|
|
3365
|
-
if (keepAspectRatio) {
|
|
3366
|
-
const nextAspectRatio = width / height;
|
|
3367
|
-
const isDiagonal = enableX && enableY;
|
|
3368
|
-
const isHorizontal = enableX && !enableY;
|
|
3369
|
-
const isVertical = enableY && !enableX;
|
|
3370
|
-
width = (nextAspectRatio <= aspectRatio && isDiagonal) || isVertical ? height * aspectRatio : width;
|
|
3371
|
-
height = (nextAspectRatio > aspectRatio && isDiagonal) || isHorizontal ? width / aspectRatio : height;
|
|
3372
|
-
if (width >= maxWidth) {
|
|
3373
|
-
width = maxWidth;
|
|
3374
|
-
height = maxWidth / aspectRatio;
|
|
3375
|
-
}
|
|
3376
|
-
else if (width <= minWidth) {
|
|
3377
|
-
width = minWidth;
|
|
3378
|
-
height = minWidth / aspectRatio;
|
|
3379
|
-
}
|
|
3380
|
-
if (height >= maxHeight) {
|
|
3381
|
-
height = maxHeight;
|
|
3382
|
-
width = maxHeight * aspectRatio;
|
|
3383
|
-
}
|
|
3384
|
-
else if (height <= minHeight) {
|
|
3385
|
-
height = minHeight;
|
|
3386
|
-
width = minHeight * aspectRatio;
|
|
3387
|
-
}
|
|
3388
|
-
}
|
|
3389
|
-
const isWidthChange = width !== prevWidth;
|
|
3390
|
-
const isHeightChange = height !== prevHeight;
|
|
3391
|
-
if (invertX || invertY) {
|
|
3392
|
-
const x = invertX ? startNodeX - (width - startWidth) : startNodeX;
|
|
3393
|
-
const y = invertY ? startNodeY - (height - startHeight) : startNodeY;
|
|
3394
|
-
// only transform the node if the width or height changes
|
|
3395
|
-
const isXPosChange = x !== prevX && isWidthChange;
|
|
3396
|
-
const isYPosChange = y !== prevY && isHeightChange;
|
|
3397
|
-
if (isXPosChange || isYPosChange) {
|
|
3305
|
+
if (!resizer.current) {
|
|
3306
|
+
resizer.current = XYResizer({
|
|
3307
|
+
domNode: resizeControlRef.current,
|
|
3308
|
+
nodeId: id,
|
|
3309
|
+
getStoreItems: () => {
|
|
3310
|
+
const { nodeLookup, transform, snapGrid, snapToGrid } = store.getState();
|
|
3311
|
+
return {
|
|
3312
|
+
nodeLookup,
|
|
3313
|
+
transform,
|
|
3314
|
+
snapGrid,
|
|
3315
|
+
snapToGrid,
|
|
3316
|
+
};
|
|
3317
|
+
},
|
|
3318
|
+
onChange: (change) => {
|
|
3319
|
+
const { triggerNodeChanges } = store.getState();
|
|
3320
|
+
const changes = [];
|
|
3321
|
+
if (change.isXPosChange || change.isYPosChange) {
|
|
3398
3322
|
const positionChange = {
|
|
3399
|
-
id
|
|
3323
|
+
id,
|
|
3400
3324
|
type: 'position',
|
|
3401
3325
|
position: {
|
|
3402
|
-
x:
|
|
3403
|
-
y:
|
|
3326
|
+
x: change.x,
|
|
3327
|
+
y: change.y,
|
|
3404
3328
|
},
|
|
3405
3329
|
};
|
|
3406
3330
|
changes.push(positionChange);
|
|
3407
|
-
prevValues.current.x = positionChange.position.x;
|
|
3408
|
-
prevValues.current.y = positionChange.position.y;
|
|
3409
3331
|
}
|
|
3410
|
-
|
|
3411
|
-
|
|
3332
|
+
if (change.isWidthChange || change.isHeightChange) {
|
|
3333
|
+
const dimensionChange = {
|
|
3334
|
+
id,
|
|
3335
|
+
type: 'dimensions',
|
|
3336
|
+
resizing: true,
|
|
3337
|
+
dimensions: {
|
|
3338
|
+
width: change.width,
|
|
3339
|
+
height: change.height,
|
|
3340
|
+
},
|
|
3341
|
+
};
|
|
3342
|
+
changes.push(dimensionChange);
|
|
3343
|
+
}
|
|
3344
|
+
triggerNodeChanges(changes);
|
|
3345
|
+
},
|
|
3346
|
+
onEnd: () => {
|
|
3412
3347
|
const dimensionChange = {
|
|
3413
3348
|
id: id,
|
|
3414
3349
|
type: 'dimensions',
|
|
3415
|
-
|
|
3416
|
-
resizing: true,
|
|
3417
|
-
dimensions: {
|
|
3418
|
-
width: width,
|
|
3419
|
-
height: height,
|
|
3420
|
-
},
|
|
3350
|
+
resizing: false,
|
|
3421
3351
|
};
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
|
|
3439
|
-
if (callResize === false) {
|
|
3440
|
-
return;
|
|
3441
|
-
}
|
|
3442
|
-
onResize?.(event, nextValues);
|
|
3443
|
-
triggerNodeChanges(changes);
|
|
3444
|
-
}
|
|
3445
|
-
})
|
|
3446
|
-
.on('end', (event) => {
|
|
3447
|
-
const dimensionChange = {
|
|
3448
|
-
id: id,
|
|
3449
|
-
type: 'dimensions',
|
|
3450
|
-
resizing: false,
|
|
3451
|
-
};
|
|
3452
|
-
onResizeEnd?.(event, { ...prevValues.current });
|
|
3453
|
-
store.getState().triggerNodeChanges([dimensionChange]);
|
|
3352
|
+
store.getState().triggerNodeChanges([dimensionChange]);
|
|
3353
|
+
},
|
|
3354
|
+
});
|
|
3355
|
+
}
|
|
3356
|
+
resizer.current.update({
|
|
3357
|
+
controlPosition,
|
|
3358
|
+
boundaries: {
|
|
3359
|
+
minWidth,
|
|
3360
|
+
minHeight,
|
|
3361
|
+
maxWidth,
|
|
3362
|
+
maxHeight,
|
|
3363
|
+
},
|
|
3364
|
+
keepAspectRatio,
|
|
3365
|
+
onResizeStart,
|
|
3366
|
+
onResize,
|
|
3367
|
+
onResizeEnd,
|
|
3368
|
+
shouldResize,
|
|
3454
3369
|
});
|
|
3455
|
-
selection.call(dragHandler);
|
|
3456
3370
|
return () => {
|
|
3457
|
-
|
|
3371
|
+
resizer.current?.destroy();
|
|
3458
3372
|
};
|
|
3459
3373
|
}, [
|
|
3460
|
-
id,
|
|
3461
3374
|
controlPosition,
|
|
3462
3375
|
minWidth,
|
|
3463
3376
|
minHeight,
|
|
@@ -3467,21 +3380,20 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
|
|
|
3467
3380
|
onResizeStart,
|
|
3468
3381
|
onResize,
|
|
3469
3382
|
onResizeEnd,
|
|
3383
|
+
shouldResize,
|
|
3470
3384
|
]);
|
|
3471
3385
|
const positionClassNames = controlPosition.split('-');
|
|
3472
3386
|
const colorStyleProp = variant === ResizeControlVariant.Line ? 'borderColor' : 'backgroundColor';
|
|
3473
3387
|
const controlStyle = color ? { ...style, [colorStyleProp]: color } : style;
|
|
3474
3388
|
return (jsx("div", { className: cc(['react-flow__resize-control', 'nodrag', ...positionClassNames, variant, className]), ref: resizeControlRef, style: controlStyle, children: children }));
|
|
3475
3389
|
}
|
|
3476
|
-
|
|
3390
|
+
const NodeResizeControl = memo(ResizeControl);
|
|
3477
3391
|
|
|
3478
|
-
const handleControls = ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
|
|
3479
|
-
const lineControls = ['top', 'right', 'bottom', 'left'];
|
|
3480
3392
|
function NodeResizer({ nodeId, isVisible = true, handleClassName, handleStyle, lineClassName, lineStyle, color, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = false, shouldResize, onResizeStart, onResize, onResizeEnd, }) {
|
|
3481
3393
|
if (!isVisible) {
|
|
3482
3394
|
return null;
|
|
3483
3395
|
}
|
|
3484
|
-
return (jsxs(Fragment, { children: [
|
|
3396
|
+
return (jsxs(Fragment, { children: [XY_RESIZER_LINE_POSITIONS.map((position) => (jsx(NodeResizeControl, { className: lineClassName, style: lineStyle, nodeId: nodeId, position: position, variant: ResizeControlVariant.Line, color: color, minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight, onResizeStart: onResizeStart, keepAspectRatio: keepAspectRatio, shouldResize: shouldResize, onResize: onResize, onResizeEnd: onResizeEnd }, position))), XY_RESIZER_HANDLE_POSITIONS.map((position) => (jsx(NodeResizeControl, { className: handleClassName, style: handleStyle, nodeId: nodeId, position: position, color: color, minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight, onResizeStart: onResizeStart, keepAspectRatio: keepAspectRatio, shouldResize: shouldResize, onResize: onResize, onResizeEnd: onResizeEnd }, position)))] }));
|
|
3485
3397
|
}
|
|
3486
3398
|
|
|
3487
3399
|
const selector = (state) => state.domNode?.querySelector('.react-flow__renderer');
|
|
@@ -3544,4 +3456,4 @@ function NodeToolbar({ nodeId, children, className, style, isVisible, position =
|
|
|
3544
3456
|
return (jsx(NodeToolbarPortal, { children: jsx("div", { style: wrapperStyle, className: cc(['react-flow__node-toolbar', className]), ...rest, "data-id": nodes.reduce((acc, node) => `${acc}${node.id} `, '').trim(), children: children }) }));
|
|
3545
3457
|
}
|
|
3546
3458
|
|
|
3547
|
-
export { Background
|
|
3459
|
+
export { Background, BackgroundVariant, BaseEdge, BezierEdge, ControlButton, Controls, EdgeLabelRenderer, EdgeText, Handle, MiniMap, NodeResizeControl, NodeResizer, NodeToolbar, Panel, ReactFlow, ReactFlowProvider, SimpleBezierEdge, SmoothStepEdge, StepEdge, StraightEdge, ViewportPortal, addEdge, applyEdgeChanges, applyNodeChanges, getConnectedEdges, getIncomers, getOutgoers, getSimpleBezierPath, handleParentExpand, isEdge, isNode, updateEdge, useConnection, useEdges, useEdgesState, useHandleConnections, useKeyPress, useNodeId, useNodes, useNodesData, useNodesInitialized, useNodesState, useOnSelectionChange, useOnViewportChange, useReactFlow, useStore, useStoreApi, useUpdateNodeInternals, useViewport };
|