@xyflow/react 12.4.1 → 12.4.3

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 (218) hide show
  1. package/dist/esm/additional-components/Background/Background.d.ts +53 -0
  2. package/dist/esm/additional-components/Background/Background.d.ts.map +1 -1
  3. package/dist/esm/additional-components/Background/types.d.ts +11 -1
  4. package/dist/esm/additional-components/Background/types.d.ts.map +1 -1
  5. package/dist/esm/additional-components/Controls/ControlButton.d.ts +23 -0
  6. package/dist/esm/additional-components/Controls/ControlButton.d.ts.map +1 -1
  7. package/dist/esm/additional-components/Controls/Controls.d.ts +21 -0
  8. package/dist/esm/additional-components/Controls/Controls.d.ts.map +1 -1
  9. package/dist/esm/additional-components/Controls/types.d.ts +8 -1
  10. package/dist/esm/additional-components/Controls/types.d.ts.map +1 -1
  11. package/dist/esm/additional-components/MiniMap/MiniMap.d.ts +20 -0
  12. package/dist/esm/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
  13. package/dist/esm/additional-components/MiniMap/MiniMapNodes.d.ts.map +1 -1
  14. package/dist/esm/additional-components/MiniMap/types.d.ts +11 -1
  15. package/dist/esm/additional-components/MiniMap/types.d.ts.map +1 -1
  16. package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts +5 -0
  17. package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
  18. package/dist/esm/additional-components/NodeResizer/NodeResizer.d.ts +24 -0
  19. package/dist/esm/additional-components/NodeResizer/NodeResizer.d.ts.map +1 -1
  20. package/dist/esm/additional-components/NodeResizer/types.d.ts +15 -3
  21. package/dist/esm/additional-components/NodeResizer/types.d.ts.map +1 -1
  22. package/dist/esm/additional-components/NodeToolbar/NodeToolbar.d.ts +35 -0
  23. package/dist/esm/additional-components/NodeToolbar/NodeToolbar.d.ts.map +1 -1
  24. package/dist/esm/additional-components/NodeToolbar/types.d.ts +7 -2
  25. package/dist/esm/additional-components/NodeToolbar/types.d.ts.map +1 -1
  26. package/dist/esm/components/BatchProvider/index.d.ts.map +1 -1
  27. package/dist/esm/components/BatchProvider/useQueue.d.ts.map +1 -1
  28. package/dist/esm/components/ConnectionLine/index.d.ts +4 -4
  29. package/dist/esm/components/ConnectionLine/index.d.ts.map +1 -1
  30. package/dist/esm/components/EdgeLabelRenderer/index.d.ts +40 -0
  31. package/dist/esm/components/EdgeLabelRenderer/index.d.ts.map +1 -1
  32. package/dist/esm/components/Edges/BaseEdge.d.ts +27 -0
  33. package/dist/esm/components/Edges/BaseEdge.d.ts.map +1 -1
  34. package/dist/esm/components/Edges/EdgeText.d.ts +26 -0
  35. package/dist/esm/components/Edges/EdgeText.d.ts.map +1 -1
  36. package/dist/esm/components/Edges/SimpleBezierEdge.d.ts +5 -0
  37. package/dist/esm/components/Edges/SimpleBezierEdge.d.ts.map +1 -1
  38. package/dist/esm/components/Edges/index.d.ts.map +1 -1
  39. package/dist/esm/components/Handle/index.d.ts +32 -4
  40. package/dist/esm/components/Handle/index.d.ts.map +1 -1
  41. package/dist/esm/components/NodeWrapper/index.d.ts +1 -1
  42. package/dist/esm/components/NodeWrapper/index.d.ts.map +1 -1
  43. package/dist/esm/components/NodeWrapper/useNodeObserver.d.ts.map +1 -1
  44. package/dist/esm/components/NodeWrapper/utils.d.ts.map +1 -1
  45. package/dist/esm/components/Nodes/utils.d.ts.map +1 -1
  46. package/dist/esm/components/Panel/index.d.ts +32 -4
  47. package/dist/esm/components/Panel/index.d.ts.map +1 -1
  48. package/dist/esm/components/ReactFlowProvider/index.d.ts +34 -0
  49. package/dist/esm/components/ReactFlowProvider/index.d.ts.map +1 -1
  50. package/dist/esm/components/StoreUpdater/index.d.ts.map +1 -1
  51. package/dist/esm/components/ViewportPortal/index.d.ts +25 -0
  52. package/dist/esm/components/ViewportPortal/index.d.ts.map +1 -1
  53. package/dist/esm/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -1
  54. package/dist/esm/container/NodeRenderer/index.d.ts.map +1 -1
  55. package/dist/esm/container/Pane/index.d.ts.map +1 -1
  56. package/dist/esm/container/ReactFlow/Wrapper.d.ts.map +1 -1
  57. package/dist/esm/container/ReactFlow/index.d.ts +20 -0
  58. package/dist/esm/container/ReactFlow/index.d.ts.map +1 -1
  59. package/dist/esm/contexts/NodeIdContext.d.ts +28 -0
  60. package/dist/esm/contexts/NodeIdContext.d.ts.map +1 -1
  61. package/dist/esm/hooks/useConnection.d.ts +20 -1
  62. package/dist/esm/hooks/useConnection.d.ts.map +1 -1
  63. package/dist/esm/hooks/useEdges.d.ts +13 -1
  64. package/dist/esm/hooks/useEdges.d.ts.map +1 -1
  65. package/dist/esm/hooks/useInternalNode.d.ts +21 -1
  66. package/dist/esm/hooks/useInternalNode.d.ts.map +1 -1
  67. package/dist/esm/hooks/useKeyPress.d.ts +19 -1
  68. package/dist/esm/hooks/useKeyPress.d.ts.map +1 -1
  69. package/dist/esm/hooks/useMoveSelectedNodes.d.ts.map +1 -1
  70. package/dist/esm/hooks/useNodeConnections.d.ts +17 -1
  71. package/dist/esm/hooks/useNodeConnections.d.ts.map +1 -1
  72. package/dist/esm/hooks/useNodes.d.ts +14 -1
  73. package/dist/esm/hooks/useNodes.d.ts.map +1 -1
  74. package/dist/esm/hooks/useNodesData.d.ts +14 -2
  75. package/dist/esm/hooks/useNodesData.d.ts.map +1 -1
  76. package/dist/esm/hooks/useNodesEdgesState.d.ts +62 -2
  77. package/dist/esm/hooks/useNodesEdgesState.d.ts.map +1 -1
  78. package/dist/esm/hooks/useNodesInitialized.d.ts +27 -1
  79. package/dist/esm/hooks/useNodesInitialized.d.ts.map +1 -1
  80. package/dist/esm/hooks/useOnSelectionChange.d.ts +33 -1
  81. package/dist/esm/hooks/useOnSelectionChange.d.ts.map +1 -1
  82. package/dist/esm/hooks/useOnViewportChange.d.ts +19 -1
  83. package/dist/esm/hooks/useOnViewportChange.d.ts.map +1 -1
  84. package/dist/esm/hooks/useReactFlow.d.ts +24 -1
  85. package/dist/esm/hooks/useReactFlow.d.ts.map +1 -1
  86. package/dist/esm/hooks/useStore.d.ts +23 -2
  87. package/dist/esm/hooks/useStore.d.ts.map +1 -1
  88. package/dist/esm/hooks/useUpdateNodeInternals.d.ts +39 -1
  89. package/dist/esm/hooks/useUpdateNodeInternals.d.ts.map +1 -1
  90. package/dist/esm/hooks/useViewport.d.ts +24 -1
  91. package/dist/esm/hooks/useViewport.d.ts.map +1 -1
  92. package/dist/esm/hooks/useViewportHelper.d.ts.map +1 -1
  93. package/dist/esm/index.js +1090 -185
  94. package/dist/esm/index.mjs +1090 -185
  95. package/dist/esm/store/index.d.ts.map +1 -1
  96. package/dist/esm/types/component-props.d.ts +111 -56
  97. package/dist/esm/types/component-props.d.ts.map +1 -1
  98. package/dist/esm/types/edges.d.ts +27 -2
  99. package/dist/esm/types/edges.d.ts.map +1 -1
  100. package/dist/esm/types/general.d.ts +41 -0
  101. package/dist/esm/types/general.d.ts.map +1 -1
  102. package/dist/esm/types/instance.d.ts +11 -0
  103. package/dist/esm/types/instance.d.ts.map +1 -1
  104. package/dist/esm/types/nodes.d.ts +46 -4
  105. package/dist/esm/types/nodes.d.ts.map +1 -1
  106. package/dist/esm/utils/changes.d.ts +45 -23
  107. package/dist/esm/utils/changes.d.ts.map +1 -1
  108. package/dist/esm/utils/general.d.ts +26 -2
  109. package/dist/esm/utils/general.d.ts.map +1 -1
  110. package/dist/umd/additional-components/Background/Background.d.ts +53 -0
  111. package/dist/umd/additional-components/Background/Background.d.ts.map +1 -1
  112. package/dist/umd/additional-components/Background/types.d.ts +11 -1
  113. package/dist/umd/additional-components/Background/types.d.ts.map +1 -1
  114. package/dist/umd/additional-components/Controls/ControlButton.d.ts +23 -0
  115. package/dist/umd/additional-components/Controls/ControlButton.d.ts.map +1 -1
  116. package/dist/umd/additional-components/Controls/Controls.d.ts +21 -0
  117. package/dist/umd/additional-components/Controls/Controls.d.ts.map +1 -1
  118. package/dist/umd/additional-components/Controls/types.d.ts +8 -1
  119. package/dist/umd/additional-components/Controls/types.d.ts.map +1 -1
  120. package/dist/umd/additional-components/MiniMap/MiniMap.d.ts +20 -0
  121. package/dist/umd/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
  122. package/dist/umd/additional-components/MiniMap/MiniMapNodes.d.ts.map +1 -1
  123. package/dist/umd/additional-components/MiniMap/types.d.ts +11 -1
  124. package/dist/umd/additional-components/MiniMap/types.d.ts.map +1 -1
  125. package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts +5 -0
  126. package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
  127. package/dist/umd/additional-components/NodeResizer/NodeResizer.d.ts +24 -0
  128. package/dist/umd/additional-components/NodeResizer/NodeResizer.d.ts.map +1 -1
  129. package/dist/umd/additional-components/NodeResizer/types.d.ts +15 -3
  130. package/dist/umd/additional-components/NodeResizer/types.d.ts.map +1 -1
  131. package/dist/umd/additional-components/NodeToolbar/NodeToolbar.d.ts +35 -0
  132. package/dist/umd/additional-components/NodeToolbar/NodeToolbar.d.ts.map +1 -1
  133. package/dist/umd/additional-components/NodeToolbar/types.d.ts +7 -2
  134. package/dist/umd/additional-components/NodeToolbar/types.d.ts.map +1 -1
  135. package/dist/umd/components/BatchProvider/index.d.ts.map +1 -1
  136. package/dist/umd/components/BatchProvider/useQueue.d.ts.map +1 -1
  137. package/dist/umd/components/ConnectionLine/index.d.ts +4 -4
  138. package/dist/umd/components/ConnectionLine/index.d.ts.map +1 -1
  139. package/dist/umd/components/EdgeLabelRenderer/index.d.ts +40 -0
  140. package/dist/umd/components/EdgeLabelRenderer/index.d.ts.map +1 -1
  141. package/dist/umd/components/Edges/BaseEdge.d.ts +27 -0
  142. package/dist/umd/components/Edges/BaseEdge.d.ts.map +1 -1
  143. package/dist/umd/components/Edges/EdgeText.d.ts +26 -0
  144. package/dist/umd/components/Edges/EdgeText.d.ts.map +1 -1
  145. package/dist/umd/components/Edges/SimpleBezierEdge.d.ts +5 -0
  146. package/dist/umd/components/Edges/SimpleBezierEdge.d.ts.map +1 -1
  147. package/dist/umd/components/Edges/index.d.ts.map +1 -1
  148. package/dist/umd/components/Handle/index.d.ts +32 -4
  149. package/dist/umd/components/Handle/index.d.ts.map +1 -1
  150. package/dist/umd/components/NodeWrapper/index.d.ts +1 -1
  151. package/dist/umd/components/NodeWrapper/index.d.ts.map +1 -1
  152. package/dist/umd/components/NodeWrapper/useNodeObserver.d.ts.map +1 -1
  153. package/dist/umd/components/NodeWrapper/utils.d.ts.map +1 -1
  154. package/dist/umd/components/Nodes/utils.d.ts.map +1 -1
  155. package/dist/umd/components/Panel/index.d.ts +32 -4
  156. package/dist/umd/components/Panel/index.d.ts.map +1 -1
  157. package/dist/umd/components/ReactFlowProvider/index.d.ts +34 -0
  158. package/dist/umd/components/ReactFlowProvider/index.d.ts.map +1 -1
  159. package/dist/umd/components/StoreUpdater/index.d.ts.map +1 -1
  160. package/dist/umd/components/ViewportPortal/index.d.ts +25 -0
  161. package/dist/umd/components/ViewportPortal/index.d.ts.map +1 -1
  162. package/dist/umd/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -1
  163. package/dist/umd/container/NodeRenderer/index.d.ts.map +1 -1
  164. package/dist/umd/container/Pane/index.d.ts.map +1 -1
  165. package/dist/umd/container/ReactFlow/Wrapper.d.ts.map +1 -1
  166. package/dist/umd/container/ReactFlow/index.d.ts +20 -0
  167. package/dist/umd/container/ReactFlow/index.d.ts.map +1 -1
  168. package/dist/umd/contexts/NodeIdContext.d.ts +28 -0
  169. package/dist/umd/contexts/NodeIdContext.d.ts.map +1 -1
  170. package/dist/umd/hooks/useConnection.d.ts +20 -1
  171. package/dist/umd/hooks/useConnection.d.ts.map +1 -1
  172. package/dist/umd/hooks/useEdges.d.ts +13 -1
  173. package/dist/umd/hooks/useEdges.d.ts.map +1 -1
  174. package/dist/umd/hooks/useInternalNode.d.ts +21 -1
  175. package/dist/umd/hooks/useInternalNode.d.ts.map +1 -1
  176. package/dist/umd/hooks/useKeyPress.d.ts +19 -1
  177. package/dist/umd/hooks/useKeyPress.d.ts.map +1 -1
  178. package/dist/umd/hooks/useMoveSelectedNodes.d.ts.map +1 -1
  179. package/dist/umd/hooks/useNodeConnections.d.ts +17 -1
  180. package/dist/umd/hooks/useNodeConnections.d.ts.map +1 -1
  181. package/dist/umd/hooks/useNodes.d.ts +14 -1
  182. package/dist/umd/hooks/useNodes.d.ts.map +1 -1
  183. package/dist/umd/hooks/useNodesData.d.ts +14 -2
  184. package/dist/umd/hooks/useNodesData.d.ts.map +1 -1
  185. package/dist/umd/hooks/useNodesEdgesState.d.ts +62 -2
  186. package/dist/umd/hooks/useNodesEdgesState.d.ts.map +1 -1
  187. package/dist/umd/hooks/useNodesInitialized.d.ts +27 -1
  188. package/dist/umd/hooks/useNodesInitialized.d.ts.map +1 -1
  189. package/dist/umd/hooks/useOnSelectionChange.d.ts +33 -1
  190. package/dist/umd/hooks/useOnSelectionChange.d.ts.map +1 -1
  191. package/dist/umd/hooks/useOnViewportChange.d.ts +19 -1
  192. package/dist/umd/hooks/useOnViewportChange.d.ts.map +1 -1
  193. package/dist/umd/hooks/useReactFlow.d.ts +24 -1
  194. package/dist/umd/hooks/useReactFlow.d.ts.map +1 -1
  195. package/dist/umd/hooks/useStore.d.ts +23 -2
  196. package/dist/umd/hooks/useStore.d.ts.map +1 -1
  197. package/dist/umd/hooks/useUpdateNodeInternals.d.ts +39 -1
  198. package/dist/umd/hooks/useUpdateNodeInternals.d.ts.map +1 -1
  199. package/dist/umd/hooks/useViewport.d.ts +24 -1
  200. package/dist/umd/hooks/useViewport.d.ts.map +1 -1
  201. package/dist/umd/hooks/useViewportHelper.d.ts.map +1 -1
  202. package/dist/umd/index.js +2 -2
  203. package/dist/umd/store/index.d.ts.map +1 -1
  204. package/dist/umd/types/component-props.d.ts +111 -56
  205. package/dist/umd/types/component-props.d.ts.map +1 -1
  206. package/dist/umd/types/edges.d.ts +27 -2
  207. package/dist/umd/types/edges.d.ts.map +1 -1
  208. package/dist/umd/types/general.d.ts +41 -0
  209. package/dist/umd/types/general.d.ts.map +1 -1
  210. package/dist/umd/types/instance.d.ts +11 -0
  211. package/dist/umd/types/instance.d.ts.map +1 -1
  212. package/dist/umd/types/nodes.d.ts +46 -4
  213. package/dist/umd/types/nodes.d.ts.map +1 -1
  214. package/dist/umd/utils/changes.d.ts +45 -23
  215. package/dist/umd/utils/changes.d.ts.map +1 -1
  216. package/dist/umd/utils/general.d.ts +26 -2
  217. package/dist/umd/utils/general.d.ts.map +1 -1
  218. package/package.json +4 -3
@@ -1 +1 @@
1
- {"version":3,"file":"MarkerDefinitions.d.ts","sourceRoot":"","sources":["../../../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
+ {"version":3,"file":"MarkerDefinitions.d.ts","sourceRoot":"","sources":["../../../src/container/EdgeRenderer/MarkerDefinitions.tsx"],"names":[],"mappings":";AAMA,KAAK,sBAAsB,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;;;;;AAkFF,wBAAuC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/NodeRenderer/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,IAAI,IAAI,CACzD,cAAc,CAAC,QAAQ,CAAC,EACtB,aAAa,GACb,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,2BAA2B,GAC3B,gBAAgB,GAChB,iBAAiB,GACjB,MAAM,GACN,qBAAqB,GACrB,YAAY,GACZ,WAAW,GACX,mBAAmB,CACtB,CAAC;AAUF,iBAAS,qBAAqB,CAAC,QAAQ,SAAS,IAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,QAAQ,CAAC,2CA2DvF;kBA3DQ,qBAAqB;;;AA+D9B,eAAO,MAAM,YAAY,8BAA8D,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/NodeRenderer/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,IAAI,IAAI,CACzD,cAAc,CAAC,QAAQ,CAAC,EACtB,aAAa,GACb,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,2BAA2B,GAC3B,gBAAgB,GAChB,iBAAiB,GACjB,MAAM,GACN,qBAAqB,GACrB,YAAY,GACZ,WAAW,GACX,mBAAmB,CACtB,CAAC;AAUF,iBAAS,qBAAqB,CAAC,QAAQ,SAAS,IAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,QAAQ,CAAC,2CA6DvF;kBA7DQ,qBAAqB;;;AAiE9B,eAAO,MAAM,YAAY,8BAA8D,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;AAgBf,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,2CAoMX"}
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;AAgBf,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,2CAwMX"}
@@ -1 +1 @@
1
- {"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/Wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,2CAwBA"}
1
+ {"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/Wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,2CA0BA"}
@@ -1,5 +1,25 @@
1
1
  /// <reference types="react" />
2
2
  import type { Edge, Node, ReactFlowProps } from '../../types';
3
+ /**
4
+ * The `<ReactFlow />` component is the heart of your React Flow application.
5
+ * It renders your nodes and edges and handles user interaction
6
+ *
7
+ * @public
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ *import { ReactFlow } from '@xyflow/react'
12
+ *
13
+ *export default function Flow() {
14
+ * return (<ReactFlow
15
+ * nodes={...}
16
+ * edges={...}
17
+ * onNodesChange={...}
18
+ * ...
19
+ * />);
20
+ *}
21
+ *```
22
+ */
3
23
  declare const _default: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: ReactFlowProps<NodeType, EdgeType> & import("react").RefAttributes<HTMLDivElement>) => JSX.Element;
4
24
  export default _default;
5
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/index.tsx"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;;AAoS9D,wBAA0C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/index.tsx"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA+S9D;;;;;;;;;;;;;;;;;;;GAmBG;;AACH,wBAA0C"}
@@ -2,6 +2,34 @@
2
2
  export declare const NodeIdContext: import("react").Context<string | null>;
3
3
  export declare const Provider: import("react").Provider<string | null>;
4
4
  export declare const Consumer: import("react").Consumer<string | null>;
5
+ /**
6
+ * You can use this hook to get the id of the node it is used inside. It is useful
7
+ * if you need the node's id deeper in the render tree but don't want to manually
8
+ * drill down the id as a prop.
9
+ *
10
+ * @public
11
+ * @returns id of the node
12
+ *
13
+ * @example
14
+ *```jsx
15
+ *import { useNodeId } from '@xyflow/react';
16
+ *
17
+ *export default function CustomNode() {
18
+ * return (
19
+ * <div>
20
+ * <span>This node has an id of </span>
21
+ * <NodeIdDisplay />
22
+ * </div>
23
+ * );
24
+ *}
25
+ *
26
+ *function NodeIdDisplay() {
27
+ * const nodeId = useNodeId();
28
+ *
29
+ * return <span>{nodeId}</span>;
30
+ *}
31
+ *```
32
+ */
5
33
  export declare const useNodeId: () => string | null;
6
34
  export default NodeIdContext;
7
35
  //# sourceMappingURL=NodeIdContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NodeIdContext.d.ts","sourceRoot":"","sources":["../../src/contexts/NodeIdContext.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,aAAa,wCAAqC,CAAC;AAChE,eAAO,MAAM,QAAQ,yCAAyB,CAAC;AAC/C,eAAO,MAAM,QAAQ,yCAAyB,CAAC;AAE/C,eAAO,MAAM,SAAS,QAAO,MAAM,GAAG,IAGrC,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"NodeIdContext.d.ts","sourceRoot":"","sources":["../../src/contexts/NodeIdContext.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,aAAa,wCAAqC,CAAC;AAChE,eAAO,MAAM,QAAQ,yCAAyB,CAAC;AAC/C,eAAO,MAAM,QAAQ,yCAAyB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,SAAS,QAAO,MAAM,GAAG,IAGrC,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,9 +1,28 @@
1
1
  import { ConnectionState } from '@xyflow/system';
2
2
  import type { InternalNode, Node } from '../types';
3
3
  /**
4
- * Hook for accessing the connection state.
4
+ * The `useConnection` hook returns the current connection when there is an active
5
+ * connection interaction. If no connection interaction is active, it returns null
6
+ * for every property. A typical use case for this hook is to colorize handles
7
+ * based on a certain condition (e.g. if the connection is valid or not).
5
8
  *
6
9
  * @public
10
+ * @example
11
+ *
12
+ * ```tsx
13
+ *import { useConnection } from '@xyflow/react';
14
+ *
15
+ *function App() {
16
+ * const connection = useConnection();
17
+ *
18
+ * return (
19
+ * <div> {connection ? `Someone is trying to make a connection from ${connection.fromNode} to this one.` : 'There are currently no incoming connections!'}
20
+ *
21
+ * </div>
22
+ * );
23
+ * }
24
+ * ```
25
+ *
7
26
  * @returns ConnectionState
8
27
  */
9
28
  export declare function useConnection<NodeType extends Node = Node, SelectorReturn = ConnectionState<InternalNode<NodeType>>>(connectionSelector?: (connection: ConnectionState<InternalNode<NodeType>>) => SelectorReturn): SelectorReturn;
@@ -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;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"}
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;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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"}
@@ -1,9 +1,21 @@
1
1
  import type { Edge } from '../types';
2
2
  /**
3
- * Hook for getting the current edges from the store.
3
+ * This hook returns an array of the current edges. Components that use this hook
4
+ * will re-render **whenever any edge changes**.
4
5
  *
5
6
  * @public
6
7
  * @returns An array of edges
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ *import { useEdges } from '@xyflow/react';
12
+ *
13
+ *export default function () {
14
+ * const edges = useEdges();
15
+ *
16
+ * return <div>There are currently {edges.length} edges!</div>;
17
+ *}
18
+ *```
7
19
  */
8
20
  export declare function useEdges<EdgeType extends Edge = Edge>(): EdgeType[];
9
21
  //# sourceMappingURL=useEdges.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEdges.d.ts","sourceRoot":"","sources":["../../src/hooks/useEdges.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAIrD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,EAAE,CAInE"}
1
+ {"version":3,"file":"useEdges.d.ts","sourceRoot":"","sources":["../../src/hooks/useEdges.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAIrD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,EAAE,CAInE"}
@@ -1,10 +1,30 @@
1
1
  import type { InternalNode, Node } from '../types';
2
2
  /**
3
- * Hook for getting an internal node by id
3
+ * This hook returns the internal representation of a specific node.
4
+ * Components that use this hook will re-render **whenever the node changes**,
5
+ * including when a node is selected or moved.
4
6
  *
5
7
  * @public
6
8
  * @param id - id of the node
7
9
  * @returns array with visible node ids
10
+ *
11
+ * @example
12
+ * ```tsx
13
+ *import { useInternalNode } from '@xyflow/react';
14
+ *
15
+ *export default function () {
16
+ * const internalNode = useInternalNode('node-1');
17
+ * const absolutePosition = internalNode.internals.positionAbsolute;
18
+ *
19
+ * return (
20
+ * <div>
21
+ * The absolute position of the node is at:
22
+ * <p>x: {absolutePosition.x}</p>
23
+ * <p>y: {absolutePosition.y}</p>
24
+ * </div>
25
+ * );
26
+ *}
27
+ *```
8
28
  */
9
29
  export declare function useInternalNode<NodeType extends Node = Node>(id: string): InternalNode<NodeType> | undefined;
10
30
  //# sourceMappingURL=useInternalNode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useInternalNode.d.ts","sourceRoot":"","sources":["../../src/hooks/useInternalNode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,GAAG,SAAS,CAO5G"}
1
+ {"version":3,"file":"useInternalNode.d.ts","sourceRoot":"","sources":["../../src/hooks/useInternalNode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,GAAG,SAAS,CAO5G"}
@@ -4,12 +4,30 @@ export type UseKeyPressOptions = {
4
4
  actInsideInputWithModifier?: boolean;
5
5
  };
6
6
  /**
7
- * Hook for handling key events.
7
+ * This hook lets you listen for specific key codes and tells you whether they are
8
+ * currently pressed or not.
8
9
  *
9
10
  * @public
10
11
  * @param param.keyCode - The key code (string or array of strings) to use
11
12
  * @param param.options - Options
12
13
  * @returns boolean
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ *import { useKeyPress } from '@xyflow/react';
18
+ *
19
+ *export default function () {
20
+ * const spacePressed = useKeyPress('Space');
21
+ * const cmdAndSPressed = useKeyPress(['Meta+s', 'Strg+s']);
22
+ *
23
+ * return (
24
+ * <div>
25
+ * {spacePressed && <p>Space pressed!</p>}
26
+ * {cmdAndSPressed && <p>Cmd + S pressed!</p>}
27
+ * </div>
28
+ * );
29
+ *}
30
+ *```
13
31
  */
14
32
  export declare function useKeyPress(keyCode?: KeyCode | null, options?: UseKeyPressOptions): boolean;
15
33
  //# sourceMappingURL=useKeyPress.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useKeyPress.d.ts","sourceRoot":"","sources":["../../src/hooks/useKeyPress.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IAC7D,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAIF;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAKzB,OAAO,GAAE,OAAO,GAAG,IAAW,EAC9B,OAAO,GAAE,kBAA6E,GACrF,OAAO,CAmGT"}
1
+ {"version":3,"file":"useKeyPress.d.ts","sourceRoot":"","sources":["../../src/hooks/useKeyPress.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IAC7D,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAOzB,OAAO,GAAE,OAAO,GAAG,IAAW,EAC9B,OAAO,GAAE,kBAA6E,GACrF,OAAO,CAuGT"}
@@ -1 +1 @@
1
- {"version":3,"file":"useMoveSelectedNodes.d.ts","sourceRoot":"","sources":["../../src/hooks/useMoveSelectedNodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAuC,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQtF;;;;;GAKG;AACH,wBAAgB,oBAAoB,aAGa;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,UA+CzF"}
1
+ {"version":3,"file":"useMoveSelectedNodes.d.ts","sourceRoot":"","sources":["../../src/hooks/useMoveSelectedNodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAuC,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQtF;;;;;GAKG;AACH,wBAAgB,oBAAoB,aAGa;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,UAiDzF"}
@@ -7,7 +7,7 @@ type UseNodeConnectionsParams = {
7
7
  onDisconnect?: (connections: Connection[]) => void;
8
8
  };
9
9
  /**
10
- * Hook to retrieve all edges connected to a node. Can be filtered by handle type and id.
10
+ * This hook returns an array of connections on a specific node, handle type ('source', 'target') or handle ID.
11
11
  *
12
12
  * @public
13
13
  * @param param.id - node id - optional if called inside a custom node
@@ -16,6 +16,22 @@ type UseNodeConnectionsParams = {
16
16
  * @param param.onConnect - gets called when a connection is established
17
17
  * @param param.onDisconnect - gets called when a connection is removed
18
18
  * @returns an array with connections
19
+ *
20
+ * @example
21
+ * ```jsx
22
+ *import { useNodeConnections } from '@xyflow/react';
23
+ *
24
+ *export default function () {
25
+ * const connections = useNodeConnections({
26
+ * type: 'target',
27
+ * handleId: 'my-handle',
28
+ * });
29
+ *
30
+ * return (
31
+ * <div>There are currently {connections.length} incoming connections!</div>
32
+ * );
33
+ *}
34
+ *```
19
35
  */
20
36
  export declare function useNodeConnections({ id, handleType, handleId, onConnect, onDisconnect, }?: UseNodeConnectionsParams): NodeConnection[];
21
37
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"useNodeConnections.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodeConnections.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,cAAc,EACd,UAAU,EAIX,MAAM,gBAAgB,CAAC;AAOxB,KAAK,wBAAwB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,EAAE,EACF,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,GACb,GAAE,wBAA6B,GAAG,cAAc,EAAE,CA8BlD"}
1
+ {"version":3,"file":"useNodeConnections.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodeConnections.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,cAAc,EACd,UAAU,EAIX,MAAM,gBAAgB,CAAC;AAOxB,KAAK,wBAAwB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,EAAE,EACF,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,GACb,GAAE,wBAA6B,GAAG,cAAc,EAAE,CA8BlD"}
@@ -1,9 +1,22 @@
1
1
  import type { Node } from '../types';
2
2
  /**
3
- * Hook for getting the current nodes from the store.
3
+ * This hook returns an array of the current nodes. Components that use this hook
4
+ * will re-render **whenever any node changes**, including when a node is selected
5
+ * or moved.
4
6
  *
5
7
  * @public
6
8
  * @returns An array of nodes
9
+ *
10
+ * @example
11
+ * ```jsx
12
+ *import { useNodes } from '@xyflow/react';
13
+ *
14
+ *export default function() {
15
+ * const nodes = useNodes();
16
+ *
17
+ * return <div>There are currently {nodes.length} nodes!</div>;
18
+ *}
19
+ *```
7
20
  */
8
21
  export declare function useNodes<NodeType extends Node = Node>(): NodeType[];
9
22
  //# sourceMappingURL=useNodes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNodes.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAIrD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,EAAE,CAInE"}
1
+ {"version":3,"file":"useNodes.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAIrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,EAAE,CAInE"}
@@ -1,11 +1,23 @@
1
1
  import type { Node } from '../types';
2
2
  /**
3
- * Hook for receiving data of one or multiple nodes
3
+ * This hook lets you subscribe to changes of a specific nodes `data` object.
4
4
  *
5
5
  * @public
6
6
  * @param nodeId - The id (or ids) of the node to get the data from
7
- * @param guard - Optional guard function to narrow down the node type
8
7
  * @returns An object (or array of object) with {id, type, data} representing each node
8
+ *
9
+ * @example
10
+ *
11
+ *```jsx
12
+ *import { useNodesData } from '@xyflow/react';
13
+ *
14
+ *export default function() {
15
+ * const nodeData = useNodesData('nodeId-1');
16
+ * const nodesData = useNodesData(['nodeId-1', 'nodeId-2']);
17
+ *
18
+ * return null;
19
+ *}
20
+ *```
9
21
  */
10
22
  export declare function useNodesData<NodeType extends Node = Node>(nodeId: string): Pick<NodeType, 'id' | 'type' | 'data'> | null;
11
23
  export declare function useNodesData<NodeType extends Node = Node>(nodeIds: string[]): Pick<NodeType, 'id' | 'type' | 'data'>[];
@@ -1 +1 @@
1
- {"version":3,"file":"useNodesData.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesData.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EACvD,MAAM,EAAE,MAAM,GACb,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC;AACjD,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC"}
1
+ {"version":3,"file":"useNodesData.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesData.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EACvD,MAAM,EAAE,MAAM,GACb,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC;AACjD,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC"}
@@ -1,19 +1,79 @@
1
1
  import { type Dispatch, type SetStateAction } from 'react';
2
2
  import type { Node, Edge, OnNodesChange, OnEdgesChange } from '../types';
3
3
  /**
4
- * Hook for managing the state of nodes - should only be used for prototyping / simple use cases.
4
+ * This hook makes it easy to prototype a controlled flow where you manage the
5
+ * state of nodes and edges outside the `ReactFlowInstance`. You can think of it
6
+ * like React's `useState` hook with an additional helper callback.
5
7
  *
6
8
  * @public
7
9
  * @param initialNodes
8
10
  * @returns an array [nodes, setNodes, onNodesChange]
11
+ * @example
12
+ *
13
+ *```tsx
14
+ *import { ReactFlow, useNodesState, useEdgesState } from '@xyflow/react';
15
+ *
16
+ *const initialNodes = [];
17
+ *const initialEdges = [];
18
+ *
19
+ *export default function () {
20
+ * const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
21
+ * const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
22
+ *
23
+ * return (
24
+ * <ReactFlow
25
+ * nodes={nodes}
26
+ * edges={edges}
27
+ * onNodesChange={onNodesChange}
28
+ * onEdgesChange={onEdgesChange}
29
+ * />
30
+ * );
31
+ *}
32
+ *```
33
+ *
34
+ * @remarks This hook was created to make prototyping easier and our documentation
35
+ * examples clearer. Although it is OK to use this hook in production, in
36
+ * practice you may want to use a more sophisticated state management solution
37
+ * like Zustand {@link https://reactflow.dev/docs/guides/state-management/} instead.
38
+ *
9
39
  */
10
40
  export declare function useNodesState<NodeType extends Node>(initialNodes: NodeType[]): [NodeType[], Dispatch<SetStateAction<NodeType[]>>, OnNodesChange<NodeType>];
11
41
  /**
12
- * Hook for managing the state of edges - should only be used for prototyping / simple use cases.
42
+ * This hook makes it easy to prototype a controlled flow where you manage the
43
+ * state of nodes and edges outside the `ReactFlowInstance`. You can think of it
44
+ * like React's `useState` hook with an additional helper callback.
13
45
  *
14
46
  * @public
15
47
  * @param initialEdges
16
48
  * @returns an array [edges, setEdges, onEdgesChange]
49
+ * @example
50
+ *
51
+ *```tsx
52
+ *import { ReactFlow, useNodesState, useEdgesState } from '@xyflow/react';
53
+ *
54
+ *const initialNodes = [];
55
+ *const initialEdges = [];
56
+ *
57
+ *export default function () {
58
+ * const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
59
+ * const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
60
+ *
61
+ * return (
62
+ * <ReactFlow
63
+ * nodes={nodes}
64
+ * edges={edges}
65
+ * onNodesChange={onNodesChange}
66
+ * onEdgesChange={onEdgesChange}
67
+ * />
68
+ * );
69
+ *}
70
+ *```
71
+ *
72
+ * @remarks This hook was created to make prototyping easier and our documentation
73
+ * examples clearer. Although it is OK to use this hook in production, in
74
+ * practice you may want to use a more sophisticated state management solution
75
+ * like Zustand {@link https://reactflow.dev/docs/guides/state-management/} instead.
76
+ *
17
77
  */
18
78
  export declare function useEdgesState<EdgeType extends Edge = Edge>(initialEdges: EdgeType[]): [EdgeType[], Dispatch<SetStateAction<EdgeType[]>>, OnEdgesChange<EdgeType>];
19
79
  //# sourceMappingURL=useNodesEdgesState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNodesEdgesState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesEdgesState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGlF,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzE;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,EACjD,YAAY,EAAE,QAAQ,EAAE,GACvB,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAQ7E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EACxD,YAAY,EAAE,QAAQ,EAAE,GACvB,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAQ7E"}
1
+ {"version":3,"file":"useNodesEdgesState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesEdgesState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGlF,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,EACjD,YAAY,EAAE,QAAQ,EAAE,GACvB,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAQ7E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EACxD,YAAY,EAAE,QAAQ,EAAE,GACvB,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAQ7E"}
@@ -2,11 +2,37 @@ export type UseNodesInitializedOptions = {
2
2
  includeHiddenNodes?: boolean;
3
3
  };
4
4
  /**
5
- * Hook which returns true when all nodes are initialized.
5
+ * This hook tells you whether all the nodes in a flow have been measured and given
6
+ *a width and height. When you add a node to the flow, this hook will return
7
+ *`false` and then `true` again once the node has been measured.
6
8
  *
7
9
  * @public
8
10
  * @param options.includeHiddenNodes - defaults to false
9
11
  * @returns boolean indicating whether all nodes are initialized
12
+ *
13
+ * @example
14
+ * ```jsx
15
+ *import { useReactFlow, useNodesInitialized } from '@xyflow/react';
16
+ *import { useEffect, useState } from 'react';
17
+ *
18
+ *const options = {
19
+ * includeHiddenNodes: false,
20
+ *};
21
+ *
22
+ *export default function useLayout() {
23
+ * const { getNodes } = useReactFlow();
24
+ * const nodesInitialized = useNodesInitialized(options);
25
+ * const [layoutedNodes, setLayoutedNodes] = useState(getNodes());
26
+ *
27
+ * useEffect(() => {
28
+ * if (nodesInitialized) {
29
+ * setLayoutedNodes(yourLayoutingFunction(getNodes()));
30
+ * }
31
+ * }, [nodesInitialized]);
32
+ *
33
+ * return layoutedNodes;
34
+ *}
35
+ *```
10
36
  */
11
37
  export declare function useNodesInitialized(options?: UseNodesInitializedOptions): boolean;
12
38
  //# sourceMappingURL=useNodesInitialized.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNodesInitialized.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesInitialized.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,0BAA0B,GAAG;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAsBF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,0BAA2C,GAAG,OAAO,CAIjG"}
1
+ {"version":3,"file":"useNodesInitialized.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesInitialized.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,0BAA0B,GAAG;IACvC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAkBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,0BAER,GACA,OAAO,CAIT"}
@@ -3,10 +3,42 @@ export type UseOnSelectionChangeOptions = {
3
3
  onChange: OnSelectionChangeFunc;
4
4
  };
5
5
  /**
6
- * Hook for registering an onSelectionChange handler.
6
+ * This hook lets you listen for changes to both node and edge selection. As the
7
+ *name implies, the callback you provide will be called whenever the selection of
8
+ *_either_ nodes or edges changes.
7
9
  *
8
10
  * @public
9
11
  * @param params.onChange - The handler to register
12
+ *
13
+ * @example
14
+ * ```jsx
15
+ *import { useState } from 'react';
16
+ *import { ReactFlow, useOnSelectionChange } from '@xyflow/react';
17
+ *
18
+ *function SelectionDisplay() {
19
+ * const [selectedNodes, setSelectedNodes] = useState([]);
20
+ * const [selectedEdges, setSelectedEdges] = useState([]);
21
+ *
22
+ * // the passed handler has to be memoized, otherwise the hook will not work correctly
23
+ * const onChange = useCallback(({ nodes, edges }) => {
24
+ * setSelectedNodes(nodes.map((node) => node.id));
25
+ * setSelectedEdges(edges.map((edge) => edge.id));
26
+ * }, []);
27
+ *
28
+ * useOnSelectionChange({
29
+ * onChange,
30
+ * });
31
+ *
32
+ * return (
33
+ * <div>
34
+ * <p>Selected nodes: {selectedNodes.join(', ')}</p>
35
+ * <p>Selected edges: {selectedEdges.join(', ')}</p>
36
+ * </div>
37
+ * );
38
+ *}
39
+ *```
40
+ *
41
+ * @remarks You need to memoize the passed `onChange` handler, otherwise the hook will not work correctly.
10
42
  */
11
43
  export declare function useOnSelectionChange({ onChange }: UseOnSelectionChangeOptions): void;
12
44
  //# sourceMappingURL=useOnSelectionChange.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useOnSelectionChange.d.ts","sourceRoot":"","sources":["../../src/hooks/useOnSelectionChange.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,qBAAqB,CAAC;CACjC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,2BAA2B,QAY7E"}
1
+ {"version":3,"file":"useOnSelectionChange.d.ts","sourceRoot":"","sources":["../../src/hooks/useOnSelectionChange.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEtD,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,qBAAqB,CAAC;CACjC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,2BAA2B,QAY7E"}
@@ -5,12 +5,30 @@ export type UseOnViewportChangeOptions = {
5
5
  onEnd?: OnViewportChange;
6
6
  };
7
7
  /**
8
- * Hook for registering an onViewportChange handler.
8
+ * The `useOnViewportChange` hook lets you listen for changes to the viewport such
9
+ *as panning and zooming. You can provide a callback for each phase of a viewport
10
+ *change: `onStart`, `onChange`, and `onEnd`.
9
11
  *
10
12
  * @public
11
13
  * @param params.onStart - gets called when the viewport starts changing
12
14
  * @param params.onChange - gets called when the viewport changes
13
15
  * @param params.onEnd - gets called when the viewport stops changing
16
+ *
17
+ * @example
18
+ * ```jsx
19
+ *import { useCallback } from 'react';
20
+ *import { useOnViewportChange } from '@xyflow/react';
21
+ *
22
+ *function ViewportChangeLogger() {
23
+ * useOnViewportChange({
24
+ * onStart: (viewport: Viewport) => console.log('start', viewport),
25
+ * onChange: (viewport: Viewport) => console.log('change', viewport),
26
+ * onEnd: (viewport: Viewport) => console.log('end', viewport),
27
+ * });
28
+ *
29
+ * return null;
30
+ *}
31
+ *```
14
32
  */
15
33
  export declare function useOnViewportChange({ onStart, onChange, onEnd }: UseOnViewportChangeOptions): void;
16
34
  //# sourceMappingURL=useOnViewportChange.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useOnViewportChange.d.ts","sourceRoot":"","sources":["../../src/hooks/useOnViewportChange.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIvD,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,0BAA0B,QAc3F"}
1
+ {"version":3,"file":"useOnViewportChange.d.ts","sourceRoot":"","sources":["../../src/hooks/useOnViewportChange.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIvD,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,0BAA0B,QAc3F"}
@@ -1,9 +1,32 @@
1
1
  import type { ReactFlowInstance, Node, Edge } from '../types';
2
2
  /**
3
- * Hook for accessing the ReactFlow instance.
3
+ * This hook returns a ReactFlowInstance that can be used to update nodes and edges, manipulate the viewport, or query the current state of the flow.
4
4
  *
5
5
  * @public
6
6
  * @returns ReactFlowInstance
7
+ *
8
+ * @example
9
+ * ```jsx
10
+ *import { useCallback, useState } from 'react';
11
+ *import { useReactFlow } from '@xyflow/react';
12
+ *
13
+ *export function NodeCounter() {
14
+ * const reactFlow = useReactFlow();
15
+ * const [count, setCount] = useState(0);
16
+ * const countNodes = useCallback(() => {
17
+ * setCount(reactFlow.getNodes().length);
18
+ * // you need to pass it as a dependency if you are using it with useEffect or useCallback
19
+ * // because at the first render, it's not initialized yet and some functions might not work.
20
+ * }, [reactFlow]);
21
+ *
22
+ * return (
23
+ * <div>
24
+ * <button onClick={countNodes}>Update count</button>
25
+ * <p>There are {count} nodes in the flow.</p>
26
+ * </div>
27
+ * );
28
+ *}
29
+ *```
7
30
  */
8
31
  export declare function useReactFlow<NodeType extends Node = Node, EdgeType extends Edge = Edge>(): ReactFlowInstance<NodeType, EdgeType>;
9
32
  //# sourceMappingURL=useReactFlow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useReactFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactFlow.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAgD,MAAM,UAAU,CAAC;AAI5G;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,iBAAiB,CAC3G,QAAQ,EACR,QAAQ,CACT,CAsOA"}
1
+ {"version":3,"file":"useReactFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactFlow.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAgD,MAAM,UAAU,CAAC;AAI5G;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,iBAAiB,CAC3G,QAAQ,EACR,QAAQ,CACT,CAsOA"}