@xyflow/react 12.4.2 → 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 +1089 -184
  94. package/dist/esm/index.mjs +1089 -184
  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,10 +1,41 @@
1
1
  import { ComponentType } from 'react';
2
2
  import { FitViewParamsBase, FitViewOptionsBase, ZoomInOut, ZoomTo, SetViewport, GetZoom, GetViewport, SetCenter, FitBounds, XYPosition, OnBeforeDeleteBase, Connection, NodeChange, EdgeChange } from '@xyflow/system';
3
3
  import type { Node, Edge, ReactFlowInstance, EdgeProps, NodeProps } from '.';
4
+ /**
5
+ * This type can be used to type the `onNodesChange` function with a custom node type.
6
+ *
7
+ * @public
8
+ *
9
+ * @example
10
+ *
11
+ * ```ts
12
+ * const onNodesChange: OnNodesChange<MyNodeType> = useCallback((changes) => {
13
+ * setNodes((nodes) => applyNodeChanges(nodes, changes));
14
+ * },[]);
15
+ * ```
16
+ */
4
17
  export type OnNodesChange<NodeType extends Node = Node> = (changes: NodeChange<NodeType>[]) => void;
18
+ /**
19
+ * This type can be used to type the `onEdgesChange` function with a custom edge type.
20
+ *
21
+ * @public
22
+ *
23
+ * @example
24
+ *
25
+ * ```ts
26
+ * const onEdgesChange: OnEdgesChange<MyEdgeType> = useCallback((changes) => {
27
+ * setEdges((edges) => applyEdgeChanges(edges, changes));
28
+ * },[]);
29
+ * ```
30
+ */
5
31
  export type OnEdgesChange<EdgeType extends Edge = Edge> = (changes: EdgeChange<EdgeType>[]) => void;
6
32
  export type OnNodesDelete<NodeType extends Node = Node> = (nodes: NodeType[]) => void;
7
33
  export type OnEdgesDelete<EdgeType extends Edge = Edge> = (edges: EdgeType[]) => void;
34
+ /**
35
+ * This type can be used to type the `onDelete` function with a custom node and edge type.
36
+ *
37
+ * @public
38
+ */
8
39
  export type OnDelete<NodeType extends Node = Node, EdgeType extends Edge = Edge> = (params: {
9
40
  nodes: NodeType[];
10
41
  edges: EdgeType[];
@@ -27,9 +58,19 @@ export type OnSelectionChangeParams = {
27
58
  };
28
59
  export type OnSelectionChangeFunc = (params: OnSelectionChangeParams) => void;
29
60
  export type FitViewParams<NodeType extends Node = Node> = FitViewParamsBase<NodeType>;
61
+ /**
62
+ * When calling [`fitView`](/api-reference/types/react-flow-instance#fitview) these options
63
+ * can be used to customize the behaviour. For example, the `duration` option can be used to
64
+ * transform the viewport smoothly over a given amount of time.
65
+ *
66
+ * @public
67
+ */
30
68
  export type FitViewOptions<NodeType extends Node = Node> = FitViewOptionsBase<NodeType>;
31
69
  export type FitView = (fitViewOptions?: FitViewOptions) => Promise<boolean>;
32
70
  export type OnInit<NodeType extends Node = Node, EdgeType extends Edge = Edge> = (reactFlowInstance: ReactFlowInstance<NodeType, EdgeType>) => void;
71
+ /**
72
+ * @inline
73
+ */
33
74
  export type ViewportHelperFunctions = {
34
75
  /**
35
76
  * Zooms viewport in by 1.2.
@@ -1 +1 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/types/general.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,WAAW,EACX,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,UAAU,EACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAE7E,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IA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
+ */
16
19
  export type GeneralHelpers<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
17
20
  /**
18
21
  * Returns nodes.
@@ -200,6 +203,14 @@ export type GeneralHelpers<NodeType extends Node = Node, EdgeType extends Edge =
200
203
  handleId?: string | null;
201
204
  }) => NodeConnection[];
202
205
  };
206
+ /**
207
+ * The `ReactFlowInstance` provides a collection of methods to query and manipulate
208
+ * the internal state of your flow. You can get an instance by using the
209
+ * [`useReactFlow`](/api-reference/hooks/use-react-flow) hook or attaching a listener
210
+ * to the [`onInit`](/api-reference/react-flow#event-oninit) event.
211
+ *
212
+ * @public
213
+ */
203
214
  export type ReactFlowInstance<NodeType extends Node = Node, EdgeType extends Edge = Edge> = GeneralHelpers<NodeType, EdgeType> & Omit<ViewportHelperFunctions, 'initialized'> & {
204
215
  viewportInitialized: boolean;
205
216
  };
@@ -1 +1 @@
1
- {"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../src/types/instance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,cAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,GAAG,CAAC;AAE3E,MAAM,MAAM,mBAAmB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IAC5F,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,CAAC,IAAI,GAAG;QAAE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC,EAAE,CAAC;IACtC,KAAK,CAAC,EAAE,CAAC,IAAI,GAAG;Q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AM,CAAC,EAAE,KAAK,IAAI,CAAC;IACtE;;;;;;;OAOG;IACH,oBAAoB,EAAE,CAAC,EACrB,IAAI,EACJ,EAAE,EACF,MAAM,GACP,EAAE;QACD,IAAI,EAAE,UAAU,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACpB,KAAK,gBAAgB,EAAE,CAAC;IACzB;;;;;;;OAOG;IACH,kBAAkB,EAAE,CAAC,EACnB,IAAI,EACJ,QAAQ,EACR,MAAM,GACP,EAAE;QACD,IAAI,CAAC,EAAE,UAAU,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC1B,KAAK,cAAc,EAAE,CAAC;CACxB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,cAAc,CACxG,QAAQ,EACR,QAAQ,CACT,GACC,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,GAAG;IAC7C,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC"}
@@ -2,7 +2,10 @@ import type { CSSProperties, MouseEvent as ReactMouseEvent } from 'react';
2
2
  import type { CoordinateExtent, NodeBase, OnError, NodeProps as NodePropsBase, InternalNodeBase } from '@xyflow/system';
3
3
  import { NodeTypes } from './general';
4
4
  /**
5
- * The node data structure that gets used for the nodes prop.
5
+ * The `Node` type represents everything React Flow needs to know about a given node.
6
+ * Whenever you want to update a certain attribute of a node, you need to create a new
7
+ * node object.
8
+ *
6
9
  * @public
7
10
  */
8
11
  export type Node<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string = string> = NodeBase<NodeData, NodeType> & {
@@ -12,9 +15,10 @@ export type Node<NodeData extends Record<string, unknown> = Record<string, unkno
12
15
  focusable?: boolean;
13
16
  };
14
17
  /**
15
- * The node data structure that gets used for internal nodes.
16
- * There are some data structures added under node.internal
17
- * that are needed for tracking some properties
18
+ * The `InternalNode` type is identical to the base [`Node`](/api-references/types/node)
19
+ * type but is extended with some additional properties used internally.
20
+ * Some functions and callbacks that return nodes may return an `InternalNode`.
21
+ *
18
22
  * @public
19
23
  */
20
24
  export type InternalNode<NodeType extends Node = Node> = InternalNodeBase<NodeType>;
@@ -43,8 +47,46 @@ export type NodeWrapperProps<NodeType extends Node> = {
43
47
  onError?: OnError;
44
48
  nodeClickDistance?: number;
45
49
  };
50
+ /**
51
+ * The `BuiltInNode` type represents the built-in node types that are available in React Flow.
52
+ * You can use this type to extend your custom node type if you still want ot use the built-in ones.
53
+ *
54
+ * @public
55
+ * @example
56
+ * ```ts
57
+ * type CustomNode = Node<{ value: number }, 'custom'>;
58
+ * type MyAppNode = CustomNode | BuiltInNode;
59
+ * ```
60
+ */
46
61
  export type BuiltInNode = Node<{
47
62
  label: string;
48
63
  }, 'input' | 'output' | 'default'> | Node<Record<string, never>, 'group'>;
64
+ /**
65
+ * When you implement a [custom node](/learn/customization/custom-nodes) it is
66
+ * wrapped in a component that enables basic functionality like selection and
67
+ * dragging. Your custom node receives `NodeProps` as props.
68
+ *
69
+ * @public
70
+ * @example
71
+ * ```tsx
72
+ *import { useState } from 'react';
73
+ *import { NodeProps, Node } from '@xyflow/react';
74
+ *
75
+ *export type CounterNode = Node<{ initialCount?: number }, 'counter'>;
76
+ *
77
+ *export default function CounterNode(props: NodeProps<CounterNode>) {
78
+ * const [count, setCount] = useState(props.data?.initialCount ?? 0);
79
+ *
80
+ * return (
81
+ * <div>
82
+ * <p>Count: {count}</p>
83
+ * <button className="nodrag" onClick={() => setCount(count + 1)}>
84
+ * Increment
85
+ * </button>
86
+ * </div>
87
+ * );
88
+ *}
89
+ *```
90
+ */
49
91
  export type NodeProps<NodeType extends Node = Node> = NodePropsBase<NodeType>;
50
92
  //# sourceMappingURL=nodes.d.ts.map
@@ -1 +1 @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,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC"}
@@ -3,43 +3,65 @@ import type { Node, Edge, InternalNode } from '../types';
3
3
  /**
4
4
  * Drop in function that applies node changes to an array of nodes.
5
5
  * @public
6
- * @remarks Various events on the <ReactFlow /> component can produce an {@link NodeChange} that describes how to update the edges of your flow in some way.
7
- If you don't need any custom behaviour, this util can be used to take an array of these changes and apply them to your edges.
8
6
  * @param changes - Array of changes to apply
9
7
  * @param nodes - Array of nodes to apply the changes to
10
8
  * @returns Array of updated nodes
11
9
  * @example
12
- * const onNodesChange = useCallback(
13
- (changes) => {
14
- setNodes((oldNodes) => applyNodeChanges(changes, oldNodes));
15
- },
16
- [setNodes],
17
- );
18
-
19
- return (
20
- <ReactFLow nodes={nodes} edges={edges} onNodesChange={onNodesChange} />
21
- );
10
+ *```tsx
11
+ *import { useState, useCallback } from 'react';
12
+ *import { ReactFlow, applyNodeChanges, type Node, type Edge, type OnNodesChange } from '@xyflow/react';
13
+ *
14
+ *export default function Flow() {
15
+ * const [nodes, setNodes] = useState<Node[]>([]);
16
+ * const [edges, setEdges] = useState<Edge[]>([]);
17
+ * const onNodesChange: OnNodesChange = useCallback(
18
+ * (changes) => {
19
+ * setNodes((oldNodes) => applyNodeChanges(changes, oldNodes));
20
+ * },
21
+ * [setNodes],
22
+ * );
23
+ *
24
+ * return (
25
+ * <ReactFlow nodes={nodes} edges={edges} onNodesChange={onNodesChange} />
26
+ * );
27
+ *}
28
+ *```
29
+ * @remarks Various events on the <ReactFlow /> component can produce an {@link NodeChange}
30
+ * that describes how to update the edges of your flow in some way.
31
+ * If you don't need any custom behaviour, this util can be used to take an array
32
+ * of these changes and apply them to your edges.
22
33
  */
23
34
  export declare function applyNodeChanges<NodeType extends Node = Node>(changes: NodeChange<NodeType>[], nodes: NodeType[]): NodeType[];
24
35
  /**
25
36
  * Drop in function that applies edge changes to an array of edges.
26
37
  * @public
27
- * @remarks Various events on the <ReactFlow /> component can produce an {@link EdgeChange} that describes how to update the edges of your flow in some way.
28
- If you don't need any custom behaviour, this util can be used to take an array of these changes and apply them to your edges.
29
38
  * @param changes - Array of changes to apply
30
39
  * @param edges - Array of edge to apply the changes to
31
40
  * @returns Array of updated edges
32
41
  * @example
42
+ * ```tsx
43
+ *import { useState, useCallback } from 'react';
44
+ *import { ReactFlow, applyEdgeChanges } from '@xyflow/react';
45
+ *
46
+ *export default function Flow() {
47
+ * const [nodes, setNodes] = useState([]);
48
+ * const [edges, setEdges] = useState([]);
33
49
  * const onEdgesChange = useCallback(
34
- (changes) => {
35
- setEdges((oldEdges) => applyEdgeChanges(changes, oldEdges));
36
- },
37
- [setEdges],
38
- );
39
-
40
- return (
41
- <ReactFlow nodes={nodes} edges={edges} onEdgesChange={onEdgesChange} />
42
- );
50
+ * (changes) => {
51
+ * setEdges((oldEdges) => applyEdgeChanges(changes, oldEdges));
52
+ * },
53
+ * [setEdges],
54
+ * );
55
+ *
56
+ * return (
57
+ * <ReactFlow nodes={nodes} edges={edges} onEdgesChange={onEdgesChange} />
58
+ * );
59
+ *}
60
+ *```
61
+ * @remarks Various events on the <ReactFlow /> component can produce an {@link EdgeChange}
62
+ * that describes how to update the edges of your flow in some way.
63
+ * If you don't need any custom behaviour, this util can be used to take an array
64
+ * of these changes and apply them to your edges.
43
65
  */
44
66
  export declare function applyEdgeChanges<EdgeType extends Edge = Edge>(changes: EdgeChange<EdgeType>[], edges: EdgeType[]): EdgeType[];
45
67
  export declare function createSelectionChange(id: string, selected: boolean): NodeSelectionChange | EdgeSelectionChange;
@@ -1 +1 @@
1
- {"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/utils/changes.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,IAAI,E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C,CAAC,CAAC;CACxC,GAAG,UAAU,EAAE,CAAC;AACjB,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAC;CACpB,GAAG,UAAU,EAAE,CAAC;AAmCjB,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,GAAG,gBAAgB,GAAG,gBAAgB,CAKzG"}
@@ -1,19 +1,43 @@
1
1
  import { type Ref, type RefAttributes } from 'react';
2
2
  import type { Edge, Node } from '../types';
3
3
  /**
4
- * Test whether an object is useable as a Node
4
+ * Test whether an object is useable as an [`Node`](/api-reference/types/node).
5
+ * In TypeScript this is a type guard that will narrow the type of whatever you pass in to
6
+ * [`Node`](/api-reference/types/node) if it returns `true`.
7
+ *
5
8
  * @public
6
9
  * @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Node if it returns true
7
10
  * @param element - The element to test
8
11
  * @returns A boolean indicating whether the element is an Node
12
+ *
13
+ * @example
14
+ * ```js
15
+ *import { isNode } from '@xyflow/react';
16
+ *
17
+ *if (isNode(node)) {
18
+ * // ..
19
+ *}
20
+ *```
9
21
  */
10
22
  export declare const isNode: <NodeType extends Node = Node>(element: unknown) => element is NodeType;
11
23
  /**
12
- * Test whether an object is useable as an Edge
24
+ * Test whether an object is useable as an [`Edge`](/api-reference/types/edge).
25
+ * In TypeScript this is a type guard that will narrow the type of whatever you pass in to
26
+ * [`Edge`](/api-reference/types/edge) if it returns `true`.
27
+ *
13
28
  * @public
14
29
  * @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Edge if it returns true
15
30
  * @param element - The element to test
16
31
  * @returns A boolean indicating whether the element is an Edge
32
+ *
33
+ * @example
34
+ * ```js
35
+ *import { isEdge } from '@xyflow/react';
36
+ *
37
+ *if (isEdge(edge)) {
38
+ * // ..
39
+ *}
40
+ *```
17
41
  */
18
42
  export declare const isEdge: <EdgeType extends Edge = Edge>(element: unknown) => element is EdgeType;
19
43
  export declare function fixedForwardRef<T, P = {}>(render: (props: P, ref: Ref<T>) => JSX.Element): (props: P & RefAttributes<T>) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/utils/general.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,aAAa,EAAc,MAAM,OAAO,CAAC;AAGjE,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,0CAA2C,OAAO,wBACtC,CAAC;AAEhC;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,0CAA2C,OAAO,wBACtC,CAAC;AAGhC,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EACvC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,GAC7C,CAAC,KAAK,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAG9C"}
1
+ {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/utils/general.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,aAAa,EAAc,MAAM,OAAO,CAAC;AAGjE,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAE3C;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,0CAA2C,OAAO,wBACtC,CAAC;AAEhC;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,MAAM,0CAA2C,OAAO,wBACtC,CAAC;AAGhC,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,EACvC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,GAC7C,CAAC,KAAK,EAAE,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,OAAO,CAG9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyflow/react",
3
- "version": "12.4.2",
3
+ "version": "12.4.3",
4
4
  "description": "React Flow - A highly customizable React library for building node-based editors and interactive flow charts.",
5
5
  "keywords": [
6
6
  "react",
@@ -28,6 +28,7 @@
28
28
  "module": "dist/esm/index.js",
29
29
  "types": "dist/esm/index.d.ts",
30
30
  "exports": {
31
+ "./package.json": "./package.json",
31
32
  ".": {
32
33
  "node": {
33
34
  "types": "./dist/esm/index.d.ts",
@@ -54,7 +55,7 @@
54
55
  "dependencies": {
55
56
  "classcat": "^5.0.3",
56
57
  "zustand": "^4.4.0",
57
- "@xyflow/system": "0.0.50"
58
+ "@xyflow/system": "0.0.51"
58
59
  },
59
60
  "peerDependencies": {
60
61
  "react": ">=17",
@@ -74,7 +75,7 @@
74
75
  "postcss-rename": "^0.6.1",
75
76
  "react": "^18.2.0",
76
77
  "typescript": "5.1.3",
77
- "@xyflow/eslint-config": "0.0.0",
78
+ "@xyflow/eslint-config": "0.0.1",
78
79
  "@xyflow/rollup-config": "0.0.0",
79
80
  "@xyflow/tsconfig": "0.0.0"
80
81
  },