@xyflow/react 12.5.3 → 12.5.5

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 (114) hide show
  1. package/dist/base.css +2 -2
  2. package/dist/esm/additional-components/Background/types.d.ts +9 -9
  3. package/dist/esm/additional-components/Background/types.d.ts.map +1 -1
  4. package/dist/esm/additional-components/MiniMap/MiniMapNodes.d.ts.map +1 -1
  5. package/dist/esm/additional-components/MiniMap/types.d.ts +65 -19
  6. package/dist/esm/additional-components/MiniMap/types.d.ts.map +1 -1
  7. package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
  8. package/dist/esm/additional-components/NodeResizer/types.d.ts +37 -18
  9. package/dist/esm/additional-components/NodeResizer/types.d.ts.map +1 -1
  10. package/dist/esm/additional-components/NodeToolbar/types.d.ts +6 -5
  11. package/dist/esm/additional-components/NodeToolbar/types.d.ts.map +1 -1
  12. package/dist/esm/components/Edges/SimpleBezierEdge.d.ts +10 -0
  13. package/dist/esm/components/Edges/SimpleBezierEdge.d.ts.map +1 -1
  14. package/dist/esm/components/Panel/index.d.ts +5 -5
  15. package/dist/esm/components/Panel/index.d.ts.map +1 -1
  16. package/dist/esm/contexts/NodeIdContext.d.ts +1 -1
  17. package/dist/esm/hooks/useConnection.d.ts +4 -0
  18. package/dist/esm/hooks/useConnection.d.ts.map +1 -1
  19. package/dist/esm/hooks/useEdges.d.ts +1 -1
  20. package/dist/esm/hooks/useHandleConnections.d.ts +8 -8
  21. package/dist/esm/hooks/useHandleConnections.d.ts.map +1 -1
  22. package/dist/esm/hooks/useInternalNode.d.ts +2 -2
  23. package/dist/esm/hooks/useKeyPress.d.ts +23 -4
  24. package/dist/esm/hooks/useKeyPress.d.ts.map +1 -1
  25. package/dist/esm/hooks/useNodeConnections.d.ts +6 -6
  26. package/dist/esm/hooks/useNodeConnections.d.ts.map +1 -1
  27. package/dist/esm/hooks/useNodes.d.ts +1 -1
  28. package/dist/esm/hooks/useNodesData.d.ts +7 -5
  29. package/dist/esm/hooks/useNodesData.d.ts.map +1 -1
  30. package/dist/esm/hooks/useNodesEdgesState.d.ts +32 -6
  31. package/dist/esm/hooks/useNodesEdgesState.d.ts.map +1 -1
  32. package/dist/esm/hooks/useNodesInitialized.d.ts +3 -2
  33. package/dist/esm/hooks/useNodesInitialized.d.ts.map +1 -1
  34. package/dist/esm/hooks/useOnSelectionChange.d.ts +1 -2
  35. package/dist/esm/hooks/useOnSelectionChange.d.ts.map +1 -1
  36. package/dist/esm/hooks/useOnViewportChange.d.ts +5 -6
  37. package/dist/esm/hooks/useOnViewportChange.d.ts.map +1 -1
  38. package/dist/esm/hooks/useReactFlow.d.ts +0 -2
  39. package/dist/esm/hooks/useReactFlow.d.ts.map +1 -1
  40. package/dist/esm/hooks/useStore.d.ts +8 -5
  41. package/dist/esm/hooks/useStore.d.ts.map +1 -1
  42. package/dist/esm/hooks/useUpdateNodeInternals.d.ts +5 -4
  43. package/dist/esm/hooks/useUpdateNodeInternals.d.ts.map +1 -1
  44. package/dist/esm/hooks/useViewport.d.ts +3 -3
  45. package/dist/esm/index.js +103 -74
  46. package/dist/esm/index.mjs +103 -74
  47. package/dist/esm/types/component-props.d.ts +234 -116
  48. package/dist/esm/types/component-props.d.ts.map +1 -1
  49. package/dist/esm/types/edges.d.ts +26 -8
  50. package/dist/esm/types/edges.d.ts.map +1 -1
  51. package/dist/esm/types/general.d.ts +11 -6
  52. package/dist/esm/types/general.d.ts.map +1 -1
  53. package/dist/esm/types/instance.d.ts +23 -8
  54. package/dist/esm/types/instance.d.ts.map +1 -1
  55. package/dist/esm/utils/changes.d.ts +6 -6
  56. package/dist/esm/utils/general.d.ts +11 -7
  57. package/dist/esm/utils/general.d.ts.map +1 -1
  58. package/dist/style.css +2 -2
  59. package/dist/umd/additional-components/Background/types.d.ts +9 -9
  60. package/dist/umd/additional-components/Background/types.d.ts.map +1 -1
  61. package/dist/umd/additional-components/MiniMap/MiniMapNodes.d.ts.map +1 -1
  62. package/dist/umd/additional-components/MiniMap/types.d.ts +65 -19
  63. package/dist/umd/additional-components/MiniMap/types.d.ts.map +1 -1
  64. package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
  65. package/dist/umd/additional-components/NodeResizer/types.d.ts +37 -18
  66. package/dist/umd/additional-components/NodeResizer/types.d.ts.map +1 -1
  67. package/dist/umd/additional-components/NodeToolbar/types.d.ts +6 -5
  68. package/dist/umd/additional-components/NodeToolbar/types.d.ts.map +1 -1
  69. package/dist/umd/components/Edges/SimpleBezierEdge.d.ts +10 -0
  70. package/dist/umd/components/Edges/SimpleBezierEdge.d.ts.map +1 -1
  71. package/dist/umd/components/Panel/index.d.ts +5 -5
  72. package/dist/umd/components/Panel/index.d.ts.map +1 -1
  73. package/dist/umd/contexts/NodeIdContext.d.ts +1 -1
  74. package/dist/umd/hooks/useConnection.d.ts +4 -0
  75. package/dist/umd/hooks/useConnection.d.ts.map +1 -1
  76. package/dist/umd/hooks/useEdges.d.ts +1 -1
  77. package/dist/umd/hooks/useHandleConnections.d.ts +8 -8
  78. package/dist/umd/hooks/useHandleConnections.d.ts.map +1 -1
  79. package/dist/umd/hooks/useInternalNode.d.ts +2 -2
  80. package/dist/umd/hooks/useKeyPress.d.ts +23 -4
  81. package/dist/umd/hooks/useKeyPress.d.ts.map +1 -1
  82. package/dist/umd/hooks/useNodeConnections.d.ts +6 -6
  83. package/dist/umd/hooks/useNodeConnections.d.ts.map +1 -1
  84. package/dist/umd/hooks/useNodes.d.ts +1 -1
  85. package/dist/umd/hooks/useNodesData.d.ts +7 -5
  86. package/dist/umd/hooks/useNodesData.d.ts.map +1 -1
  87. package/dist/umd/hooks/useNodesEdgesState.d.ts +32 -6
  88. package/dist/umd/hooks/useNodesEdgesState.d.ts.map +1 -1
  89. package/dist/umd/hooks/useNodesInitialized.d.ts +3 -2
  90. package/dist/umd/hooks/useNodesInitialized.d.ts.map +1 -1
  91. package/dist/umd/hooks/useOnSelectionChange.d.ts +1 -2
  92. package/dist/umd/hooks/useOnSelectionChange.d.ts.map +1 -1
  93. package/dist/umd/hooks/useOnViewportChange.d.ts +5 -6
  94. package/dist/umd/hooks/useOnViewportChange.d.ts.map +1 -1
  95. package/dist/umd/hooks/useReactFlow.d.ts +0 -2
  96. package/dist/umd/hooks/useReactFlow.d.ts.map +1 -1
  97. package/dist/umd/hooks/useStore.d.ts +8 -5
  98. package/dist/umd/hooks/useStore.d.ts.map +1 -1
  99. package/dist/umd/hooks/useUpdateNodeInternals.d.ts +5 -4
  100. package/dist/umd/hooks/useUpdateNodeInternals.d.ts.map +1 -1
  101. package/dist/umd/hooks/useViewport.d.ts +3 -3
  102. package/dist/umd/index.js +2 -2
  103. package/dist/umd/types/component-props.d.ts +234 -116
  104. package/dist/umd/types/component-props.d.ts.map +1 -1
  105. package/dist/umd/types/edges.d.ts +26 -8
  106. package/dist/umd/types/edges.d.ts.map +1 -1
  107. package/dist/umd/types/general.d.ts +11 -6
  108. package/dist/umd/types/general.d.ts.map +1 -1
  109. package/dist/umd/types/instance.d.ts +23 -8
  110. package/dist/umd/types/instance.d.ts.map +1 -1
  111. package/dist/umd/utils/changes.d.ts +6 -6
  112. package/dist/umd/utils/general.d.ts +11 -7
  113. package/dist/umd/utils/general.d.ts.map +1 -1
  114. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"NodeResizeControl.d.ts","sourceRoot":"","sources":["../../../src/additional-components/NodeResizer/NodeResizeControl.tsx"],"names":[],"mappings":";AAmBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAE1E,iBAAS,aAAa,CAAC,EACrB,MAAM,EACN,QAAQ,EACR,OAAqC,EACrC,SAAS,EACT,KAAU,EACV,QAAQ,EACR,KAAK,EACL,QAAa,EACb,SAAc,EACd,QAA2B,EAC3B,SAA4B,EAC5B,eAAuB,EACvB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,GACZ,EAAE,kBAAkB,2CAiKpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAE9D;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,2DAAsB,CAAC"}
1
+ {"version":3,"file":"NodeResizeControl.d.ts","sourceRoot":"","sources":["../../../src/additional-components/NodeResizer/NodeResizeControl.tsx"],"names":[],"mappings":";AAmBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAE1E,iBAAS,aAAa,CAAC,EACrB,MAAM,EACN,QAAQ,EACR,OAAqC,EACrC,SAAS,EACT,KAAU,EACV,QAAQ,EACR,KAAK,EACL,QAAa,EACb,SAAc,EACd,QAA2B,EAC3B,SAA4B,EAC5B,eAAuB,EACvB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,GACZ,EAAE,kBAAkB,2CAqKpB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,2CAE9D;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,2DAAsB,CAAC"}
@@ -5,39 +5,57 @@ import type { ControlPosition, ControlLinePosition, ResizeControlVariant, Should
5
5
  */
6
6
  export type NodeResizerProps = {
7
7
  /**
8
- * Id of the node it is resizing
8
+ * Id of the node it is resizing.
9
9
  * @remarks optional if used inside custom node
10
10
  */
11
11
  nodeId?: string;
12
- /** Color of the resize handle */
12
+ /** Color of the resize handle. */
13
13
  color?: string;
14
- /** ClassName applied to handle */
14
+ /** Class name applied to handle. */
15
15
  handleClassName?: string;
16
- /** Style applied to handle */
16
+ /** Style applied to handle. */
17
17
  handleStyle?: CSSProperties;
18
- /** ClassName applied to line */
18
+ /** Class name applied to line. */
19
19
  lineClassName?: string;
20
- /** Style applied to line */
20
+ /** Style applied to line. */
21
21
  lineStyle?: CSSProperties;
22
- /** Are the controls visible */
22
+ /**
23
+ * Are the controls visible.
24
+ * @default true
25
+ */
23
26
  isVisible?: boolean;
24
- /** Minimum width of node */
27
+ /**
28
+ * Minimum width of node.
29
+ * @default 10
30
+ */
25
31
  minWidth?: number;
26
- /** Minimum height of node */
32
+ /**
33
+ * Minimum height of node.
34
+ * @default 10
35
+ */
27
36
  minHeight?: number;
28
- /** Maximum width of node */
37
+ /**
38
+ * Maximum width of node.
39
+ * @default Number.MAX_VALUE
40
+ */
29
41
  maxWidth?: number;
30
- /** Maximum height of node */
42
+ /**
43
+ * Maximum height of node.
44
+ * @default Number.MAX_VALUE
45
+ */
31
46
  maxHeight?: number;
32
- /** Keep aspect ratio when resizing */
47
+ /**
48
+ * Keep aspect ratio when resizing.
49
+ * @default false
50
+ */
33
51
  keepAspectRatio?: boolean;
34
- /** Callback to determine if node should resize */
52
+ /** Callback to determine if node should resize. */
35
53
  shouldResize?: ShouldResize;
36
- /** Callback called when resizing starts */
54
+ /** Callback called when resizing starts. */
37
55
  onResizeStart?: OnResizeStart;
38
- /** Callback called when resizing */
56
+ /** Callback called when resizing. */
39
57
  onResize?: OnResize;
40
- /** Callback called when resizing ends */
58
+ /** Callback called when resizing ends. */
41
59
  onResizeEnd?: OnResizeEnd;
42
60
  };
43
61
  /**
@@ -45,13 +63,14 @@ export type NodeResizerProps = {
45
63
  */
46
64
  export type ResizeControlProps = Pick<NodeResizerProps, 'nodeId' | 'color' | 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight' | 'keepAspectRatio' | 'shouldResize' | 'onResizeStart' | 'onResize' | 'onResizeEnd'> & {
47
65
  /**
48
- * Position of the control
66
+ * Position of the control.
49
67
  * @example ControlPosition.TopLeft, ControlPosition.TopRight,
50
68
  * ControlPosition.BottomLeft, ControlPosition.BottomRight
51
69
  */
52
70
  position?: ControlPosition;
53
71
  /**
54
- * Variant of the control
72
+ * Variant of the control.
73
+ * @default "handle"
55
74
  * @example ResizeControlVariant.Handle, ResizeControlVariant.Line
56
75
  */
57
76
  variant?: ResizeControlVariant;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/NodeResizer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,gCAAgC;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,+BAA+B;IAC/B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,kDAAkD;IAClD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,2CAA2C;IAC3C,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,oCAAoC;IACpC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,yCAAyC;IACzC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,gBAAgB,EACd,QAAQ,GACR,OAAO,GACP,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,UAAU,GACV,aAAa,CAChB,GAAG;IACF;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;IACxD,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/NodeResizer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,mDAAmD;IACnD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,4CAA4C;IAC5C,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,gBAAgB,EACd,QAAQ,GACR,OAAO,GACP,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,UAAU,GACV,aAAa,CAChB,GAAG;IACF;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;IACxD,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC,CAAC"}
@@ -9,12 +9,12 @@ export type NodeToolbarProps = HTMLAttributes<HTMLDivElement> & {
9
9
  * of nodes.
10
10
  */
11
11
  nodeId?: string | string[];
12
- /** If true, node toolbar is visible even if node is not selected */
12
+ /** If `true`, node toolbar is visible even if node is not selected. */
13
13
  isVisible?: boolean;
14
14
  /**
15
- * Position of the toolbar relative to the node
16
- * @example Position.TopLeft, Position.TopRight,
17
- * Position.BottomLeft, Position.BottomRight
15
+ * Position of the toolbar relative to the node.
16
+ * @default Position.Top
17
+ * @example Position.TopLeft, Position.TopRight, Position.BottomLeft, Position.BottomRight
18
18
  */
19
19
  position?: Position;
20
20
  /**
@@ -23,7 +23,8 @@ export type NodeToolbarProps = HTMLAttributes<HTMLDivElement> & {
23
23
  */
24
24
  offset?: number;
25
25
  /**
26
- * Align the toolbar relative to the node
26
+ * Align the toolbar relative to the node.
27
+ * @default "center"
27
28
  * @example Align.Start, Align.Center, Align.End
28
29
  */
29
30
  align?: Align;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/NodeToolbar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,oEAAoE;IACpE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/additional-components/NodeToolbar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,uEAAuE;IACvE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC"}
@@ -4,15 +4,25 @@ import type { SimpleBezierEdgeProps } from '../../types';
4
4
  export interface GetSimpleBezierPathParams {
5
5
  sourceX: number;
6
6
  sourceY: number;
7
+ /** @default Position.Bottom */
7
8
  sourcePosition?: Position;
8
9
  targetX: number;
9
10
  targetY: number;
11
+ /** @default Position.Top */
10
12
  targetPosition?: Position;
11
13
  }
12
14
  /**
13
15
  * The `getSimpleBezierPath` util returns everything you need to render a simple
14
16
  * bezier edge between two nodes.
15
17
  * @public
18
+ * @returns
19
+ * - `path`: the path to use in an SVG `<path>` element.
20
+ * - `labelX`: the `x` position you can use to render a label for this edge.
21
+ * - `labelY`: the `y` position you can use to render a label for this edge.
22
+ * - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
23
+ * middle of this path.
24
+ * - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
25
+ * middle of this path.
16
26
  */
17
27
  export declare function getSimpleBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, }: GetSimpleBezierPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number];
18
28
  declare const SimpleBezierEdge: import("react").MemoExoticComponent<({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, label, labelStyle, labelShowBg, labelBgStyle, labelBgPadding, labelBgBorderRadius, style, markerEnd, markerStart, interactionWidth, }: SimpleBezierEdgeProps) => import("react/jsx-runtime").JSX.Element>;
@@ -1 +1 @@
1
- {"version":3,"file":"SimpleBezierEdge.d.ts","sourceRoot":"","sources":["../../../src/components/Edges/SimpleBezierEdge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAuB,MAAM,gBAAgB,CAAC;AAG/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAkBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,GAC9B,EAAE,yBAAyB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAiC9G;AAyDD,QAAA,MAAM,gBAAgB,wPAlCf,qBAAqB,6CAkC0C,CAAC;AACvE,QAAA,MAAM,wBAAwB,wPAnCvB,qBAAqB,6CAmCiD,CAAC;AAK9E,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,CAAC"}
1
+ {"version":3,"file":"SimpleBezierEdge.d.ts","sourceRoot":"","sources":["../../../src/components/Edges/SimpleBezierEdge.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAuB,MAAM,gBAAgB,CAAC;AAG/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,cAAc,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAkBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,GAC9B,EAAE,yBAAyB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAiC9G;AAyDD,QAAA,MAAM,gBAAgB,wPAlCf,qBAAqB,6CAkC0C,CAAC;AACvE,QAAA,MAAM,wBAAwB,wPAnCvB,qBAAqB,6CAmCiD,CAAC;AAK9E,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,CAAC"}
@@ -1,14 +1,14 @@
1
- import { type HTMLAttributes, type ReactNode } from 'react';
1
+ import { HTMLAttributes } from 'react';
2
2
  import type { PanelPosition } from '@xyflow/system';
3
3
  /**
4
4
  * @expand
5
5
  */
6
6
  export type PanelProps = HTMLAttributes<HTMLDivElement> & {
7
7
  /**
8
- * The position of the panel
8
+ * The position of the panel.
9
+ * @default "top-left"
9
10
  */
10
11
  position?: PanelPosition;
11
- children: ReactNode;
12
12
  };
13
13
  /**
14
14
  * The `<Panel />` component helps you position content above the viewport.
@@ -37,9 +37,9 @@ export type PanelProps = HTMLAttributes<HTMLDivElement> & {
37
37
  */
38
38
  export declare const Panel: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
39
39
  /**
40
- * The position of the panel
40
+ * The position of the panel.
41
+ * @default "top-left"
41
42
  */
42
43
  position?: PanelPosition | undefined;
43
- children: ReactNode;
44
44
  } & import("react").RefAttributes<HTMLDivElement>>;
45
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKpD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACxD;;OAEG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,KAAK;IAlChB;;OAEG;;cAEO,SAAS;kDA8CpB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAc,MAAM,OAAO,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKpD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACxD;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,KAAK;IAlChB;;;OAGG;;kDA+CJ,CAAC"}
@@ -8,7 +8,7 @@ export declare const Consumer: import("react").Consumer<string | null>;
8
8
  * drill down the id as a prop.
9
9
  *
10
10
  * @public
11
- * @returns id of the node
11
+ * @returns The id for a node in the flow.
12
12
  *
13
13
  * @example
14
14
  *```jsx
@@ -7,6 +7,10 @@ import type { InternalNode, Node } from '../types';
7
7
  * based on a certain condition (e.g. if the connection is valid or not).
8
8
  *
9
9
  * @public
10
+ * @param connectionSelector - An optional selector function used to extract a slice of the
11
+ * `ConnectionState` data. Using a selector can prevent component re-renders where data you don't
12
+ * otherwise care about might change. If a selector is not provided, the entire `ConnectionState`
13
+ * object is returned unchanged.
10
14
  * @example
11
15
  *
12
16
  * ```tsx
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;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
+ {"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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;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"}
@@ -4,7 +4,7 @@ import type { Edge } from '../types';
4
4
  * will re-render **whenever any edge changes**.
5
5
  *
6
6
  * @public
7
- * @returns An array of edges
7
+ * @returns An array of all edges currently in the flow.
8
8
  *
9
9
  * @example
10
10
  * ```tsx
@@ -1,9 +1,14 @@
1
1
  import { Connection, HandleConnection, HandleType } from '@xyflow/system';
2
- type useHandleConnectionsParams = {
2
+ type UseHandleConnectionsParams = {
3
+ /** What type of handle connections do you want to observe? */
3
4
  type: HandleType;
5
+ /** The handle id (this is only needed if the node has multiple handles of the same type). */
4
6
  id?: string | null;
7
+ /** If node id is not provided, the node id from the `NodeIdContext` is used. */
5
8
  nodeId?: string;
9
+ /** Gets called when a connection is established. */
6
10
  onConnect?: (connections: Connection[]) => void;
11
+ /** Gets called when a connection is removed. */
7
12
  onDisconnect?: (connections: Connection[]) => void;
8
13
  };
9
14
  /**
@@ -11,13 +16,8 @@ type useHandleConnectionsParams = {
11
16
  *
12
17
  * @public
13
18
  * @deprecated Use `useNodeConnections` instead.
14
- * @param param.type - handle type 'source' or 'target'
15
- * @param param.nodeId - node id - if not provided, the node id from the NodeIdContext is used
16
- * @param param.id - the handle id (this is only needed if the node has multiple handles of the same type)
17
- * @param param.onConnect - gets called when a connection is established
18
- * @param param.onDisconnect - gets called when a connection is removed
19
- * @returns an array with handle connections
19
+ * @returns An array with handle connections.
20
20
  */
21
- export declare function useHandleConnections({ type, id, nodeId, onConnect, onDisconnect, }: useHandleConnectionsParams): HandleConnection[];
21
+ export declare function useHandleConnections({ type, id, nodeId, onConnect, onDisconnect, }: UseHandleConnectionsParams): HandleConnection[];
22
22
  export {};
23
23
  //# sourceMappingURL=useHandleConnections.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useHandleConnections.d.ts","sourceRoot":"","sources":["../../src/hooks/useHandleConnections.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EAGX,MAAM,gBAAgB,CAAC;AAKxB,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,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;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,EAAE,EACF,MAAM,EACN,SAAS,EACT,YAAY,GACb,EAAE,0BAA0B,GAAG,gBAAgB,EAAE,CA2BjD"}
1
+ {"version":3,"file":"useHandleConnections.d.ts","sourceRoot":"","sources":["../../src/hooks/useHandleConnections.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EAGX,MAAM,gBAAgB,CAAC;AAKxB,KAAK,0BAA0B,GAAG;IAChC,8DAA8D;IAC9D,IAAI,EAAE,UAAU,CAAC;IACjB,6FAA6F;IAC7F,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,gFAAgF;IAChF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAChD,gDAAgD;IAChD,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,EAAE,EACF,MAAM,EACN,SAAS,EACT,YAAY,GACb,EAAE,0BAA0B,GAAG,gBAAgB,EAAE,CA2BjD"}
@@ -5,8 +5,8 @@ import type { InternalNode, Node } from '../types';
5
5
  * including when a node is selected or moved.
6
6
  *
7
7
  * @public
8
- * @param id - id of the node
9
- * @returns array with visible node ids
8
+ * @param id - The ID of a node you want to observe.
9
+ * @returns The `InternalNode` object for the node with the given ID.
10
10
  *
11
11
  * @example
12
12
  * ```tsx
@@ -1,6 +1,14 @@
1
1
  import { type KeyCode } from '@xyflow/system';
2
2
  export type UseKeyPressOptions = {
3
+ /**
4
+ * Listen to key presses on a specific element.
5
+ * @default document
6
+ */
3
7
  target?: Window | Document | HTMLElement | ShadowRoot | null;
8
+ /**
9
+ * You can use this flag to prevent triggering the key press hook when an input field is focused.
10
+ * @default true
11
+ */
4
12
  actInsideInputWithModifier?: boolean;
5
13
  preventDefault?: boolean;
6
14
  };
@@ -9,9 +17,7 @@ export type UseKeyPressOptions = {
9
17
  * currently pressed or not.
10
18
  *
11
19
  * @public
12
- * @param param.keyCode - The key code (string or array of strings) to use
13
- * @param param.options - Options
14
- * @returns boolean
20
+ * @param options - Options
15
21
  *
16
22
  * @example
17
23
  * ```tsx
@@ -30,5 +36,18 @@ export type UseKeyPressOptions = {
30
36
  *}
31
37
  *```
32
38
  */
33
- export declare function useKeyPress(keyCode?: KeyCode | null, options?: UseKeyPressOptions): boolean;
39
+ export declare function useKeyPress(
40
+ /**
41
+ * The key code (string or array of strings) specifies which key(s) should trigger
42
+ * an action.
43
+ *
44
+ * A **string** can represent:
45
+ * - A **single key**, e.g. `'a'`
46
+ * - A **key combination**, using `'+'` to separate keys, e.g. `'a+d'`
47
+ *
48
+ * An **array of strings** represents **multiple possible key inputs**. For example, `['a', 'd+s']`
49
+ * means the user can press either the single key `'a'` or the combination of `'d'` and `'s'`.
50
+ * @default null
51
+ */
52
+ keyCode?: KeyCode | null, options?: UseKeyPressOptions): boolean;
34
53
  //# 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;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAOzB,OAAO,GAAE,OAAO,GAAG,IAAW,EAC9B,OAAO,GAAE,kBAA6E,GACrF,OAAO,CAsGT"}
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;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IAC7D;;;OAGG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW;AACzB;;;;;;;;;;;GAWG;AACH,OAAO,GAAE,OAAO,GAAG,IAAW,EAC9B,OAAO,GAAE,kBAA6E,GACrF,OAAO,CAsGT"}
@@ -1,21 +1,21 @@
1
1
  import { Connection, NodeConnection, HandleType } from '@xyflow/system';
2
2
  type UseNodeConnectionsParams = {
3
+ /** ID of the node, filled in automatically if used inside custom node. */
3
4
  id?: string;
5
+ /** What type of handle connections do you want to observe? */
4
6
  handleType?: HandleType;
7
+ /** Filter by handle id (this is only needed if the node has multiple handles of the same type). */
5
8
  handleId?: string;
9
+ /** Gets called when a connection is established. */
6
10
  onConnect?: (connections: Connection[]) => void;
11
+ /** Gets called when a connection is removed. */
7
12
  onDisconnect?: (connections: Connection[]) => void;
8
13
  };
9
14
  /**
10
15
  * This hook returns an array of connections on a specific node, handle type ('source', 'target') or handle ID.
11
16
  *
12
17
  * @public
13
- * @param param.id - node id - optional if called inside a custom node
14
- * @param param.handleType - filter by handle type 'source' or 'target'
15
- * @param param.handleId - filter by handle id (this is only needed if the node has multiple handles of the same type)
16
- * @param param.onConnect - gets called when a connection is established
17
- * @param param.onDisconnect - gets called when a connection is removed
18
- * @returns an array with connections
18
+ * @returns An array with connections.
19
19
  *
20
20
  * @example
21
21
  * ```jsx
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;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,0EAA0E;IAC1E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,8DAA8D;IAC9D,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAChD,gDAAgD;IAChD,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,EAAE,EACF,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,GACb,GAAE,wBAA6B,GAAG,cAAc,EAAE,CA8BlD"}
@@ -5,7 +5,7 @@ import type { Node } from '../types';
5
5
  * or moved.
6
6
  *
7
7
  * @public
8
- * @returns An array of nodes
8
+ * @returns An array of all nodes currently in the flow.
9
9
  *
10
10
  * @example
11
11
  * ```jsx
@@ -3,11 +3,9 @@ import type { Node } from '../types';
3
3
  * This hook lets you subscribe to changes of a specific nodes `data` object.
4
4
  *
5
5
  * @public
6
- * @param nodeId - The id (or ids) of the node to get the data from
7
- * @returns An object (or array of object) with {id, type, data} representing each node
6
+ * @returns An object (or array of object) with `id`, `type`, `data` representing each node.
8
7
  *
9
8
  * @example
10
- *
11
9
  *```jsx
12
10
  *import { useNodesData } from '@xyflow/react';
13
11
  *
@@ -19,6 +17,10 @@ import type { Node } from '../types';
19
17
  *}
20
18
  *```
21
19
  */
22
- export declare function useNodesData<NodeType extends Node = Node>(nodeId: string): Pick<NodeType, 'id' | 'type' | 'data'> | null;
23
- export declare function useNodesData<NodeType extends Node = Node>(nodeIds: string[]): Pick<NodeType, 'id' | 'type' | 'data'>[];
20
+ export declare function useNodesData<NodeType extends Node = Node>(
21
+ /** The id of the node to get the data from. */
22
+ nodeId: string): Pick<NodeType, 'id' | 'type' | 'data'> | null;
23
+ export declare function useNodesData<NodeType extends Node = Node>(
24
+ /** The ids of the nodes to get the data from. */
25
+ nodeIds: string[]): Pick<NodeType, 'id' | 'type' | 'data'>[];
24
26
  //# sourceMappingURL=useNodesData.d.ts.map
@@ -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;;;;;;;;;;;;;;;;;;;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
+ {"version":3,"file":"useNodesData.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesData.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI;AACvD,+CAA+C;AAC/C,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;AACvD,iDAAiD;AACjD,OAAO,EAAE,MAAM,EAAE,GAChB,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC"}
@@ -6,8 +6,16 @@ import type { Node, Edge, OnNodesChange, OnEdgesChange } from '../types';
6
6
  * like React's `useState` hook with an additional helper callback.
7
7
  *
8
8
  * @public
9
- * @param initialNodes
10
- * @returns an array [nodes, setNodes, onNodesChange]
9
+ * @returns
10
+ * - `nodes`: The current array of nodes. You might pass this directly to the `nodes` prop of your
11
+ * `<ReactFlow />` component, or you may want to manipulate it first to perform some layouting,
12
+ * for example.
13
+ * - `setNodes`: A function that you can use to update the nodes. You can pass it a new array of
14
+ * nodes or a callback that receives the current array of nodes and returns a new array of nodes.
15
+ * This is the same as the second element of the tuple returned by React's `useState` hook.
16
+ * - `onNodesChange`: A handy callback that can take an array of `NodeChanges` and update the nodes
17
+ * state accordingly. You'll typically pass this directly to the `onNodesChange` prop of your
18
+ * `<ReactFlow />` component.
11
19
  * @example
12
20
  *
13
21
  *```tsx
@@ -37,15 +45,29 @@ import type { Node, Edge, OnNodesChange, OnEdgesChange } from '../types';
37
45
  * like Zustand {@link https://reactflow.dev/docs/guides/state-management/} instead.
38
46
  *
39
47
  */
40
- export declare function useNodesState<NodeType extends Node>(initialNodes: NodeType[]): [NodeType[], Dispatch<SetStateAction<NodeType[]>>, OnNodesChange<NodeType>];
48
+ export declare function useNodesState<NodeType extends Node>(initialNodes: NodeType[]): [
49
+ nodes: NodeType[],
50
+ setNodes: Dispatch<SetStateAction<NodeType[]>>,
51
+ onNodesChange: OnNodesChange<NodeType>
52
+ ];
41
53
  /**
42
54
  * This hook makes it easy to prototype a controlled flow where you manage the
43
55
  * state of nodes and edges outside the `ReactFlowInstance`. You can think of it
44
56
  * like React's `useState` hook with an additional helper callback.
45
57
  *
46
58
  * @public
47
- * @param initialEdges
48
- * @returns an array [edges, setEdges, onEdgesChange]
59
+ * @returns
60
+ * - `edges`: The current array of edges. You might pass this directly to the `edges` prop of your
61
+ * `<ReactFlow />` component, or you may want to manipulate it first to perform some layouting,
62
+ * for example.
63
+ *
64
+ * - `setEdges`: A function that you can use to update the edges. You can pass it a new array of
65
+ * edges or a callback that receives the current array of edges and returns a new array of edges.
66
+ * This is the same as the second element of the tuple returned by React's `useState` hook.
67
+ *
68
+ * - `onEdgesChange`: A handy callback that can take an array of `EdgeChanges` and update the edges
69
+ * state accordingly. You'll typically pass this directly to the `onEdgesChange` prop of your
70
+ * `<ReactFlow />` component.
49
71
  * @example
50
72
  *
51
73
  *```tsx
@@ -75,5 +97,9 @@ export declare function useNodesState<NodeType extends Node>(initialNodes: NodeT
75
97
  * like Zustand {@link https://reactflow.dev/docs/guides/state-management/} instead.
76
98
  *
77
99
  */
78
- export declare function useEdgesState<EdgeType extends Edge = Edge>(initialEdges: EdgeType[]): [EdgeType[], Dispatch<SetStateAction<EdgeType[]>>, OnEdgesChange<EdgeType>];
100
+ export declare function useEdgesState<EdgeType extends Edge = Edge>(initialEdges: EdgeType[]): [
101
+ edges: EdgeType[],
102
+ setEdges: Dispatch<SetStateAction<EdgeType[]>>,
103
+ onEdgesChange: OnEdgesChange<EdgeType>
104
+ ];
79
105
  //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,EACjD,YAAY,EAAE,QAAQ,EAAE,GACvB;IAED,KAAK,EAAE,QAAQ,EAAE;IACjB,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9C,aAAa,EAAE,aAAa,CAAC,QAAQ,CAAC;CACvC,CAQA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EACxD,YAAY,EAAE,QAAQ,EAAE,GACvB;IAED,KAAK,EAAE,QAAQ,EAAE;IACjB,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9C,aAAa,EAAE,aAAa,CAAC,QAAQ,CAAC;CACvC,CAQA"}
@@ -1,4 +1,5 @@
1
1
  export type UseNodesInitializedOptions = {
2
+ /** @default false */
2
3
  includeHiddenNodes?: boolean;
3
4
  };
4
5
  /**
@@ -7,8 +8,8 @@ export type UseNodesInitializedOptions = {
7
8
  *`false` and then `true` again once the node has been measured.
8
9
  *
9
10
  * @public
10
- * @param options.includeHiddenNodes - defaults to false
11
- * @returns boolean indicating whether all nodes are initialized
11
+ * @returns Whether or not the nodes have been initialized by the `<ReactFlow />` component and
12
+ * given a width and height.
12
13
  *
13
14
  * @example
14
15
  * ```jsx
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"useNodesInitialized.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesInitialized.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,0BAA0B,GAAG;IACvC,qBAAqB;IACrB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAkBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,0BAER,GACA,OAAO,CAIT"}
@@ -1,5 +1,6 @@
1
1
  import type { OnSelectionChangeFunc, Node, Edge } from '../types';
2
2
  export type UseOnSelectionChangeOptions<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
3
+ /** The handler to register. */
3
4
  onChange: OnSelectionChangeFunc<NodeType, EdgeType>;
4
5
  };
5
6
  /**
@@ -8,8 +9,6 @@ export type UseOnSelectionChangeOptions<NodeType extends Node = Node, EdgeType e
8
9
  *_either_ nodes or edges changes.
9
10
  *
10
11
  * @public
11
- * @param params.onChange - The handler to register
12
- *
13
12
  * @example
14
13
  * ```jsx
15
14
  *import { useState } from 'react';
@@ -1 +1 @@
1
- {"version":3,"file":"useOnSelectionChange.d.ts","sourceRoot":"","sources":["../../src/hooks/useOnSelectionChange.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAElE,MAAM,MAAM,2BAA2B,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IACpG,QAAQ,EAAE,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EAC/F,QAAQ,GACT,EAAE,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAYjD"}
1
+ {"version":3,"file":"useOnSelectionChange.d.ts","sourceRoot":"","sources":["../../src/hooks/useOnSelectionChange.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAElE,MAAM,MAAM,2BAA2B,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IACpG,+BAA+B;IAC/B,QAAQ,EAAE,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EAC/F,QAAQ,GACT,EAAE,2BAA2B,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAYjD"}
@@ -1,19 +1,18 @@
1
1
  import type { OnViewportChange } from '@xyflow/system';
2
2
  export type UseOnViewportChangeOptions = {
3
+ /** Gets called when the viewport starts changing. */
3
4
  onStart?: OnViewportChange;
5
+ /** Gets called when the viewport changes. */
4
6
  onChange?: OnViewportChange;
7
+ /** Gets called when the viewport stops changing. */
5
8
  onEnd?: OnViewportChange;
6
9
  };
7
10
  /**
8
11
  * 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`.
12
+ * as panning and zooming. You can provide a callback for each phase of a viewport
13
+ * change: `onStart`, `onChange`, and `onEnd`.
11
14
  *
12
15
  * @public
13
- * @param params.onStart - gets called when the viewport starts changing
14
- * @param params.onChange - gets called when the viewport changes
15
- * @param params.onEnd - gets called when the viewport stops changing
16
- *
17
16
  * @example
18
17
  * ```jsx
19
18
  *import { useCallback } from 'react';
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;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,qDAAqD;IACrD,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,oDAAoD;IACpD,KAAK,CAAC,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,0BAA0B,QAc3F"}
@@ -3,8 +3,6 @@ import type { ReactFlowInstance, Node, Edge } from '../types';
3
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
- * @returns ReactFlowInstance
7
- *
8
6
  * @example
9
7
  * ```jsx
10
8
  *import { useCallback, useState } from 'react';
@@ -1 +1 @@
1
- {"version":3,"file":"useReactFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactFlow.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,iBAAiB,EACjB,IAAI,EACJ,IAAI,EAKL,MAAM,UAAU,CAAC;AAIlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,iBAAiB,CAC3G,QAAQ,EACR,QAAQ,CACT,CAiPA"}
1
+ {"version":3,"file":"useReactFlow.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactFlow.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACV,iBAAiB,EACjB,IAAI,EACJ,IAAI,EAKL,MAAM,UAAU,CAAC;AAIlB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,iBAAiB,CAC3G,QAAQ,EACR,QAAQ,CACT,CAiPA"}
@@ -5,9 +5,13 @@ import type { Edge, Node, ReactFlowState } from '../types';
5
5
  * state management library, so you should check out their docs for more details.
6
6
  *
7
7
  * @public
8
- * @param selector
9
- * @param equalityFn
10
- * @returns The selected state slice
8
+ * @param selector - A selector function that returns a slice of the flow's internal state.
9
+ * Extracting or transforming just the state you need is a good practice to avoid unnecessary
10
+ * re-renders.
11
+ * @param equalityFn - A function to compare the previous and next value. This is incredibly useful
12
+ * for preventing unnecessary re-renders. Good sensible defaults are using `Object.is` or importing
13
+ * `zustand/shallow`, but you can be as granular as you like.
14
+ * @returns The selected state slice.
11
15
  *
12
16
  * @example
13
17
  * ```ts
@@ -22,8 +26,7 @@ declare function useStore<StateSlice = unknown>(selector: (state: ReactFlowState
22
26
  /**
23
27
  * In some cases, you might need to access the store directly. This hook returns the store object which can be used on demand to access the state or dispatch actions.
24
28
  *
25
- * @returns The store object
26
- *
29
+ * @returns The store object.
27
30
  * @example
28
31
  * ```ts
29
32
  * const store = useStoreApi();