@xyflow/react 12.0.0-next.7 → 12.0.0-next.8

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 (66) hide show
  1. package/dist/base.css +2 -16
  2. package/dist/esm/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
  3. package/dist/esm/components/EdgeWrapper/index.d.ts.map +1 -1
  4. package/dist/esm/components/Handle/index.d.ts +6 -2
  5. package/dist/esm/components/Handle/index.d.ts.map +1 -1
  6. package/dist/esm/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -1
  7. package/dist/esm/container/FlowRenderer/index.d.ts.map +1 -1
  8. package/dist/esm/container/ReactFlow/index.d.ts +4 -117
  9. package/dist/esm/container/ReactFlow/index.d.ts.map +1 -1
  10. package/dist/esm/hooks/useConnection.d.ts +13 -7
  11. package/dist/esm/hooks/useConnection.d.ts.map +1 -1
  12. package/dist/esm/hooks/useDrag.d.ts +1 -1
  13. package/dist/esm/hooks/useDrag.d.ts.map +1 -1
  14. package/dist/esm/hooks/useHandleConnections.d.ts +1 -1
  15. package/dist/esm/hooks/useNodesInitialized.d.ts.map +1 -1
  16. package/dist/esm/hooks/useOnSelectionChange.d.ts +1 -1
  17. package/dist/esm/hooks/useUpdateNodePositions.d.ts.map +1 -1
  18. package/dist/esm/index.d.ts +1 -1
  19. package/dist/esm/index.d.ts.map +1 -1
  20. package/dist/esm/index.js +59 -42
  21. package/dist/esm/index.mjs +59 -42
  22. package/dist/esm/store/initialState.d.ts.map +1 -1
  23. package/dist/esm/types/component-props.d.ts +7 -7
  24. package/dist/esm/types/component-props.d.ts.map +1 -1
  25. package/dist/esm/types/general.d.ts +79 -4
  26. package/dist/esm/types/general.d.ts.map +1 -1
  27. package/dist/esm/types/instance.d.ts +93 -0
  28. package/dist/esm/types/instance.d.ts.map +1 -1
  29. package/dist/esm/types/nodes.d.ts +3 -3
  30. package/dist/esm/types/nodes.d.ts.map +1 -1
  31. package/dist/esm/types/store.d.ts +2 -2
  32. package/dist/esm/types/store.d.ts.map +1 -1
  33. package/dist/esm/utils/changes.d.ts.map +1 -1
  34. package/dist/style.css +10 -12
  35. package/dist/umd/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
  36. package/dist/umd/components/EdgeWrapper/index.d.ts.map +1 -1
  37. package/dist/umd/components/Handle/index.d.ts +6 -2
  38. package/dist/umd/components/Handle/index.d.ts.map +1 -1
  39. package/dist/umd/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -1
  40. package/dist/umd/container/FlowRenderer/index.d.ts.map +1 -1
  41. package/dist/umd/container/ReactFlow/index.d.ts +4 -117
  42. package/dist/umd/container/ReactFlow/index.d.ts.map +1 -1
  43. package/dist/umd/hooks/useConnection.d.ts +13 -7
  44. package/dist/umd/hooks/useConnection.d.ts.map +1 -1
  45. package/dist/umd/hooks/useDrag.d.ts +1 -1
  46. package/dist/umd/hooks/useDrag.d.ts.map +1 -1
  47. package/dist/umd/hooks/useHandleConnections.d.ts +1 -1
  48. package/dist/umd/hooks/useNodesInitialized.d.ts.map +1 -1
  49. package/dist/umd/hooks/useOnSelectionChange.d.ts +1 -1
  50. package/dist/umd/hooks/useUpdateNodePositions.d.ts.map +1 -1
  51. package/dist/umd/index.d.ts +1 -1
  52. package/dist/umd/index.d.ts.map +1 -1
  53. package/dist/umd/index.js +2 -2
  54. package/dist/umd/store/initialState.d.ts.map +1 -1
  55. package/dist/umd/types/component-props.d.ts +7 -7
  56. package/dist/umd/types/component-props.d.ts.map +1 -1
  57. package/dist/umd/types/general.d.ts +79 -4
  58. package/dist/umd/types/general.d.ts.map +1 -1
  59. package/dist/umd/types/instance.d.ts +93 -0
  60. package/dist/umd/types/instance.d.ts.map +1 -1
  61. package/dist/umd/types/nodes.d.ts +3 -3
  62. package/dist/umd/types/nodes.d.ts.map +1 -1
  63. package/dist/umd/types/store.d.ts +2 -2
  64. package/dist/umd/types/store.d.ts.map +1 -1
  65. package/dist/umd/utils/changes.d.ts.map +1 -1
  66. package/package.json +4 -4
package/dist/base.css CHANGED
@@ -127,8 +127,8 @@
127
127
  outline: none;
128
128
  }
129
129
  .react-flow__edge.selected .react-flow__edge-path,
130
- .react-flow__edge:focus .react-flow__edge-path,
131
- .react-flow__edge:focus-visible .react-flow__edge-path {
130
+ .react-flow__edge.selectable:focus .react-flow__edge-path,
131
+ .react-flow__edge.selectable:focus-visible .react-flow__edge-path {
132
132
  stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));
133
133
  }
134
134
  .react-flow__edge-textwrapper {
@@ -356,17 +356,3 @@ svg.react-flow__connectionline {
356
356
  background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));
357
357
  border: var(--xy-selection-border, var(--xy-selection-border-default));
358
358
  }
359
- .react-flow {
360
- --edge-label-background-color-default: #ffffff;
361
- --edge-label-color-default: inherit;
362
- }
363
- .react-flow.dark {
364
- --edge-label-background-color-default: #141414;
365
- --edge-label-color-default: #f8f8f8;
366
- }
367
- .react-flow__edge-textbg {
368
- fill: var(--edge-label-background-color, var(--edge-label-background-color-default));
369
- }
370
- .react-flow__edge-text {
371
- fill: var(--edge-label-color, var(--edge-label-color-default));
372
- }
@@ -1 +1 @@
1
- {"version":3,"file":"MiniMap.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/MiniMap/MiniMap.tsx"],"names":[],"mappings":";AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA2B5C,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,SAAS,EACT,eAAe,EACf,SAAS,EACT,aAAkB,EAClB,gBAAoB,EACpB,eAAe,EAGf,aAAa,EACb,SAAS,EACT,eAAwB,EACxB,eAAmB,EACnB,QAAyB,EACzB,OAAO,EACP,WAAW,EACX,QAAgB,EAChB,QAAgB,EAChB,SAAiC,EACjC,UAAU,EACV,QAAa,EACb,WAAe,GAChB,EAAE,YAAY,2CA6Gd;kBApIQ,gBAAgB;;;AAwIzB,eAAO,MAAM,OAAO,8DAAyB,CAAC"}
1
+ {"version":3,"file":"MiniMap.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/MiniMap/MiniMap.tsx"],"names":[],"mappings":";AAYA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AA4B5C,iBAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,SAAS,EACT,eAAe,EACf,SAAS,EACT,aAAkB,EAClB,gBAAoB,EACpB,eAAe,EAGf,aAAa,EACb,SAAS,EACT,eAAwB,EACxB,eAAmB,EACnB,QAAyB,EACzB,OAAO,EACP,WAAW,EACX,QAAgB,EAChB,QAAgB,EAChB,SAAiC,EACjC,UAAU,EACV,QAAa,EACb,WAAe,GAChB,EAAE,YAAY,2CA6Gd;kBApIQ,gBAAgB;;;AAwIzB,eAAO,MAAM,OAAO,8DAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/components/EdgeWrapper/index.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,IAAI,EACJ,SAAS,EACT,cAAc,EACd,OAAO,GACR,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CA+NvC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/components/EdgeWrapper/index.tsx"],"names":[],"mappings":";AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,wBAAgB,WAAW,CAAC,EAC1B,EAAE,EACF,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,IAAI,EACJ,SAAS,EACT,cAAc,EACd,OAAO,GACR,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,GAAG,IAAI,CAgOvC"}
@@ -1,5 +1,9 @@
1
1
  import { HTMLAttributes } from 'react';
2
2
  import { type HandleProps } from '@xyflow/system';
3
- export type HandleComponentProps = HandleProps & Omit<HTMLAttributes<HTMLDivElement>, 'id'>;
4
- export declare const Handle: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<HandleProps & Omit<HTMLAttributes<HTMLDivElement>, "id"> & import("react").RefAttributes<HTMLDivElement>>>;
3
+ export interface HandleComponentProps extends HandleProps, Omit<HTMLAttributes<HTMLDivElement>, 'id'> {
4
+ }
5
+ /**
6
+ * The Handle component is the part of a node that can be used to connect nodes.
7
+ */
8
+ export declare const Handle: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<HandleComponentProps & import("react").RefAttributes<HTMLDivElement>>>;
5
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/components/Handle/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAQ,cAAc,EAA4E,MAAM,OAAO,CAAC;AAGvH,OAAO,EAOL,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC;AAuM5F,eAAO,MAAM,MAAM,0LAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/components/Handle/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAQ,cAAc,EAA4E,MAAM,OAAO,CAAC;AAGvH,OAAO,EAOL,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,WAAW,oBAAqB,SAAQ,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC;CAAG;AAuMxG;;GAEG;AACH,eAAO,MAAM,MAAM,sJAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerDefinitions.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/container/EdgeRenderer/MarkerDefinitions.tsx"],"names":[],"mappings":";AAOA,KAAK,sBAAsB,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;;;;;AAgFF,wBAAuC"}
1
+ {"version":3,"file":"MarkerDefinitions.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/container/EdgeRenderer/MarkerDefinitions.tsx"],"names":[],"mappings":";AAMA,KAAK,sBAAsB,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;;;;;AAgFF,wBAAuC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/container/FlowRenderer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM9C,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,cAAc,EACZ,YAAY,GACZ,WAAW,GACX,WAAW,GACX,UAAU,GACV,oBAAoB,GACpB,8BAA8B,GAC9B,gBAAgB,GAChB,2BAA2B,GAC3B,mBAAmB,GACnB,oBAAoB,GACpB,MAAM,GACN,YAAY,CACf,GAAG;IACF,oBAAoB,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAqGF,eAAO,MAAM,YAAY;knBA7DtB,iBAAiB;;EA6DmC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/container/FlowRenderer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAM9C,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAClC,cAAc,EACZ,YAAY,GACZ,WAAW,GACX,WAAW,GACX,UAAU,GACV,oBAAoB,GACpB,8BAA8B,GAC9B,gBAAgB,GAChB,2BAA2B,GAC3B,mBAAmB,GACnB,oBAAoB,GACpB,MAAM,GACN,YAAY,CACf,GAAG;IACF,oBAAoB,EAAE,OAAO,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAuGF,eAAO,MAAM,YAAY;knBA7DtB,iBAAiB;;EA6DmC,CAAC"}
@@ -1,120 +1,7 @@
1
- import { type CSSProperties } from 'react';
2
- import { ConnectionLineType, PanOnScrollMode, SelectionMode, type NodeOrigin, type Viewport } from '@xyflow/system';
1
+ /// <reference types="react" />
2
+ import { type NodeOrigin } from '@xyflow/system';
3
+ import type { ReactFlowProps } from '../../types';
3
4
  export declare const initNodeOrigin: NodeOrigin;
4
- declare const ReactFlow: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement>, "onError"> & {
5
- nodes?: import("../../types").Node<any, string | undefined>[] | undefined;
6
- edges?: import("../../types").Edge<any>[] | undefined;
7
- defaultNodes?: import("../../types").Node<any, string | undefined>[] | undefined;
8
- defaultEdges?: import("../../types").Edge<any>[] | undefined;
9
- defaultEdgeOptions?: import("../../types").DefaultEdgeOptions | undefined;
10
- onNodeClick?: import("../../types").NodeMouseHandler | undefined;
11
- onNodeDoubleClick?: import("../../types").NodeMouseHandler | undefined;
12
- onNodeMouseEnter?: import("../../types").NodeMouseHandler | undefined;
13
- onNodeMouseMove?: import("../../types").NodeMouseHandler | undefined;
14
- onNodeMouseLeave?: import("../../types").NodeMouseHandler | undefined;
15
- onNodeContextMenu?: import("../../types").NodeMouseHandler | undefined;
16
- onNodeDragStart?: import("../../types").NodeDragHandler | undefined;
17
- onNodeDrag?: import("../../types").NodeDragHandler | undefined;
18
- onNodeDragStop?: import("../../types").NodeDragHandler | undefined;
19
- onEdgeClick?: ((event: import("react").MouseEvent<Element, MouseEvent>, edge: import("../../types").Edge<any>) => void) | undefined;
20
- onEdgeContextMenu?: import("../../types").EdgeMouseHandler | undefined;
21
- onEdgeMouseEnter?: import("../../types").EdgeMouseHandler | undefined;
22
- onEdgeMouseMove?: import("../../types").EdgeMouseHandler | undefined;
23
- onEdgeMouseLeave?: import("../../types").EdgeMouseHandler | undefined;
24
- onEdgeDoubleClick?: import("../../types").EdgeMouseHandler | undefined;
25
- onEdgeUpdateStart?: ((event: import("react").MouseEvent<Element, MouseEvent>, edge: import("../../types").Edge<any>, handleType: import("@xyflow/system").HandleType) => void) | undefined;
26
- onEdgeUpdateEnd?: ((event: MouseEvent | TouchEvent, edge: import("../../types").Edge<any>, handleType: import("@xyflow/system").HandleType) => void) | undefined;
27
- onEdgeUpdate?: import("../../types").OnEdgeUpdateFunc<any> | undefined;
28
- onNodesChange?: import("../../types").OnNodesChange<import("../../types").Node<any, string | undefined>> | undefined;
29
- onEdgesChange?: import("../../types").OnEdgesChange<import("../../types").Edge<any>> | undefined;
30
- onNodesDelete?: import("../../types").OnNodesDelete | undefined;
31
- onEdgesDelete?: import("../../types").OnEdgesDelete | undefined;
32
- onDelete?: import("../../types").OnDelete | undefined;
33
- onSelectionDragStart?: import("../../types").SelectionDragHandler | undefined;
34
- onSelectionDrag?: import("../../types").SelectionDragHandler | undefined;
35
- onSelectionDragStop?: import("../../types").SelectionDragHandler | undefined;
36
- onSelectionStart?: ((event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
37
- onSelectionEnd?: ((event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
38
- onSelectionContextMenu?: ((event: import("react").MouseEvent<Element, MouseEvent>, nodes: import("../../types").Node<any, string | undefined>[]) => void) | undefined;
39
- onConnect?: import("@xyflow/system").OnConnect | undefined;
40
- onConnectStart?: import("@xyflow/system").OnConnectStart | undefined;
41
- onConnectEnd?: import("@xyflow/system").OnConnectEnd | undefined;
42
- onClickConnectStart?: import("@xyflow/system").OnConnectStart | undefined;
43
- onClickConnectEnd?: import("@xyflow/system").OnConnectEnd | undefined;
44
- onInit?: import("../../types").OnInit<import("../../types").Node<any, string | undefined>, import("../../types").Edge<any>> | undefined;
45
- onMove?: import("@xyflow/system").OnMove | undefined;
46
- onMoveStart?: import("@xyflow/system").OnMove | undefined;
47
- onMoveEnd?: import("@xyflow/system").OnMove | undefined;
48
- onSelectionChange?: import("../../types").OnSelectionChangeFunc | undefined;
49
- onPaneScroll?: ((event?: import("react").WheelEvent<Element> | undefined) => void) | undefined;
50
- onPaneClick?: ((event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
51
- onPaneContextMenu?: ((event: MouseEvent | import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
52
- onPaneMouseEnter?: ((event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
53
- onPaneMouseMove?: ((event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
54
- onPaneMouseLeave?: ((event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
55
- onBeforeDelete?: import("@xyflow/system").OnBeforeDelete | undefined;
56
- nodeTypes?: import("../../types").NodeTypes | undefined;
57
- edgeTypes?: import("../../types").EdgeTypes | undefined;
58
- connectionLineType?: ConnectionLineType | undefined;
59
- connectionLineStyle?: CSSProperties | undefined;
60
- connectionLineComponent?: import("../../types").ConnectionLineComponent | undefined;
61
- connectionLineContainerStyle?: CSSProperties | undefined;
62
- connectionMode?: import("@xyflow/system").ConnectionMode | undefined;
63
- deleteKeyCode?: import("@xyflow/system").KeyCode | null | undefined;
64
- selectionKeyCode?: import("@xyflow/system").KeyCode | null | undefined;
65
- selectionOnDrag?: boolean | undefined;
66
- selectionMode?: SelectionMode | undefined;
67
- panActivationKeyCode?: import("@xyflow/system").KeyCode | null | undefined;
68
- multiSelectionKeyCode?: import("@xyflow/system").KeyCode | null | undefined;
69
- zoomActivationKeyCode?: import("@xyflow/system").KeyCode | null | undefined;
70
- snapToGrid?: boolean | undefined;
71
- snapGrid?: import("@xyflow/system").SnapGrid | undefined;
72
- onlyRenderVisibleElements?: boolean | undefined;
73
- nodesDraggable?: boolean | undefined;
74
- nodesConnectable?: boolean | undefined;
75
- nodesFocusable?: boolean | undefined;
76
- nodeOrigin?: NodeOrigin | undefined;
77
- edgesFocusable?: boolean | undefined;
78
- edgesUpdatable?: boolean | undefined;
79
- elementsSelectable?: boolean | undefined;
80
- selectNodesOnDrag?: boolean | undefined;
81
- panOnDrag?: boolean | number[] | undefined;
82
- minZoom?: number | undefined;
83
- maxZoom?: number | undefined;
84
- viewport?: Viewport | undefined;
85
- defaultViewport?: Viewport | undefined;
86
- onViewportChange?: ((viewport: Viewport) => void) | undefined;
87
- translateExtent?: import("@xyflow/system").CoordinateExtent | undefined;
88
- preventScrolling?: boolean | undefined;
89
- nodeExtent?: import("@xyflow/system").CoordinateExtent | undefined;
90
- defaultMarkerColor?: string | undefined;
91
- zoomOnScroll?: boolean | undefined;
92
- zoomOnPinch?: boolean | undefined;
93
- panOnScroll?: boolean | undefined;
94
- panOnScrollSpeed?: number | undefined;
95
- panOnScrollMode?: PanOnScrollMode | undefined;
96
- zoomOnDoubleClick?: boolean | undefined;
97
- edgeUpdaterRadius?: number | undefined;
98
- noDragClassName?: string | undefined;
99
- noWheelClassName?: string | undefined;
100
- noPanClassName?: string | undefined;
101
- fitView?: boolean | undefined;
102
- fitViewOptions?: import("../../types").FitViewOptions | undefined;
103
- connectOnClick?: boolean | undefined;
104
- attributionPosition?: import("@xyflow/system").PanelPosition | undefined;
105
- proOptions?: import("@xyflow/system").ProOptions | undefined;
106
- elevateNodesOnSelect?: boolean | undefined;
107
- elevateEdgesOnSelect?: boolean | undefined;
108
- disableKeyboardA11y?: boolean | undefined;
109
- autoPanOnNodeDrag?: boolean | undefined;
110
- autoPanOnConnect?: boolean | undefined;
111
- connectionRadius?: number | undefined;
112
- onError?: import("@xyflow/system").OnError | undefined;
113
- isValidConnection?: import("@xyflow/system").IsValidConnection | undefined;
114
- nodeDragThreshold?: number | undefined;
115
- width?: number | undefined;
116
- height?: number | undefined;
117
- colorMode?: import("@xyflow/system").ColorMode | undefined;
118
- } & import("react").RefAttributes<HTMLDivElement>>;
5
+ declare const ReactFlow: import("react").ForwardRefExoticComponent<ReactFlowProps & import("react").RefAttributes<HTMLDivElement>>;
119
6
  export default ReactFlow;
120
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/container/ReactFlow/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,aAAa,EAGb,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,gBAAgB,CAAC;AAWxB,eAAO,MAAM,cAAc,EAAE,UAAmB,CAAC;AAWjD,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kDAwQd,CAAC;AAIF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/container/ReactFlow/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAML,KAAK,UAAU,EAEhB,MAAM,gBAAgB,CAAC;AASxB,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,aAAa,CAAC;AAEpE,eAAO,MAAM,cAAc,EAAE,UAAmB,CAAC;AAWjD,QAAA,MAAM,SAAS,2GAwQd,CAAC;AAIF,eAAe,SAAS,CAAC"}
@@ -1,14 +1,20 @@
1
1
  import type { ReactFlowStore } from '../types/store';
2
- /**
3
- * Hook for accessing the ongoing connection.
4
- *
5
- * @public
6
- * @returns ongoing connection: startHandle, endHandle, status, position
7
- */
8
- export declare function useConnection(): {
2
+ type UseConnectionResult = {
3
+ /** The start handle where the user interaction started or null */
9
4
  startHandle: ReactFlowStore['connectionStartHandle'];
5
+ /** The target handle that's inside the connection radius or null */
10
6
  endHandle: ReactFlowStore['connectionEndHandle'];
7
+ /** The current connection status 'valid', 'invalid' or null*/
11
8
  status: ReactFlowStore['connectionStatus'];
9
+ /** The current connection position or null */
12
10
  position: ReactFlowStore['connectionPosition'] | null;
13
11
  };
12
+ /**
13
+ * Hook for accessing the ongoing connection.
14
+ *
15
+ * @public
16
+ * @returns ongoing connection
17
+ */
18
+ export declare function useConnection(): UseConnectionResult;
19
+ export {};
14
20
  //# sourceMappingURL=useConnection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/hooks/useConnection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AASrD;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI;IAC/B,WAAW,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAAC;IACrD,SAAS,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;IACjD,MAAM,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAC3C,QAAQ,EAAE,cAAc,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC;CACvD,CAIA"}
1
+ {"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/hooks/useConnection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AASrD,KAAK,mBAAmB,GAAG;IACzB,kEAAkE;IAClE,WAAW,EAAE,cAAc,CAAC,uBAAuB,CAAC,CAAC;IACrD,qEAAqE;IACrE,SAAS,EAAE,cAAc,CAAC,qBAAqB,CAAC,CAAC;IACjD,8DAA8D;IAC9D,MAAM,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;IAC3C,8CAA8C;IAC9C,QAAQ,EAAE,cAAc,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC;CACvD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,mBAAmB,CAInD"}
@@ -1,6 +1,6 @@
1
1
  import { type RefObject } from 'react';
2
2
  type UseDragParams = {
3
- nodeRef: RefObject<Element>;
3
+ nodeRef: RefObject<HTMLDivElement>;
4
4
  disabled?: boolean;
5
5
  noDragClassName?: string;
6
6
  handleSelector?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useDrag.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/hooks/useDrag.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMpE,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,QAAgB,EAChB,eAAe,EACf,cAAc,EACd,MAAM,EACN,YAAY,GACb,EAAE,aAAa,WA6Cf"}
1
+ {"version":3,"file":"useDrag.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/hooks/useDrag.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMpE,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EACtB,OAAO,EACP,QAAgB,EAChB,eAAe,EACf,cAAc,EACd,MAAM,EACN,YAAY,GACb,EAAE,aAAa,WA6Cf"}
@@ -7,7 +7,7 @@ type useHandleConnectionsParams = {
7
7
  onDisconnect?: (connections: Connection[]) => void;
8
8
  };
9
9
  /**
10
- * Hook to check if a <Handle /> is connected to another <Handle /> and get the connections.
10
+ * Hook to check if a <Handle /> is connected to another <Handle /> and get the connections.
11
11
  *
12
12
  * @public
13
13
  * @param param.type - handle type 'source' or 'target'
@@ -1 +1 @@
1
- {"version":3,"file":"useNodesInitialized.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/hooks/useNodesInitialized.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,0BAA0B,GAAG;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAgBF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,0BAA2C,GAAG,OAAO,CAIjG"}
1
+ {"version":3,"file":"useNodesInitialized.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/hooks/useNodesInitialized.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,0BAA0B,GAAG;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAsBF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,0BAA2C,GAAG,OAAO,CAIjG"}
@@ -6,7 +6,7 @@ export type UseOnSelectionChangeOptions = {
6
6
  * Hook for registering an onSelectionChange handler.
7
7
  *
8
8
  * @public
9
- * @params params.onChange - The handler to register
9
+ * @param params.onChange - The handler to register
10
10
  */
11
11
  export declare function useOnSelectionChange({ onChange }: UseOnSelectionChangeOptions): void;
12
12
  //# sourceMappingURL=useOnSelectionChange.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUpdateNodePositions.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/hooks/useUpdateNodePositions.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAgB,sBAAsB,aAGS;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAAE,UA8C/F"}
1
+ {"version":3,"file":"useUpdateNodePositions.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/hooks/useUpdateNodePositions.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,wBAAgB,sBAAsB,aAGS;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,OAAO,CAAA;CAAE,UAqD/F"}
@@ -30,6 +30,6 @@ export { applyNodeChanges, applyEdgeChanges, handleParentExpand } from './utils/
30
30
  export { isNode, isEdge } from './utils/general';
31
31
  export * from './additional-components';
32
32
  export * from './types';
33
- export { type SmoothStepPathOptions, type BezierPathOptions, ConnectionLineType, type EdgeMarker, type EdgeMarkerType, MarkerType, type OnMove, type OnMoveStart, type OnMoveEnd, type Connection, type ConnectionStatus, ConnectionMode, type OnConnectStartParams, type OnConnectStart, type OnConnect, type OnConnectEnd, type IsValidConnection, type Viewport, type SnapGrid, PanOnScrollMode, type ViewportHelperFunctionOptions, type SetCenterOptions, type FitBoundsOptions, type PanelPosition, type ProOptions, SelectionMode, type SelectionRect, type OnError, type NodeProps, type NodeOrigin, type OnNodeDrag, type OnSelectionDrag, Position, type XYPosition, type XYZPosition, type Dimensions, type Rect, type Box, type Transform, type CoordinateExtent, type ColorMode, type ColorModeClass, type HandleType, type OnBeforeDelete, type ShouldResize, type OnResizeStart, type OnResize, type OnResizeEnd, type ControlPosition, type ControlLinePosition, type ResizeControlVariant, } from '@xyflow/system';
33
+ export { type SmoothStepPathOptions, type BezierPathOptions, ConnectionLineType, type EdgeMarker, type EdgeMarkerType, MarkerType, type OnMove, type OnMoveStart, type OnMoveEnd, type Connection, type ConnectionStatus, ConnectionMode, type OnConnectStartParams, type OnConnectStart, type OnConnect, type OnConnectEnd, type IsValidConnection, type Viewport, type SnapGrid, PanOnScrollMode, type ViewportHelperFunctionOptions, type SetCenterOptions, type FitBoundsOptions, type PanelPosition, type ProOptions, SelectionMode, type SelectionRect, type OnError, type NodeProps, 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, } from '@xyflow/system';
34
34
  export { type GetBezierPathParams, getBezierEdgeCenter, getBezierPath, getEdgeCenter, type GetSmoothStepPathParams, getSmoothStepPath, type GetStraightPathParams, getStraightPath, getViewportForBounds, getNodesBounds, getIncomers, getOutgoers, addEdge, updateEdge, getConnectedEdges, internalsSymbol, } from '@xyflow/system';
35
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/react/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAC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f,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,GAAG,EACR,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AAGxB,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,UAAU,EACV,iBAAiB,EACjB,eAAe,GAChB,MAAM,gBAAgB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
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, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, XYDrag, snapPosition, calcNextPosition, Position, isMouseEvent, XYHandle, getHostForElement, addEdge, 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';
5
+ import { errorMessages, infiniteExtent, isInputDOMNode, fitView, getViewportForBounds, pointToRendererPoint, rendererPointToPoint, isNodeBase, isEdgeBase, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, XYDrag, snapPosition, calculateNodePosition, Position, isMouseEvent, XYHandle, getHostForElement, addEdge, getNodesBounds, clampPosition, internalsSymbol, getPositionWithOrigin, elementSelectionKeys, isEdgeVisible, MarkerType, createMarkerIds, isNumeric, getBezierEdgeCenter, getSmoothStepPath, getStraightPath, getBezierPath, getEdgePosition, getElevatedEdgeZIndex, getMarkerId, ConnectionMode, ConnectionLineType, updateConnectionLookup, adoptUserProvidedNodes, devWarn, 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, addEdge, getBezierEdgeCenter, getBezierPath, getConnectedEdges, getEdgeCenter, getIncomers, getNodesBounds, getOutgoers, getSmoothStepPath, getStraightPath, getViewportForBounds, internalsSymbol, updateEdge } from '@xyflow/system';
7
7
  import { useStoreWithEqualityFn, createWithEqualityFn } from 'zustand/traditional';
8
8
  import { shallow } from 'zustand/shallow';
@@ -424,25 +424,25 @@ const useViewportHelper = () => {
424
424
  const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
425
425
  panZoom?.setViewport(viewport, { duration: options?.duration });
426
426
  },
427
- screenToFlowPosition: (position, options = { snapToGrid: true }) => {
427
+ screenToFlowPosition: (clientPosition, options = { snapToGrid: true }) => {
428
428
  const { transform, snapGrid, domNode } = store.getState();
429
429
  if (!domNode) {
430
- return position;
430
+ return clientPosition;
431
431
  }
432
432
  const { x: domX, y: domY } = domNode.getBoundingClientRect();
433
433
  const correctedPosition = {
434
- x: position.x - domX,
435
- y: position.y - domY,
434
+ x: clientPosition.x - domX,
435
+ y: clientPosition.y - domY,
436
436
  };
437
437
  return pointToRendererPoint(correctedPosition, transform, options.snapToGrid, snapGrid);
438
438
  },
439
- flowToScreenPosition: (position) => {
439
+ flowToScreenPosition: (flowPosition) => {
440
440
  const { transform, domNode } = store.getState();
441
441
  if (!domNode) {
442
- return position;
442
+ return flowPosition;
443
443
  }
444
444
  const { x: domX, y: domY } = domNode.getBoundingClientRect();
445
- const rendererPosition = rendererPointToPoint(position, transform);
445
+ const rendererPosition = rendererPointToPoint(flowPosition, transform);
446
446
  return {
447
447
  x: rendererPosition.x + domX,
448
448
  y: rendererPosition.y + domY,
@@ -458,9 +458,7 @@ function handleParentExpand(updatedElements, updateItem) {
458
458
  for (const [index, item] of updatedElements.entries()) {
459
459
  if (item.id === updateItem.parentNode) {
460
460
  const parent = { ...item };
461
- if (!parent.computed) {
462
- parent.computed = {};
463
- }
461
+ parent.computed ??= {};
464
462
  const extendWidth = updateItem.position.x + updateItem.computed.width - parent.computed.width;
465
463
  const extendHeight = updateItem.position.y + updateItem.computed.height - parent.computed.height;
466
464
  if (extendWidth > 0 || extendHeight > 0 || updateItem.position.x < 0 || updateItem.position.y < 0) {
@@ -543,7 +541,7 @@ function applyChanges(changes, elements) {
543
541
  /// each _mutate_ this object, so there's only ever one copy.
544
542
  const updatedElement = { ...element };
545
543
  for (const change of changes) {
546
- applyChange(change, updatedElement, elements);
544
+ applyChange(change, updatedElement, updatedElements);
547
545
  }
548
546
  updatedElements.push(updatedElement);
549
547
  }
@@ -1264,7 +1262,7 @@ function useDrag({ nodeRef, disabled = false, noDragClassName, handleSelector, n
1264
1262
  handleNodeClick({
1265
1263
  id,
1266
1264
  store,
1267
- nodeRef: nodeRef,
1265
+ nodeRef,
1268
1266
  });
1269
1267
  },
1270
1268
  onDragStart: () => {
@@ -1306,7 +1304,7 @@ const selectedAndDraggable = (nodesDraggable) => (n) => n.selected && (n.draggab
1306
1304
  function useUpdateNodePositions() {
1307
1305
  const store = useStoreApi();
1308
1306
  const updatePositions = useCallback((params) => {
1309
- const { nodeExtent, nodes, snapToGrid, snapGrid, nodesDraggable, onError, updateNodePositions } = store.getState();
1307
+ const { nodeExtent, nodes, snapToGrid, snapGrid, nodesDraggable, onError, updateNodePositions, nodeLookup, nodeOrigin, } = store.getState();
1310
1308
  const selectedNodes = nodes.filter(selectedAndDraggable(nodesDraggable));
1311
1309
  // by default a node moves 5px on each key press, or 20px if shift is pressed
1312
1310
  // if snap grid is enabled, we use that for the velocity.
@@ -1318,17 +1316,21 @@ function useUpdateNodePositions() {
1318
1316
  const nodeUpdates = selectedNodes.map((node) => {
1319
1317
  if (node.computed?.positionAbsolute) {
1320
1318
  let nextPosition = {
1321
- x: node.computed?.positionAbsolute.x + xDiff,
1322
- y: node.computed?.positionAbsolute.y + yDiff,
1319
+ x: node.computed.positionAbsolute.x + xDiff,
1320
+ y: node.computed.positionAbsolute.y + yDiff,
1323
1321
  };
1324
1322
  if (snapToGrid) {
1325
1323
  nextPosition = snapPosition(nextPosition, snapGrid);
1326
1324
  }
1327
- const { positionAbsolute, position } = calcNextPosition(node, nextPosition, nodes, nodeExtent, undefined, onError);
1325
+ const { position, positionAbsolute } = calculateNodePosition({
1326
+ nodeId: node.id,
1327
+ nextPosition,
1328
+ nodeLookup,
1329
+ nodeExtent,
1330
+ nodeOrigin,
1331
+ onError,
1332
+ });
1328
1333
  node.position = position;
1329
- if (!node.computed) {
1330
- node.computed = {};
1331
- }
1332
1334
  node.computed.positionAbsolute = positionAbsolute;
1333
1335
  }
1334
1336
  return node;
@@ -1470,6 +1472,9 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
1470
1472
  ]), onMouseDown: onPointerDown, onTouchStart: onPointerDown, onClick: connectOnClick ? onClick : undefined, ref: ref, ...rest, children: children }));
1471
1473
  });
1472
1474
  HandleComponent.displayName = 'Handle';
1475
+ /**
1476
+ * The Handle component is the part of a node that can be used to connect nodes.
1477
+ */
1473
1478
  const Handle = memo(HandleComponent);
1474
1479
 
1475
1480
  function InputNode({ data, isConnectable, sourcePosition = Position.Bottom }) {
@@ -1503,7 +1508,7 @@ const builtinNodeTypes = {
1503
1508
 
1504
1509
  const selector$h = (s) => {
1505
1510
  const selectedNodes = s.nodes.filter((n) => n.selected);
1506
- const { width, height, x, y } = getNodesBounds(selectedNodes, s.nodeOrigin);
1511
+ const { width, height, x, y } = getNodesBounds(selectedNodes, { nodeOrigin: s.nodeOrigin });
1507
1512
  return {
1508
1513
  width,
1509
1514
  height,
@@ -1552,14 +1557,16 @@ function NodesSelection({ onSelectionContextMenu, noPanClassName, disableKeyboar
1552
1557
  } }) }));
1553
1558
  }
1554
1559
 
1555
- const selector$g = (s) => s.nodesSelectionActive;
1560
+ const selector$g = (s) => {
1561
+ return { nodesSelectionActive: s.nodesSelectionActive, userSelectionActive: s.userSelectionActive };
1562
+ };
1556
1563
  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, }) => {
1557
- const nodesSelectionActive = useStore(selector$g);
1564
+ const { nodesSelectionActive, userSelectionActive } = useStore(selector$g);
1558
1565
  const selectionKeyPressed = useKeyPress(selectionKeyCode);
1559
1566
  const panActivationKeyPressed = useKeyPress(panActivationKeyCode);
1560
1567
  const panOnDrag = panActivationKeyPressed || _panOnDrag;
1561
1568
  const panOnScroll = panActivationKeyPressed || _panOnScroll;
1562
- const isSelecting = selectionKeyPressed || (selectionOnDrag && panOnDrag !== true);
1569
+ const isSelecting = selectionKeyPressed || userSelectionActive || (selectionOnDrag && panOnDrag !== true);
1563
1570
  useGlobalKeyHandler({ deleteKeyCode, multiSelectionKeyCode });
1564
1571
  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 }))] }) }));
1565
1572
  };
@@ -1884,18 +1891,21 @@ const Marker = ({ id, type, color, width = 12.5, height = 12.5, markerUnits = 's
1884
1891
  }
1885
1892
  return (jsx("marker", { className: "react-flow__arrowhead", id: id, markerWidth: `${width}`, markerHeight: `${height}`, viewBox: "-10 -10 20 20", markerUnits: markerUnits, orient: orient, refX: "0", refY: "0", children: jsx(Symbol, { color: color, strokeWidth: strokeWidth }) }));
1886
1893
  };
1887
- const markerSelector = ({ defaultColor, rfId }) => (s) => {
1888
- const markers = createMarkerIds(s.edges, { id: rfId, defaultColor });
1889
- return markers;
1890
- };
1891
- const markersEqual = (a, b) =>
1892
- // the id includes all marker options, so we just need to look at that part of the marker
1893
- !(a.length !== b.length || a.some((m, i) => m.id !== b[i].id));
1894
1894
  // when you have multiple flows on a page and you hide the first one, the other ones have no markers anymore
1895
1895
  // when they do have markers with the same ids. To prevent this the user can pass a unique id to the react flow wrapper
1896
1896
  // that we can then use for creating our unique marker ids
1897
1897
  const MarkerDefinitions = ({ defaultColor, rfId }) => {
1898
- const markers = useStore(useCallback(markerSelector({ defaultColor, rfId }), [defaultColor, rfId]), markersEqual);
1898
+ const edges = useStore((s) => s.edges);
1899
+ const defaultEdgeOptions = useStore((s) => s.defaultEdgeOptions);
1900
+ const markers = useMemo(() => {
1901
+ const markers = createMarkerIds(edges, {
1902
+ id: rfId,
1903
+ defaultColor,
1904
+ defaultMarkerStart: defaultEdgeOptions?.markerStart,
1905
+ defaultMarkerEnd: defaultEdgeOptions?.markerEnd,
1906
+ });
1907
+ return markers;
1908
+ }, [edges, defaultEdgeOptions, rfId, defaultColor]);
1899
1909
  if (!markers.length) {
1900
1910
  return null;
1901
1911
  }
@@ -2259,6 +2269,7 @@ function EdgeWrapper({ id, edgesFocusable, edgesUpdatable, elementsSelectable, o
2259
2269
  animated: edge.animated,
2260
2270
  inactive: !isSelectable && !onClick,
2261
2271
  updating: updateHover,
2272
+ selectable: isSelectable,
2262
2273
  },
2263
2274
  ]), 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 }))] }) }));
2264
2275
  }
@@ -2468,7 +2479,8 @@ const getInitialState = ({ nodes = [], edges = [], width, height, fitView, } = {
2468
2479
  let transform = [0, 0, 1];
2469
2480
  if (fitView && width && height) {
2470
2481
  const nodesWithDimensions = nextNodes.filter((node) => node.width && node.height);
2471
- const bounds = getNodesBounds(nodesWithDimensions, [0, 0]);
2482
+ // @todo users nodeOrigin should be used here
2483
+ const bounds = getNodesBounds(nodesWithDimensions, { nodeOrigin: [0, 0] });
2472
2484
  const { x, y, zoom } = getViewportForBounds(bounds, width, height, 0.5, 2, 0.1);
2473
2485
  transform = [x, y, zoom];
2474
2486
  }
@@ -2525,7 +2537,7 @@ const getInitialState = ({ nodes = [], edges = [], width, height, fitView, } = {
2525
2537
  autoPanOnConnect: true,
2526
2538
  autoPanOnNodeDrag: true,
2527
2539
  connectionRadius: 20,
2528
- onError: () => null,
2540
+ onError: devWarn,
2529
2541
  isValidConnection: undefined,
2530
2542
  onSelectionChangeHandlers: [],
2531
2543
  lib: 'react',
@@ -2948,7 +2960,7 @@ function useOnViewportChange({ onStart, onChange, onEnd }) {
2948
2960
  * Hook for registering an onSelectionChange handler.
2949
2961
  *
2950
2962
  * @public
2951
- * @params params.onChange - The handler to register
2963
+ * @param params.onChange - The handler to register
2952
2964
  */
2953
2965
  function useOnSelectionChange({ onChange }) {
2954
2966
  const store = useStoreApi();
@@ -2966,9 +2978,14 @@ const selector$6 = (options) => (s) => {
2966
2978
  if (s.nodes.length === 0) {
2967
2979
  return false;
2968
2980
  }
2969
- return s.nodes
2970
- .filter((n) => (options.includeHiddenNodes ? true : !n.hidden))
2971
- .every((n) => n[internalsSymbol]?.handleBounds !== undefined);
2981
+ for (const node of s.nodes) {
2982
+ if (options.includeHiddenNodes || !node.hidden) {
2983
+ if (node[internalsSymbol]?.handleBounds === undefined) {
2984
+ return false;
2985
+ }
2986
+ }
2987
+ }
2988
+ return true;
2972
2989
  };
2973
2990
  const defaultOptions = {
2974
2991
  includeHiddenNodes: false,
@@ -2986,7 +3003,7 @@ function useNodesInitialized(options = defaultOptions) {
2986
3003
  }
2987
3004
 
2988
3005
  /**
2989
- * Hook to check if a <Handle /> is connected to another <Handle /> and get the connections.
3006
+ * Hook to check if a <Handle /> is connected to another <Handle /> and get the connections.
2990
3007
  *
2991
3008
  * @public
2992
3009
  * @param param.type - handle type 'source' or 'target'
@@ -3041,7 +3058,7 @@ const selector$5 = (s) => ({
3041
3058
  * Hook for accessing the ongoing connection.
3042
3059
  *
3043
3060
  * @public
3044
- * @returns ongoing connection: startHandle, endHandle, status, position
3061
+ * @returns ongoing connection
3045
3062
  */
3046
3063
  function useConnection() {
3047
3064
  const ongoingConnection = useStore(selector$5, shallow);
@@ -3214,7 +3231,7 @@ const selector$1 = (s) => {
3214
3231
  };
3215
3232
  return {
3216
3233
  viewBB,
3217
- boundingRect: s.nodes.length > 0 ? getBoundsOfRects(getNodesBounds(s.nodes, s.nodeOrigin), viewBB) : viewBB,
3234
+ boundingRect: s.nodes.length > 0 ? getBoundsOfRects(getNodesBounds(s.nodes, { nodeOrigin: s.nodeOrigin }), viewBB) : viewBB,
3218
3235
  rfId: s.rfId,
3219
3236
  nodeOrigin: s.nodeOrigin,
3220
3237
  panZoom: s.panZoom,
@@ -3450,7 +3467,7 @@ function NodeToolbar({ nodeId, children, className, style, isVisible, position =
3450
3467
  if (!isActive || !nodes.length) {
3451
3468
  return null;
3452
3469
  }
3453
- const nodeRect = getNodesBounds(nodes, nodeOrigin);
3470
+ const nodeRect = getNodesBounds(nodes, { nodeOrigin });
3454
3471
  const zIndex = Math.max(...nodes.map((node) => (node[internalsSymbol]?.z || 1) + 1));
3455
3472
  const wrapperStyle = {
3456
3473
  position: 'absolute',