@xyflow/react 12.0.4 → 12.1.1

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.
Files changed (36) hide show
  1. package/dist/base.css +8 -8
  2. package/dist/esm/additional-components/Background/Background.d.ts.map +1 -1
  3. package/dist/esm/additional-components/Background/types.d.ts +1 -1
  4. package/dist/esm/additional-components/Background/types.d.ts.map +1 -1
  5. package/dist/esm/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
  6. package/dist/esm/components/Handle/index.d.ts.map +1 -1
  7. package/dist/esm/container/Pane/index.d.ts.map +1 -1
  8. package/dist/esm/hooks/useConnection.d.ts +1 -1
  9. package/dist/esm/hooks/useConnection.d.ts.map +1 -1
  10. package/dist/esm/index.d.ts +3 -1
  11. package/dist/esm/index.d.ts.map +1 -1
  12. package/dist/esm/index.js +84 -63
  13. package/dist/esm/index.mjs +84 -63
  14. package/dist/esm/store/index.d.ts.map +1 -1
  15. package/dist/esm/types/edges.d.ts +2 -2
  16. package/dist/esm/types/edges.d.ts.map +1 -1
  17. package/dist/esm/types/store.d.ts +4 -2
  18. package/dist/esm/types/store.d.ts.map +1 -1
  19. package/dist/style.css +8 -8
  20. package/dist/umd/additional-components/Background/Background.d.ts.map +1 -1
  21. package/dist/umd/additional-components/Background/types.d.ts +1 -1
  22. package/dist/umd/additional-components/Background/types.d.ts.map +1 -1
  23. package/dist/umd/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
  24. package/dist/umd/components/Handle/index.d.ts.map +1 -1
  25. package/dist/umd/container/Pane/index.d.ts.map +1 -1
  26. package/dist/umd/hooks/useConnection.d.ts +1 -1
  27. package/dist/umd/hooks/useConnection.d.ts.map +1 -1
  28. package/dist/umd/index.d.ts +3 -1
  29. package/dist/umd/index.d.ts.map +1 -1
  30. package/dist/umd/index.js +2 -2
  31. package/dist/umd/store/index.d.ts.map +1 -1
  32. package/dist/umd/types/edges.d.ts +2 -2
  33. package/dist/umd/types/edges.d.ts.map +1 -1
  34. package/dist/umd/types/store.d.ts +4 -2
  35. package/dist/umd/types/store.d.ts.map +1 -1
  36. package/package.json +2 -2
package/dist/base.css CHANGED
@@ -73,15 +73,15 @@
73
73
  .react-flow__pane {
74
74
  z-index: 1;
75
75
  }
76
- .react-flow__pane.selection {
77
- cursor: pointer;
78
- }
79
76
  .react-flow__pane.draggable {
80
77
  cursor: grab;
81
78
  }
82
- .react-flow__pane.draggable.dragging {
83
- cursor: grabbing;
84
- }
79
+ .react-flow__pane.dragging {
80
+ cursor: grabbing;
81
+ }
82
+ .react-flow__pane.selection {
83
+ cursor: pointer;
84
+ }
85
85
  .react-flow__viewport {
86
86
  transform-origin: 0 0;
87
87
  z-index: 2;
@@ -107,10 +107,10 @@
107
107
  stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));
108
108
  fill: none;
109
109
  }
110
- .react-flow__edges {
110
+ .react-flow .react-flow__edges {
111
111
  position: absolute;
112
112
  }
113
- .react-flow__edges svg {
113
+ .react-flow .react-flow__edges svg {
114
114
  overflow: visible;
115
115
  position: absolute;
116
116
  pointer-events: none;
@@ -1 +1 @@
1
- {"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../../src/additional-components/Background/Background.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,KAAK,eAAe,EAAqB,MAAM,SAAS,CAAC;AAWlE,iBAAS,mBAAmB,CAAC,EAC3B,EAAE,EACF,OAAgC,EAEhC,GAAQ,EAER,IAAI,EACJ,SAAa,EACb,MAAU,EACV,KAAK,EACL,OAAO,EACP,KAAK,EACL,SAAS,EACT,gBAAgB,GACjB,EAAE,eAAe,2CAuDjB;kBArEQ,mBAAmB;;;AAyE5B,eAAO,MAAM,UAAU,iEAA4B,CAAC"}
1
+ {"version":3,"file":"Background.d.ts","sourceRoot":"","sources":["../../../src/additional-components/Background/Background.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,KAAK,eAAe,EAAqB,MAAM,SAAS,CAAC;AAWlE,iBAAS,mBAAmB,CAAC,EAC3B,EAAE,EACF,OAAgC,EAEhC,GAAQ,EAER,IAAI,EACJ,SAAa,EACb,MAAU,EACV,KAAK,EACL,OAAO,EACP,KAAK,EACL,SAAS,EACT,gBAAgB,GACjB,EAAE,eAAe,2CAqDjB;kBAnEQ,mBAAmB;;;AAuE5B,eAAO,MAAM,UAAU,iEAA4B,CAAC"}
@@ -19,7 +19,7 @@ export type BackgroundProps = {
19
19
  /** Size of a single pattern element */
20
20
  size?: number;
21
21
  /** Offset of the pattern */
22
- offset?: number;
22
+ offset?: number | [number, number];
23
23
  /** Line width of the Line pattern */
24
24
  lineWidth?: number;
25
25
  /** Variant of the pattern
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/Background/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,qCAAqC;IACrC,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/Background/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,qCAAqC;IACrC,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EdgeUpdateAnchors.d.ts","sourceRoot":"","sources":["../../../src/components/EdgeWrapper/EdgeUpdateAnchors.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGhE,KAAK,sBAAsB,CAAC,QAAQ,SAAS,IAAI,GAA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AAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAkND;;GAEG;AACH,eAAO,MAAM,MAAM,0HAAyC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Handle/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EAKpB,MAAM,OAAO,CAAC;AAGf,OAAO,EAOL,KAAK,WAAW,IAAI,iBAAiB,EAIrC,SAAS,EAGV,MAAM,gBAAgB,CAAC;AAOxB,MAAM,WAAW,WAAY,SAAQ,iBAAiB,EAAE,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC;IAChG,8CAA8C;IAC9C,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAwND;;GAEG;AACH,eAAO,MAAM,MAAM,0HAAyC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/Pane/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AAElE,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,OAAO,CACT,IAAI,CACF,cAAc,EACZ,eAAe,GACf,WAAW,GACX,kBAAkB,GAClB,gBAAgB,GAChB,aAAa,GACb,mBAAmB,GACnB,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,CACpB,CACF,CAAC;AAoBF,wBAAgB,IAAI,CAAC,EACnB,WAAW,EACX,mBAAmB,EACnB,aAAkC,EAClC,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACT,EAAE,SAAS,2CAuMX"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/Pane/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AASf,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AAElE,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,OAAO,CACT,IAAI,CACF,cAAc,EACZ,eAAe,GACf,WAAW,GACX,kBAAkB,GAClB,gBAAgB,GAChB,aAAa,GACb,mBAAmB,GACnB,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,CACpB,CACF,CAAC;AAoBF,wBAAgB,IAAI,CAAC,EACnB,WAAW,EACX,mBAAmB,EACnB,aAAkC,EAClC,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACT,EAAE,SAAS,2CAyMX"}
@@ -6,5 +6,5 @@ import type { InternalNode, Node } from '../types';
6
6
  * @public
7
7
  * @returns ConnectionState
8
8
  */
9
- export declare function useConnection<NodeType extends Node = Node>(): ConnectionState<InternalNode<NodeType>>;
9
+ export declare function useConnection<NodeType extends Node = Node, SelectorReturn = ConnectionState<InternalNode<NodeType>>>(connectionSelector?: (connection: ConnectionState<InternalNode<NodeType>>) => SelectorReturn): SelectorReturn;
10
10
  //# sourceMappingURL=useConnection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAwB,MAAM,gBAAgB,CAAC;AAGvE,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAOnE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAErG"}
1
+ {"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAwB,MAAM,gBAAgB,CAAC;AAGvE,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAqBnE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,cAAc,GAAG,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAClH,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,KAAK,cAAc,GAC3F,cAAc,CAGhB"}
@@ -31,6 +31,8 @@ export { applyNodeChanges, applyEdgeChanges } from './utils/changes';
31
31
  export { isNode, isEdge } from './utils/general';
32
32
  export * from './additional-components';
33
33
  export * from './types';
34
- export { type Align, type SmoothStepPathOptions, type BezierPathOptions, ConnectionLineType, type EdgeMarker, type EdgeMarkerType, MarkerType, type OnMove, type OnMoveStart, type OnMoveEnd, type Connection, ConnectionMode, type OnConnectStartParams, type OnConnectStart, type OnConnect, type OnConnectEnd, type Viewport, type SnapGrid, PanOnScrollMode, type ViewportHelperFunctionOptions, type SetCenterOptions, type FitBoundsOptions, type PanelPosition, type ProOptions, SelectionMode, type SelectionRect, type OnError, type NodeOrigin, type OnSelectionDrag, Position, type XYPosition, type XYZPosition, type Dimensions, type Rect, type Box, type Transform, type CoordinateExtent, type ColorMode, type ColorModeClass, type HandleType, type ShouldResize, type OnResizeStart, type OnResize, type OnResizeEnd, type ControlPosition, type ControlLinePosition, type ResizeControlVariant, type ResizeParams, type ResizeParamsWithDirection, type ResizeDragEvent, type NodeChange, type NodeDimensionChange, type NodePositionChange, type NodeSelectionChange, type NodeRemoveChange, type NodeAddChange, type NodeReplaceChange, type EdgeChange, type EdgeSelectionChange, type EdgeRemoveChange, type EdgeAddChange, type EdgeReplaceChange, type KeyCode, } from '@xyflow/system';
34
+ export { type Align, type SmoothStepPathOptions, type BezierPathOptions, ConnectionLineType, type EdgeMarker, type EdgeMarkerType, MarkerType, type OnMove, type OnMoveStart, type OnMoveEnd, type Connection, ConnectionMode, type OnConnectStartParams, type OnConnectStart, type OnConnect, type OnConnectEnd, type Viewport, type SnapGrid, PanOnScrollMode, type ViewportHelperFunctionOptions, type SetCenterOptions, type FitBoundsOptions, type PanelPosition, type ProOptions, SelectionMode, type SelectionRect, type OnError, type NodeOrigin, type OnSelectionDrag, Position, type XYPosition, type XYZPosition, type Dimensions, type Rect, type Box, type Transform, type CoordinateExtent, type ColorMode, type ColorModeClass, type HandleType, type ShouldResize, type OnResizeStart, type OnResize, type OnResizeEnd, type ControlPosition, type ControlLinePosition, type ResizeControlVariant, type ResizeParams, type ResizeParamsWithDirection, type ResizeDragEvent, type NodeChange, type NodeDimensionChange, type NodePositionChange, type NodeSelectionChange, type NodeRemoveChange, type NodeAddChange, type NodeReplaceChange, type EdgeChange, type EdgeSelectionChange, type EdgeRemoveChange, type EdgeAddChange, type EdgeReplaceChange, type KeyCode, type ConnectionState, type FinalConnectionState, type ConnectionInProgress, type NoConnection, } from '@xyflow/system';
35
+ import { type Handle as HandleBound } from '@xyflow/system';
36
+ export type Handle = HandleBound;
35
37
  export { type GetBezierPathParams, getBezierEdgeCenter, getBezierPath, getEdgeCenter, type GetSmoothStepPathParams, getSmoothStepPath, type GetStraightPathParams, getStraightPath, getViewportForBounds, getNodesBounds, getIncomers, getOutgoers, addEdge, reconnectEdge, getConnectedEdges, } from '@xyflow/system';
36
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3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,EACxB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,YAAY,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,KAAK,MAAM,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC5D,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC;AAGjC,OAAO,EACL,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,WAAW,EACX,OAAO,EACP,aAAa,EACb,iBAAiB,GAClB,MAAM,gBAAgB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -58,18 +58,18 @@ const ariaLiveStyle = {
58
58
  const ARIA_NODE_DESC_KEY = 'react-flow__node-desc';
59
59
  const ARIA_EDGE_DESC_KEY = 'react-flow__edge-desc';
60
60
  const ARIA_LIVE_MESSAGE = 'react-flow__aria-live';
61
- const selector$p = (s) => s.ariaLiveMessage;
61
+ const selector$o = (s) => s.ariaLiveMessage;
62
62
  function AriaLiveMessage({ rfId }) {
63
- const ariaLiveMessage = useStore(selector$p);
63
+ const ariaLiveMessage = useStore(selector$o);
64
64
  return (jsx("div", { id: `${ARIA_LIVE_MESSAGE}-${rfId}`, "aria-live": "assertive", "aria-atomic": "true", style: ariaLiveStyle, children: ariaLiveMessage }));
65
65
  }
66
66
  function A11yDescriptions({ rfId, disableKeyboardA11y }) {
67
67
  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 })] }));
68
68
  }
69
69
 
70
- const selector$o = (s) => (s.userSelectionActive ? 'none' : 'all');
70
+ const selector$n = (s) => (s.userSelectionActive ? 'none' : 'all');
71
71
  function Panel({ position = 'top-left', children, className, style, ...rest }) {
72
- const pointerEvents = useStore(selector$o);
72
+ const pointerEvents = useStore(selector$n);
73
73
  const positionClasses = `${position}`.split('-');
74
74
  return (jsx("div", { className: cc(['react-flow__panel', className, ...positionClasses]), style: { ...style, pointerEvents }, ...rest, children: children }));
75
75
  }
@@ -81,7 +81,7 @@ function Attribution({ proOptions, position = 'bottom-right' }) {
81
81
  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" }) }));
82
82
  }
83
83
 
84
- const selector$n = (s) => {
84
+ const selector$m = (s) => {
85
85
  const selectedNodes = [];
86
86
  const selectedEdges = [];
87
87
  for (const [, node] of s.nodeLookup) {
@@ -103,7 +103,7 @@ function areEqual(a, b) {
103
103
  }
104
104
  function SelectionListenerInner({ onSelectionChange }) {
105
105
  const store = useStoreApi();
106
- const { selectedNodes, selectedEdges } = useStore(selector$n, areEqual);
106
+ const { selectedNodes, selectedEdges } = useStore(selector$m, areEqual);
107
107
  useEffect(() => {
108
108
  const params = { nodes: selectedNodes, edges: selectedEdges };
109
109
  onSelectionChange?.(params);
@@ -188,7 +188,7 @@ const reactFlowFieldsToTrack = [
188
188
  ];
189
189
  // rfId doesn't exist in ReactFlowProps, but it's one of the fields we want to update
190
190
  const fieldsToTrack = [...reactFlowFieldsToTrack, 'rfId'];
191
- const selector$m = (s) => ({
191
+ const selector$l = (s) => ({
192
192
  setNodes: s.setNodes,
193
193
  setEdges: s.setEdges,
194
194
  setMinZoom: s.setMinZoom,
@@ -213,7 +213,7 @@ const initPrevValues = {
213
213
  paneClickDistance: 0,
214
214
  };
215
215
  function StoreUpdater(props) {
216
- const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges, setPaneClickDistance, } = useStore(selector$m, shallow);
216
+ const { setNodes, setEdges, setMinZoom, setMaxZoom, setTranslateExtent, setNodeExtent, reset, setDefaultNodesAndEdges, setPaneClickDistance, } = useStore(selector$l, shallow);
217
217
  const store = useStoreApi();
218
218
  useEffect(() => {
219
219
  setDefaultNodesAndEdges(props.defaultNodes, props.defaultEdges);
@@ -827,7 +827,7 @@ function useBatchContext() {
827
827
  return batchContext;
828
828
  }
829
829
 
830
- const selector$l = (s) => !!s.panZoom;
830
+ const selector$k = (s) => !!s.panZoom;
831
831
  /**
832
832
  * Hook for accessing the ReactFlow instance.
833
833
  *
@@ -838,7 +838,7 @@ function useReactFlow() {
838
838
  const viewportHelper = useViewportHelper();
839
839
  const store = useStoreApi();
840
840
  const batchContext = useBatchContext();
841
- const viewportInitialized = useStore(selector$l);
841
+ const viewportInitialized = useStore(selector$k);
842
842
  const generalHelper = useMemo(() => {
843
843
  const getInternalNode = (id) => store.getState().nodeLookup.get(id);
844
844
  const setNodes = (payload) => {
@@ -1057,14 +1057,14 @@ const containerStyle = {
1057
1057
  left: 0,
1058
1058
  };
1059
1059
 
1060
- const selector$k = (s) => ({
1060
+ const selector$j = (s) => ({
1061
1061
  userSelectionActive: s.userSelectionActive,
1062
1062
  lib: s.lib,
1063
1063
  });
1064
1064
  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, paneClickDistance, }) {
1065
1065
  const store = useStoreApi();
1066
1066
  const zoomPane = useRef(null);
1067
- const { userSelectionActive, lib } = useStore(selector$k, shallow);
1067
+ const { userSelectionActive, lib } = useStore(selector$j, shallow);
1068
1068
  const zoomActivationKeyPressed = useKeyPress(zoomActivationKeyCode);
1069
1069
  const panZoom = useRef();
1070
1070
  useResizeHandler(zoomPane);
@@ -1147,12 +1147,12 @@ function ZoomPane({ onPaneContextMenu, zoomOnScroll = true, zoomOnPinch = true,
1147
1147
  return (jsx("div", { className: "react-flow__renderer", ref: zoomPane, style: containerStyle, children: children }));
1148
1148
  }
1149
1149
 
1150
- const selector$j = (s) => ({
1150
+ const selector$i = (s) => ({
1151
1151
  userSelectionActive: s.userSelectionActive,
1152
1152
  userSelectionRect: s.userSelectionRect,
1153
1153
  });
1154
1154
  function UserSelection() {
1155
- const { userSelectionActive, userSelectionRect } = useStore(selector$j, shallow);
1155
+ const { userSelectionActive, userSelectionRect } = useStore(selector$i, shallow);
1156
1156
  const isActive = userSelectionActive && userSelectionRect;
1157
1157
  if (!isActive) {
1158
1158
  return null;
@@ -1172,7 +1172,7 @@ const wrapHandler = (handler, containerRef) => {
1172
1172
  handler?.(event);
1173
1173
  };
1174
1174
  };
1175
- const selector$i = (s) => ({
1175
+ const selector$h = (s) => ({
1176
1176
  userSelectionActive: s.userSelectionActive,
1177
1177
  elementsSelectable: s.elementsSelectable,
1178
1178
  dragging: s.paneDragging,
@@ -1184,7 +1184,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
1184
1184
  const prevSelectedEdgesCount = useRef(0);
1185
1185
  const containerBounds = useRef();
1186
1186
  const edgeIdLookup = useRef(new Map());
1187
- const { userSelectionActive, elementsSelectable, dragging } = useStore(selector$i, shallow);
1187
+ const { userSelectionActive, elementsSelectable, dragging } = useStore(selector$h, shallow);
1188
1188
  const hasActiveSelection = elementsSelectable && (isSelecting || userSelectionActive);
1189
1189
  // Used to prevent click events when the user lets go of the selectionKey during a selection
1190
1190
  const selectionInProgress = useRef(false);
@@ -1311,7 +1311,8 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
1311
1311
  }
1312
1312
  selectionStarted.current = false;
1313
1313
  };
1314
- return (jsxs("div", { className: cc(['react-flow__pane', { draggable: panOnDrag, dragging, selection: isSelecting }]), onClick: hasActiveSelection ? undefined : wrapHandler(onClick, container), onContextMenu: wrapHandler(onContextMenu, container), onWheel: wrapHandler(onWheel, container), onPointerEnter: hasActiveSelection ? undefined : onPaneMouseEnter, onPointerDown: hasActiveSelection ? onPointerDown : onPaneMouseMove, onPointerMove: hasActiveSelection ? onPointerMove : onPaneMouseMove, onPointerUp: hasActiveSelection ? onPointerUp : undefined, onPointerLeave: onPaneMouseLeave, ref: container, style: containerStyle, children: [children, jsx(UserSelection, {})] }));
1314
+ const draggable = panOnDrag === true || (Array.isArray(panOnDrag) && panOnDrag.includes(0));
1315
+ return (jsxs("div", { className: cc(['react-flow__pane', { draggable, dragging, selection: isSelecting }]), onClick: hasActiveSelection ? undefined : wrapHandler(onClick, container), onContextMenu: wrapHandler(onContextMenu, container), onWheel: wrapHandler(onWheel, container), onPointerEnter: hasActiveSelection ? undefined : onPaneMouseEnter, onPointerDown: hasActiveSelection ? onPointerDown : onPaneMouseMove, onPointerMove: hasActiveSelection ? onPointerMove : onPaneMouseMove, onPointerUp: hasActiveSelection ? onPointerUp : undefined, onPointerLeave: onPaneMouseLeave, ref: container, style: containerStyle, children: [children, jsx(UserSelection, {})] }));
1315
1316
  }
1316
1317
 
1317
1318
  // this handler is called by
@@ -1438,7 +1439,7 @@ const useNodeId = () => {
1438
1439
  return nodeId;
1439
1440
  };
1440
1441
 
1441
- const selector$h = (s) => ({
1442
+ const selector$g = (s) => ({
1442
1443
  connectOnClick: s.connectOnClick,
1443
1444
  noPanClassName: s.noPanClassName,
1444
1445
  rfId: s.rfId,
@@ -1463,7 +1464,7 @@ function HandleComponent({ type = 'source', position = Position.Top, isValidConn
1463
1464
  const isTarget = type === 'target';
1464
1465
  const store = useStoreApi();
1465
1466
  const nodeId = useNodeId();
1466
- const { connectOnClick, noPanClassName, rfId } = useStore(selector$h, shallow);
1467
+ const { connectOnClick, noPanClassName, rfId } = useStore(selector$g, shallow);
1467
1468
  const { connectingFrom, connectingTo, clickConnecting, isPossibleEndHandle, connectionInProcess, valid } = useStore(connectingSelector(nodeId, handleId, type), shallow);
1468
1469
  if (!nodeId) {
1469
1470
  store.getState().onError?.('010', errorMessages['error010']());
@@ -1520,7 +1521,7 @@ function HandleComponent({ type = 'source', position = Position.Top, isValidConn
1520
1521
  }
1521
1522
  };
1522
1523
  const onClick = (event) => {
1523
- const { onClickConnectStart, onClickConnectEnd, connectionClickStartHandle, connectionMode, isValidConnection: isValidConnectionStore, lib, rfId: flowId, } = store.getState();
1524
+ const { onClickConnectStart, onClickConnectEnd, connectionClickStartHandle, connectionMode, isValidConnection: isValidConnectionStore, lib, rfId: flowId, nodeLookup, connection: connectionState, } = store.getState();
1524
1525
  if (!nodeId || (!connectionClickStartHandle && !isConnectableStart)) {
1525
1526
  return;
1526
1527
  }
@@ -1545,11 +1546,15 @@ function HandleComponent({ type = 'source', position = Position.Top, isValidConn
1545
1546
  flowId,
1546
1547
  doc,
1547
1548
  lib,
1549
+ nodeLookup,
1548
1550
  });
1549
1551
  if (isValid && connection) {
1550
1552
  onConnectExtended(connection);
1551
1553
  }
1552
- onClickConnectEnd?.(event);
1554
+ const connectionClone = structuredClone(connectionState);
1555
+ delete connectionClone.inProgress;
1556
+ connectionClone.toPosition = connectionClone.toHandle ? connectionClone.toHandle.position : null;
1557
+ onClickConnectEnd?.(event, connectionClone);
1553
1558
  store.setState({ connectionClickStartHandle: null });
1554
1559
  };
1555
1560
  return (jsx("div", { "data-handleid": handleId, "data-nodeid": nodeId, "data-handlepos": position, "data-id": `${rfId}-${nodeId}-${handleId}-${type}`, className: cc([
@@ -1622,7 +1627,7 @@ function getNodeInlineStyleDimensions(node) {
1622
1627
  };
1623
1628
  }
1624
1629
 
1625
- const selector$g = (s) => {
1630
+ const selector$f = (s) => {
1626
1631
  const { width, height, x, y } = getInternalNodesBounds(s.nodeLookup, {
1627
1632
  filter: (node) => !!node.selected,
1628
1633
  });
@@ -1635,7 +1640,7 @@ const selector$g = (s) => {
1635
1640
  };
1636
1641
  function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboardA11y, }) {
1637
1642
  const store = useStoreApi();
1638
- const { width, height, transformString, userSelectionActive } = useStore(selector$g, shallow);
1643
+ const { width, height, transformString, userSelectionActive } = useStore(selector$f, shallow);
1639
1644
  const moveSelectedNodes = useMoveSelectedNodes();
1640
1645
  const nodeRef = useRef(null);
1641
1646
  useEffect(() => {
@@ -1674,11 +1679,11 @@ function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboar
1674
1679
  }
1675
1680
 
1676
1681
  const win = typeof window !== 'undefined' ? window : undefined;
1677
- const selector$f = (s) => {
1682
+ const selector$e = (s) => {
1678
1683
  return { nodesSelectionActive: s.nodesSelectionActive, userSelectionActive: s.userSelectionActive };
1679
1684
  };
1680
1685
  function FlowRendererComponent({ children, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneContextMenu, onPaneScroll, paneClickDistance, 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, }) {
1681
- const { nodesSelectionActive, userSelectionActive } = useStore(selector$f);
1686
+ const { nodesSelectionActive, userSelectionActive } = useStore(selector$e);
1682
1687
  const selectionKeyPressed = useKeyPress(selectionKeyCode, { target: win });
1683
1688
  const panActivationKeyPressed = useKeyPress(panActivationKeyCode, { target: win });
1684
1689
  const panOnDrag = panActivationKeyPressed || _panOnDrag;
@@ -1691,7 +1696,7 @@ function FlowRendererComponent({ children, onPaneClick, onPaneMouseEnter, onPane
1691
1696
  FlowRendererComponent.displayName = 'FlowRenderer';
1692
1697
  const FlowRenderer = memo(FlowRendererComponent);
1693
1698
 
1694
- const selector$e = (onlyRenderVisible) => (s) => {
1699
+ const selector$d = (onlyRenderVisible) => (s) => {
1695
1700
  return onlyRenderVisible
1696
1701
  ? getNodesInside(s.nodeLookup, { x: 0, y: 0, width: s.width, height: s.height }, s.transform, true).map((node) => node.id)
1697
1702
  : Array.from(s.nodeLookup.keys());
@@ -1704,13 +1709,13 @@ const selector$e = (onlyRenderVisible) => (s) => {
1704
1709
  * @returns array with visible node ids
1705
1710
  */
1706
1711
  function useVisibleNodeIds(onlyRenderVisible) {
1707
- const nodeIds = useStore(useCallback(selector$e(onlyRenderVisible), [onlyRenderVisible]), shallow);
1712
+ const nodeIds = useStore(useCallback(selector$d(onlyRenderVisible), [onlyRenderVisible]), shallow);
1708
1713
  return nodeIds;
1709
1714
  }
1710
1715
 
1711
- const selector$d = (s) => s.updateNodeInternals;
1716
+ const selector$c = (s) => s.updateNodeInternals;
1712
1717
  function useResizeObserver() {
1713
- const updateNodeInternals = useStore(selector$d);
1718
+ const updateNodeInternals = useStore(selector$c);
1714
1719
  const [resizeObserver] = useState(() => {
1715
1720
  if (typeof ResizeObserver === 'undefined') {
1716
1721
  return null;
@@ -1911,7 +1916,7 @@ function NodeWrapper({ id, onClick, onMouseEnter, onMouseMove, onMouseLeave, onC
1911
1916
  }, "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, positionAbsoluteX: clampedPosition.x, positionAbsoluteY: clampedPosition.y, selected: node.selected, selectable: isSelectable, draggable: isDraggable, deletable: node.deletable ?? true, isConnectable: isConnectable, sourcePosition: node.sourcePosition, targetPosition: node.targetPosition, dragging: dragging, dragHandle: node.dragHandle, zIndex: internals.z, parentId: node.parentId, ...nodeDimensions }) }) }));
1912
1917
  }
1913
1918
 
1914
- const selector$c = (s) => ({
1919
+ const selector$b = (s) => ({
1915
1920
  nodesDraggable: s.nodesDraggable,
1916
1921
  nodesConnectable: s.nodesConnectable,
1917
1922
  nodesFocusable: s.nodesFocusable,
@@ -1919,7 +1924,7 @@ const selector$c = (s) => ({
1919
1924
  onError: s.onError,
1920
1925
  });
1921
1926
  function NodeRendererComponent(props) {
1922
- const { nodesDraggable, nodesConnectable, nodesFocusable, elementsSelectable, onError } = useStore(selector$c, shallow);
1927
+ const { nodesDraggable, nodesConnectable, nodesFocusable, elementsSelectable, onError } = useStore(selector$b, shallow);
1923
1928
  const nodeIds = useVisibleNodeIds(props.onlyRenderVisibleElements);
1924
1929
  const resizeObserver = useResizeObserver();
1925
1930
  return (jsx("div", { className: "react-flow__nodes", style: containerStyle, children: nodeIds.map((nodeId) => {
@@ -2251,9 +2256,9 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, targetHandl
2251
2256
  const isTarget = isSourceHandle;
2252
2257
  setReconnecting(true);
2253
2258
  onReconnectStart?.(event, edge, handleType);
2254
- const _onReconnectEnd = (evt) => {
2259
+ const _onReconnectEnd = (evt, connectionState) => {
2255
2260
  setReconnecting(false);
2256
- onReconnectEnd?.(evt, edge, handleType);
2261
+ onReconnectEnd?.(evt, edge, handleType, connectionState);
2257
2262
  };
2258
2263
  const onConnectEdge = (connection) => onReconnect?.(edge, connection);
2259
2264
  XYHandle.onPointerDown(event.nativeEvent, {
@@ -2410,7 +2415,7 @@ function EdgeWrapper({ id, edgesFocusable, edgesReconnectable, elementsSelectabl
2410
2415
  ]), 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: [!reconnecting && (jsx(EdgeComponent, { id: id, source: edge.source, target: edge.target, type: edge.type, selected: edge.selected, animated: edge.animated, selectable: isSelectable, deletable: edge.deletable ?? true, 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 })), isReconnectable && (jsx(EdgeUpdateAnchors, { edge: edge, isReconnectable: isReconnectable, reconnectRadius: reconnectRadius, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, setUpdateHover: setUpdateHover, setReconnecting: setReconnecting, sourceHandleId: edge.sourceHandle, targetHandleId: edge.targetHandle }))] }) }));
2411
2416
  }
2412
2417
 
2413
- const selector$b = (s) => ({
2418
+ const selector$a = (s) => ({
2414
2419
  width: s.width,
2415
2420
  height: s.height,
2416
2421
  edgesFocusable: s.edgesFocusable,
@@ -2420,7 +2425,7 @@ const selector$b = (s) => ({
2420
2425
  onError: s.onError,
2421
2426
  });
2422
2427
  function EdgeRendererComponent({ defaultMarkerColor, onlyRenderVisibleElements, rfId, edgeTypes, noPanClassName, onReconnect, onEdgeContextMenu, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, onEdgeClick, reconnectRadius, onEdgeDoubleClick, onReconnectStart, onReconnectEnd, disableKeyboardA11y, }) {
2423
- const { edgesFocusable, edgesReconnectable, elementsSelectable, onError } = useStore(selector$b, shallow);
2428
+ const { edgesFocusable, edgesReconnectable, elementsSelectable, onError } = useStore(selector$a, shallow);
2424
2429
  const edgeIds = useVisibleEdgeIds(onlyRenderVisibleElements);
2425
2430
  return (jsxs("div", { className: "react-flow__edges", children: [jsx(MarkerDefinitions$1, { defaultColor: defaultMarkerColor, rfId: rfId }), edgeIds.map((id) => {
2426
2431
  return (jsx(EdgeWrapper, { id: id, edgesFocusable: edgesFocusable, edgesReconnectable: edgesReconnectable, elementsSelectable: elementsSelectable, noPanClassName: noPanClassName, onReconnect: onReconnect, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onClick: onEdgeClick, reconnectRadius: reconnectRadius, onDoubleClick: onEdgeDoubleClick, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, rfId: rfId, onError: onError, edgeTypes: edgeTypes, disableKeyboardA11y: disableKeyboardA11y }, id));
@@ -2429,9 +2434,9 @@ function EdgeRendererComponent({ defaultMarkerColor, onlyRenderVisibleElements,
2429
2434
  EdgeRendererComponent.displayName = 'EdgeRenderer';
2430
2435
  const EdgeRenderer = memo(EdgeRendererComponent);
2431
2436
 
2432
- const selector$a = (s) => `translate(${s.transform[0]}px,${s.transform[1]}px) scale(${s.transform[2]})`;
2437
+ const selector$9 = (s) => `translate(${s.transform[0]}px,${s.transform[1]}px) scale(${s.transform[2]})`;
2433
2438
  function Viewport({ children }) {
2434
- const transform = useStore(selector$a);
2439
+ const transform = useStore(selector$9);
2435
2440
  return (jsx("div", { className: "react-flow__viewport xyflow__viewport react-flow__container", style: { transform }, children: children }));
2436
2441
  }
2437
2442
 
@@ -2451,7 +2456,7 @@ function useOnInitHandler(onInit) {
2451
2456
  }, [onInit, rfInstance.viewportInitialized]);
2452
2457
  }
2453
2458
 
2454
- const selector$9 = (state) => state.panZoom?.syncViewport;
2459
+ const selector$8 = (state) => state.panZoom?.syncViewport;
2455
2460
  /**
2456
2461
  * Hook for syncing the viewport with the panzoom instance.
2457
2462
  *
@@ -2459,7 +2464,7 @@ const selector$9 = (state) => state.panZoom?.syncViewport;
2459
2464
  * @param viewport
2460
2465
  */
2461
2466
  function useViewportSync(viewport) {
2462
- const syncViewport = useStore(selector$9);
2467
+ const syncViewport = useStore(selector$8);
2463
2468
  const store = useStoreApi();
2464
2469
  useEffect(() => {
2465
2470
  if (viewport) {
@@ -2470,19 +2475,30 @@ function useViewportSync(viewport) {
2470
2475
  return null;
2471
2476
  }
2472
2477
 
2473
- const selector$8 = (s) => {
2478
+ function storeSelector$1(s) {
2474
2479
  return s.connection.inProgress
2475
2480
  ? { ...s.connection, to: pointToRendererPoint(s.connection.to, s.transform) }
2476
2481
  : { ...s.connection };
2477
- };
2482
+ }
2483
+ function getSelector(connectionSelector) {
2484
+ if (connectionSelector) {
2485
+ const combinedSelector = (s) => {
2486
+ const connection = storeSelector$1(s);
2487
+ return connectionSelector(connection);
2488
+ };
2489
+ return combinedSelector;
2490
+ }
2491
+ return storeSelector$1;
2492
+ }
2478
2493
  /**
2479
2494
  * Hook for accessing the connection state.
2480
2495
  *
2481
2496
  * @public
2482
2497
  * @returns ConnectionState
2483
2498
  */
2484
- function useConnection() {
2485
- return useStore(selector$8, shallow);
2499
+ function useConnection(connectionSelector) {
2500
+ const combinedSelector = getSelector(connectionSelector);
2501
+ return useStore(combinedSelector, shallow);
2486
2502
  }
2487
2503
 
2488
2504
  const selector$7 = (s) => ({
@@ -2700,27 +2716,33 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
2700
2716
  // Every node gets registerd at a ResizeObserver. Whenever a node
2701
2717
  // changes its dimensions, this function is called to measure the
2702
2718
  // new dimensions and update the nodes.
2703
- updateNodeInternals: (updates) => {
2719
+ updateNodeInternals: (updates, params = { triggerFitView: true }) => {
2704
2720
  const { triggerNodeChanges, nodeLookup, parentLookup, fitViewOnInit, fitViewDone, fitViewOnInitOptions, domNode, nodeOrigin, debug, fitViewSync, } = get();
2705
2721
  const { changes, updatedInternals } = updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOrigin);
2706
2722
  if (!updatedInternals) {
2707
2723
  return;
2708
2724
  }
2709
2725
  updateAbsolutePositions(nodeLookup, parentLookup, { nodeOrigin });
2710
- // we call fitView once initially after all dimensions are set
2711
- let nextFitViewDone = fitViewDone;
2712
- if (!fitViewDone && fitViewOnInit) {
2713
- nextFitViewDone = fitViewSync({
2714
- ...fitViewOnInitOptions,
2715
- nodes: fitViewOnInitOptions?.nodes,
2716
- });
2726
+ if (params.triggerFitView) {
2727
+ // we call fitView once initially after all dimensions are set
2728
+ let nextFitViewDone = fitViewDone;
2729
+ if (!fitViewDone && fitViewOnInit) {
2730
+ nextFitViewDone = fitViewSync({
2731
+ ...fitViewOnInitOptions,
2732
+ nodes: fitViewOnInitOptions?.nodes,
2733
+ });
2734
+ }
2735
+ // here we are cirmumventing the onNodesChange handler
2736
+ // in order to be able to display nodes even if the user
2737
+ // has not provided an onNodesChange handler.
2738
+ // Nodes are only rendered if they have a width and height
2739
+ // attribute which they get from this handler.
2740
+ set({ fitViewDone: nextFitViewDone });
2741
+ }
2742
+ else {
2743
+ // we always want to trigger useStore calls whenever updateNodeInternals is called
2744
+ set({});
2717
2745
  }
2718
- // here we are cirmumventing the onNodesChange handler
2719
- // in order to be able to display nodes even if the user
2720
- // has not provided an onNodesChange handler.
2721
- // Nodes are only rendered if they have a width and height
2722
- // attribute which they get from this handler.
2723
- set({ fitViewDone: nextFitViewDone });
2724
2746
  if (changes?.length > 0) {
2725
2747
  if (debug) {
2726
2748
  console.log('React Flow: trigger node changes', changes);
@@ -2980,7 +3002,7 @@ function useUpdateNodeInternals() {
2980
3002
  updates.set(updateId, { id: updateId, nodeElement, force: true });
2981
3003
  }
2982
3004
  });
2983
- requestAnimationFrame(() => updateNodeInternals(updates));
3005
+ requestAnimationFrame(() => updateNodeInternals(updates, { triggerFitView: false }));
2984
3006
  }, []);
2985
3007
  }
2986
3008
 
@@ -3201,7 +3223,7 @@ function BackgroundComponent({ id, variant = BackgroundVariant.Dots,
3201
3223
  // only used for dots and cross
3202
3224
  gap = 20,
3203
3225
  // only used for lines and cross
3204
- size, lineWidth = 1, offset = 2, color, bgColor, style, className, patternClassName, }) {
3226
+ size, lineWidth = 1, offset = 0, color, bgColor, style, className, patternClassName, }) {
3205
3227
  const ref = useRef(null);
3206
3228
  const { transform, patternId } = useStore(selector$3, shallow);
3207
3229
  const patternSize = size || defaultSize[variant];
@@ -3210,17 +3232,16 @@ size, lineWidth = 1, offset = 2, color, bgColor, style, className, patternClassN
3210
3232
  const gapXY = Array.isArray(gap) ? gap : [gap, gap];
3211
3233
  const scaledGap = [gapXY[0] * transform[2] || 1, gapXY[1] * transform[2] || 1];
3212
3234
  const scaledSize = patternSize * transform[2];
3235
+ const offsetXY = Array.isArray(offset) ? offset : [offset, offset];
3236
+ const scaledOffset = [offsetXY[0] * transform[2] || 1, offsetXY[1] * transform[2] || 1];
3213
3237
  const patternDimensions = isCross ? [scaledSize, scaledSize] : scaledGap;
3214
- const patternOffset = isDots
3215
- ? [scaledSize / offset, scaledSize / offset]
3216
- : [patternDimensions[0] / offset, patternDimensions[1] / offset];
3217
3238
  const _patternId = `${patternId}${id ? id : ''}`;
3218
3239
  return (jsxs("svg", { className: cc(['react-flow__background', className]), style: {
3219
3240
  ...style,
3220
3241
  ...containerStyle,
3221
3242
  '--xy-background-color-props': bgColor,
3222
3243
  '--xy-background-pattern-color-props': color,
3223
- }, 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})` })] }));
3244
+ }, 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(-${scaledOffset[0]},-${scaledOffset[1]})`, children: isDots ? (jsx(DotPattern, { radius: scaledSize / 2, 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})` })] }));
3224
3245
  }
3225
3246
  BackgroundComponent.displayName = 'Background';
3226
3247
  const Background = memo(BackgroundComponent);