@xyflow/react 12.0.3 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/base.css +2 -2
  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 +86 -66
  13. package/dist/esm/index.mjs +86 -66
  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 +3 -1
  18. package/dist/esm/types/store.d.ts.map +1 -1
  19. package/dist/style.css +2 -2
  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 +3 -1
  35. package/dist/umd/types/store.d.ts.map +1 -1
  36. package/package.json +4 -4
package/dist/base.css CHANGED
@@ -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;IAC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AC,kBAAkB,CAAC,CAAC;IACjE,cAAc,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAC7D,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,eAAe,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C,GAAG,YAAY,CAAC;AAEjB,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EAC9D,eAAe,EACf,eAAe,EACf,IAAI,EACJ,cAAc,EACd,cAAc,EACd,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,cAAc,GACf,EAAE,sBAAsB,CAAC,QAAQ,CAAC,2CAoGlC"}
@@ -1 +1 @@
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,EACV,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;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,2CAsMX"}
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"}
@@ -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,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CA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B,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);
@@ -124,7 +124,7 @@ const defaultNodeOrigin = [0, 0];
124
124
  const defaultViewport = { x: 0, y: 0, zoom: 1 };
125
125
 
126
126
  /*
127
- * This component helps us to update the store with the vlues coming from the user.
127
+ * This component helps us to update the store with the values coming from the user.
128
128
  * We distinguish between values we can update directly with `useDirectStoreUpdater` (like `snapGrid`)
129
129
  * and values that have a dedicated setter function in the store (like `setNodes`).
130
130
  */
@@ -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);
@@ -750,7 +750,7 @@ function useQueue(runQueue) {
750
750
  runQueue(queueItems);
751
751
  queue.reset();
752
752
  }
753
- // Beacuse we're using reactive state to trigger this effect, we need to flip
753
+ // Because we're using reactive state to trigger this effect, we need to flip
754
754
  // it back to false.
755
755
  setShouldFlush(false);
756
756
  }, [shouldFlush]);
@@ -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);
@@ -1215,7 +1215,6 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
1215
1215
  const onPointerDown = (event) => {
1216
1216
  const { resetSelectedElements, domNode, edgeLookup } = store.getState();
1217
1217
  containerBounds.current = domNode?.getBoundingClientRect();
1218
- event.target?.setPointerCapture?.(event.pointerId);
1219
1218
  if (!elementsSelectable ||
1220
1219
  !isSelecting ||
1221
1220
  event.button !== 0 ||
@@ -1223,6 +1222,7 @@ function Pane({ isSelecting, selectionKeyPressed, selectionMode = SelectionMode.
1223
1222
  !containerBounds.current) {
1224
1223
  return;
1225
1224
  }
1225
+ event.target?.setPointerCapture?.(event.pointerId);
1226
1226
  selectionStarted.current = true;
1227
1227
  selectionInProgress.current = false;
1228
1228
  edgeIdLookup.current = new Map();
@@ -1438,7 +1438,7 @@ const useNodeId = () => {
1438
1438
  return nodeId;
1439
1439
  };
1440
1440
 
1441
- const selector$h = (s) => ({
1441
+ const selector$g = (s) => ({
1442
1442
  connectOnClick: s.connectOnClick,
1443
1443
  noPanClassName: s.noPanClassName,
1444
1444
  rfId: s.rfId,
@@ -1463,7 +1463,7 @@ function HandleComponent({ type = 'source', position = Position.Top, isValidConn
1463
1463
  const isTarget = type === 'target';
1464
1464
  const store = useStoreApi();
1465
1465
  const nodeId = useNodeId();
1466
- const { connectOnClick, noPanClassName, rfId } = useStore(selector$h, shallow);
1466
+ const { connectOnClick, noPanClassName, rfId } = useStore(selector$g, shallow);
1467
1467
  const { connectingFrom, connectingTo, clickConnecting, isPossibleEndHandle, connectionInProcess, valid } = useStore(connectingSelector(nodeId, handleId, type), shallow);
1468
1468
  if (!nodeId) {
1469
1469
  store.getState().onError?.('010', errorMessages['error010']());
@@ -1520,7 +1520,7 @@ function HandleComponent({ type = 'source', position = Position.Top, isValidConn
1520
1520
  }
1521
1521
  };
1522
1522
  const onClick = (event) => {
1523
- const { onClickConnectStart, onClickConnectEnd, connectionClickStartHandle, connectionMode, isValidConnection: isValidConnectionStore, lib, rfId: flowId, } = store.getState();
1523
+ const { onClickConnectStart, onClickConnectEnd, connectionClickStartHandle, connectionMode, isValidConnection: isValidConnectionStore, lib, rfId: flowId, nodeLookup, connection: connectionState, } = store.getState();
1524
1524
  if (!nodeId || (!connectionClickStartHandle && !isConnectableStart)) {
1525
1525
  return;
1526
1526
  }
@@ -1545,11 +1545,15 @@ function HandleComponent({ type = 'source', position = Position.Top, isValidConn
1545
1545
  flowId,
1546
1546
  doc,
1547
1547
  lib,
1548
+ nodeLookup,
1548
1549
  });
1549
1550
  if (isValid && connection) {
1550
1551
  onConnectExtended(connection);
1551
1552
  }
1552
- onClickConnectEnd?.(event);
1553
+ const connectionClone = structuredClone(connectionState);
1554
+ delete connectionClone.inProgress;
1555
+ connectionClone.toPosition = connectionClone.toHandle ? connectionClone.toHandle.position : null;
1556
+ onClickConnectEnd?.(event, connectionClone);
1553
1557
  store.setState({ connectionClickStartHandle: null });
1554
1558
  };
1555
1559
  return (jsx("div", { "data-handleid": handleId, "data-nodeid": nodeId, "data-handlepos": position, "data-id": `${rfId}-${nodeId}-${handleId}-${type}`, className: cc([
@@ -1622,7 +1626,7 @@ function getNodeInlineStyleDimensions(node) {
1622
1626
  };
1623
1627
  }
1624
1628
 
1625
- const selector$g = (s) => {
1629
+ const selector$f = (s) => {
1626
1630
  const { width, height, x, y } = getInternalNodesBounds(s.nodeLookup, {
1627
1631
  filter: (node) => !!node.selected,
1628
1632
  });
@@ -1635,7 +1639,7 @@ const selector$g = (s) => {
1635
1639
  };
1636
1640
  function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboardA11y, }) {
1637
1641
  const store = useStoreApi();
1638
- const { width, height, transformString, userSelectionActive } = useStore(selector$g, shallow);
1642
+ const { width, height, transformString, userSelectionActive } = useStore(selector$f, shallow);
1639
1643
  const moveSelectedNodes = useMoveSelectedNodes();
1640
1644
  const nodeRef = useRef(null);
1641
1645
  useEffect(() => {
@@ -1674,11 +1678,11 @@ function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboar
1674
1678
  }
1675
1679
 
1676
1680
  const win = typeof window !== 'undefined' ? window : undefined;
1677
- const selector$f = (s) => {
1681
+ const selector$e = (s) => {
1678
1682
  return { nodesSelectionActive: s.nodesSelectionActive, userSelectionActive: s.userSelectionActive };
1679
1683
  };
1680
1684
  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);
1685
+ const { nodesSelectionActive, userSelectionActive } = useStore(selector$e);
1682
1686
  const selectionKeyPressed = useKeyPress(selectionKeyCode, { target: win });
1683
1687
  const panActivationKeyPressed = useKeyPress(panActivationKeyCode, { target: win });
1684
1688
  const panOnDrag = panActivationKeyPressed || _panOnDrag;
@@ -1691,7 +1695,7 @@ function FlowRendererComponent({ children, onPaneClick, onPaneMouseEnter, onPane
1691
1695
  FlowRendererComponent.displayName = 'FlowRenderer';
1692
1696
  const FlowRenderer = memo(FlowRendererComponent);
1693
1697
 
1694
- const selector$e = (onlyRenderVisible) => (s) => {
1698
+ const selector$d = (onlyRenderVisible) => (s) => {
1695
1699
  return onlyRenderVisible
1696
1700
  ? getNodesInside(s.nodeLookup, { x: 0, y: 0, width: s.width, height: s.height }, s.transform, true).map((node) => node.id)
1697
1701
  : Array.from(s.nodeLookup.keys());
@@ -1704,13 +1708,13 @@ const selector$e = (onlyRenderVisible) => (s) => {
1704
1708
  * @returns array with visible node ids
1705
1709
  */
1706
1710
  function useVisibleNodeIds(onlyRenderVisible) {
1707
- const nodeIds = useStore(useCallback(selector$e(onlyRenderVisible), [onlyRenderVisible]), shallow);
1711
+ const nodeIds = useStore(useCallback(selector$d(onlyRenderVisible), [onlyRenderVisible]), shallow);
1708
1712
  return nodeIds;
1709
1713
  }
1710
1714
 
1711
- const selector$d = (s) => s.updateNodeInternals;
1715
+ const selector$c = (s) => s.updateNodeInternals;
1712
1716
  function useResizeObserver() {
1713
- const updateNodeInternals = useStore(selector$d);
1717
+ const updateNodeInternals = useStore(selector$c);
1714
1718
  const [resizeObserver] = useState(() => {
1715
1719
  if (typeof ResizeObserver === 'undefined') {
1716
1720
  return null;
@@ -1911,7 +1915,7 @@ function NodeWrapper({ id, onClick, onMouseEnter, onMouseMove, onMouseLeave, onC
1911
1915
  }, "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
1916
  }
1913
1917
 
1914
- const selector$c = (s) => ({
1918
+ const selector$b = (s) => ({
1915
1919
  nodesDraggable: s.nodesDraggable,
1916
1920
  nodesConnectable: s.nodesConnectable,
1917
1921
  nodesFocusable: s.nodesFocusable,
@@ -1919,7 +1923,7 @@ const selector$c = (s) => ({
1919
1923
  onError: s.onError,
1920
1924
  });
1921
1925
  function NodeRendererComponent(props) {
1922
- const { nodesDraggable, nodesConnectable, nodesFocusable, elementsSelectable, onError } = useStore(selector$c, shallow);
1926
+ const { nodesDraggable, nodesConnectable, nodesFocusable, elementsSelectable, onError } = useStore(selector$b, shallow);
1923
1927
  const nodeIds = useVisibleNodeIds(props.onlyRenderVisibleElements);
1924
1928
  const resizeObserver = useResizeObserver();
1925
1929
  return (jsx("div", { className: "react-flow__nodes", style: containerStyle, children: nodeIds.map((nodeId) => {
@@ -2251,9 +2255,9 @@ function EdgeUpdateAnchors({ isReconnectable, reconnectRadius, edge, targetHandl
2251
2255
  const isTarget = isSourceHandle;
2252
2256
  setReconnecting(true);
2253
2257
  onReconnectStart?.(event, edge, handleType);
2254
- const _onReconnectEnd = (evt) => {
2258
+ const _onReconnectEnd = (evt, connectionState) => {
2255
2259
  setReconnecting(false);
2256
- onReconnectEnd?.(evt, edge, handleType);
2260
+ onReconnectEnd?.(evt, edge, handleType, connectionState);
2257
2261
  };
2258
2262
  const onConnectEdge = (connection) => onReconnect?.(edge, connection);
2259
2263
  XYHandle.onPointerDown(event.nativeEvent, {
@@ -2410,7 +2414,7 @@ function EdgeWrapper({ id, edgesFocusable, edgesReconnectable, elementsSelectabl
2410
2414
  ]), 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
2415
  }
2412
2416
 
2413
- const selector$b = (s) => ({
2417
+ const selector$a = (s) => ({
2414
2418
  width: s.width,
2415
2419
  height: s.height,
2416
2420
  edgesFocusable: s.edgesFocusable,
@@ -2420,7 +2424,7 @@ const selector$b = (s) => ({
2420
2424
  onError: s.onError,
2421
2425
  });
2422
2426
  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);
2427
+ const { edgesFocusable, edgesReconnectable, elementsSelectable, onError } = useStore(selector$a, shallow);
2424
2428
  const edgeIds = useVisibleEdgeIds(onlyRenderVisibleElements);
2425
2429
  return (jsxs("div", { className: "react-flow__edges", children: [jsx(MarkerDefinitions$1, { defaultColor: defaultMarkerColor, rfId: rfId }), edgeIds.map((id) => {
2426
2430
  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 +2433,9 @@ function EdgeRendererComponent({ defaultMarkerColor, onlyRenderVisibleElements,
2429
2433
  EdgeRendererComponent.displayName = 'EdgeRenderer';
2430
2434
  const EdgeRenderer = memo(EdgeRendererComponent);
2431
2435
 
2432
- const selector$a = (s) => `translate(${s.transform[0]}px,${s.transform[1]}px) scale(${s.transform[2]})`;
2436
+ const selector$9 = (s) => `translate(${s.transform[0]}px,${s.transform[1]}px) scale(${s.transform[2]})`;
2433
2437
  function Viewport({ children }) {
2434
- const transform = useStore(selector$a);
2438
+ const transform = useStore(selector$9);
2435
2439
  return (jsx("div", { className: "react-flow__viewport xyflow__viewport react-flow__container", style: { transform }, children: children }));
2436
2440
  }
2437
2441
 
@@ -2451,7 +2455,7 @@ function useOnInitHandler(onInit) {
2451
2455
  }, [onInit, rfInstance.viewportInitialized]);
2452
2456
  }
2453
2457
 
2454
- const selector$9 = (state) => state.panZoom?.syncViewport;
2458
+ const selector$8 = (state) => state.panZoom?.syncViewport;
2455
2459
  /**
2456
2460
  * Hook for syncing the viewport with the panzoom instance.
2457
2461
  *
@@ -2459,7 +2463,7 @@ const selector$9 = (state) => state.panZoom?.syncViewport;
2459
2463
  * @param viewport
2460
2464
  */
2461
2465
  function useViewportSync(viewport) {
2462
- const syncViewport = useStore(selector$9);
2466
+ const syncViewport = useStore(selector$8);
2463
2467
  const store = useStoreApi();
2464
2468
  useEffect(() => {
2465
2469
  if (viewport) {
@@ -2470,19 +2474,30 @@ function useViewportSync(viewport) {
2470
2474
  return null;
2471
2475
  }
2472
2476
 
2473
- const selector$8 = (s) => {
2477
+ function storeSelector$1(s) {
2474
2478
  return s.connection.inProgress
2475
2479
  ? { ...s.connection, to: pointToRendererPoint(s.connection.to, s.transform) }
2476
2480
  : { ...s.connection };
2477
- };
2481
+ }
2482
+ function getSelector(connectionSelector) {
2483
+ if (connectionSelector) {
2484
+ const combinedSelector = (s) => {
2485
+ const connection = storeSelector$1(s);
2486
+ return connectionSelector(connection);
2487
+ };
2488
+ return combinedSelector;
2489
+ }
2490
+ return storeSelector$1;
2491
+ }
2478
2492
  /**
2479
2493
  * Hook for accessing the connection state.
2480
2494
  *
2481
2495
  * @public
2482
2496
  * @returns ConnectionState
2483
2497
  */
2484
- function useConnection() {
2485
- return useStore(selector$8, shallow);
2498
+ function useConnection(connectionSelector) {
2499
+ const combinedSelector = getSelector(connectionSelector);
2500
+ return useStore(combinedSelector, shallow);
2486
2501
  }
2487
2502
 
2488
2503
  const selector$7 = (s) => ({
@@ -2700,27 +2715,33 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
2700
2715
  // Every node gets registerd at a ResizeObserver. Whenever a node
2701
2716
  // changes its dimensions, this function is called to measure the
2702
2717
  // new dimensions and update the nodes.
2703
- updateNodeInternals: (updates) => {
2718
+ updateNodeInternals: (updates, params = { triggerFitView: true }) => {
2704
2719
  const { triggerNodeChanges, nodeLookup, parentLookup, fitViewOnInit, fitViewDone, fitViewOnInitOptions, domNode, nodeOrigin, debug, fitViewSync, } = get();
2705
2720
  const { changes, updatedInternals } = updateNodeInternals(updates, nodeLookup, parentLookup, domNode, nodeOrigin);
2706
2721
  if (!updatedInternals) {
2707
2722
  return;
2708
2723
  }
2709
2724
  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
- });
2725
+ if (params.triggerFitView) {
2726
+ // we call fitView once initially after all dimensions are set
2727
+ let nextFitViewDone = fitViewDone;
2728
+ if (!fitViewDone && fitViewOnInit) {
2729
+ nextFitViewDone = fitViewSync({
2730
+ ...fitViewOnInitOptions,
2731
+ nodes: fitViewOnInitOptions?.nodes,
2732
+ });
2733
+ }
2734
+ // here we are cirmumventing the onNodesChange handler
2735
+ // in order to be able to display nodes even if the user
2736
+ // has not provided an onNodesChange handler.
2737
+ // Nodes are only rendered if they have a width and height
2738
+ // attribute which they get from this handler.
2739
+ set({ fitViewDone: nextFitViewDone });
2740
+ }
2741
+ else {
2742
+ // we always want to trigger useStore calls whenever updateNodeInternals is called
2743
+ set({});
2717
2744
  }
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
2745
  if (changes?.length > 0) {
2725
2746
  if (debug) {
2726
2747
  console.log('React Flow: trigger node changes', changes);
@@ -2845,7 +2866,7 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
2845
2866
  setNodeExtent: (nodeExtent) => {
2846
2867
  const { nodeLookup } = get();
2847
2868
  for (const [, node] of nodeLookup) {
2848
- const positionAbsolute = clampPosition(node.position, nodeExtent);
2869
+ const positionAbsolute = clampPosition(node.internals.positionAbsolute, nodeExtent);
2849
2870
  nodeLookup.set(node.id, {
2850
2871
  ...node,
2851
2872
  internals: {
@@ -2980,7 +3001,7 @@ function useUpdateNodeInternals() {
2980
3001
  updates.set(updateId, { id: updateId, nodeElement, force: true });
2981
3002
  }
2982
3003
  });
2983
- requestAnimationFrame(() => updateNodeInternals(updates));
3004
+ requestAnimationFrame(() => updateNodeInternals(updates, { triggerFitView: false }));
2984
3005
  }, []);
2985
3006
  }
2986
3007
 
@@ -3201,7 +3222,7 @@ function BackgroundComponent({ id, variant = BackgroundVariant.Dots,
3201
3222
  // only used for dots and cross
3202
3223
  gap = 20,
3203
3224
  // only used for lines and cross
3204
- size, lineWidth = 1, offset = 2, color, bgColor, style, className, patternClassName, }) {
3225
+ size, lineWidth = 1, offset = 0, color, bgColor, style, className, patternClassName, }) {
3205
3226
  const ref = useRef(null);
3206
3227
  const { transform, patternId } = useStore(selector$3, shallow);
3207
3228
  const patternSize = size || defaultSize[variant];
@@ -3210,17 +3231,16 @@ size, lineWidth = 1, offset = 2, color, bgColor, style, className, patternClassN
3210
3231
  const gapXY = Array.isArray(gap) ? gap : [gap, gap];
3211
3232
  const scaledGap = [gapXY[0] * transform[2] || 1, gapXY[1] * transform[2] || 1];
3212
3233
  const scaledSize = patternSize * transform[2];
3234
+ const offsetXY = Array.isArray(offset) ? offset : [offset, offset];
3235
+ const scaledOffset = [offsetXY[0] * transform[2] || 1, offsetXY[1] * transform[2] || 1];
3213
3236
  const patternDimensions = isCross ? [scaledSize, scaledSize] : scaledGap;
3214
- const patternOffset = isDots
3215
- ? [scaledSize / offset, scaledSize / offset]
3216
- : [patternDimensions[0] / offset, patternDimensions[1] / offset];
3217
3237
  const _patternId = `${patternId}${id ? id : ''}`;
3218
3238
  return (jsxs("svg", { className: cc(['react-flow__background', className]), style: {
3219
3239
  ...style,
3220
3240
  ...containerStyle,
3221
3241
  '--xy-background-color-props': bgColor,
3222
3242
  '--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})` })] }));
3243
+ }, 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
3244
  }
3225
3245
  BackgroundComponent.displayName = 'Background';
3226
3246
  const Background = memo(BackgroundComponent);