Merge pull request #5137 from dimaMachina/tsdoc-3

fix: improve TSDoc comments for `Connection` and `ConnectionInProgress`
This commit is contained in:
Moritz Klack
2025-04-02 13:22:39 +02:00
committed by GitHub
2 changed files with 22 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
'@xyflow/system': patch
---
fix: improve TSDoc comments for `Connection` and `ConnectionInProgress`

View File

@@ -33,9 +33,13 @@ export type FitBounds = (bounds: Rect, options?: FitBoundsOptions) => Promise<bo
* @public
*/
export type Connection = {
/** The id of the node this connection originates from. */
source: string;
/** The id of the node this connection terminates at. */
target: string;
/** When not `null`, the id of the handle on the source node that this connection originates from. */
sourceHandle: string | null;
/** When not `null`, the id of the handle on the target node that this connection terminates at. */
targetHandle: string | null;
};
@@ -240,15 +244,28 @@ export type NoConnection = {
toNode: null;
};
export type ConnectionInProgress<NodeType extends InternalNodeBase = InternalNodeBase> = {
/** Indicates whether a connection is currently in progress. */
inProgress: true;
/**
* If an ongoing connection is above a handle or inside the connection radius, this will be `true`
* or `false`, otherwise `null`.
*/
isValid: boolean | null;
/** Returns the xy start position or `null` if no connection is in progress. */
from: XYPosition;
/** Returns the start handle or `null` if no connection is in progress. */
fromHandle: Handle;
/** Returns the side (called position) of the start handle or `null` if no connection is in progress. */
fromPosition: Position;
/** Returns the start node or `null` if no connection is in progress. */
fromNode: NodeType;
/** Returns the xy end position or `null` if no connection is in progress. */
to: XYPosition;
/** Returns the end handle or `null` if no connection is in progress. */
toHandle: Handle | null;
/** Returns the side (called position) of the end handle or `null` if no connection is in progress. */
toPosition: Position;
/** Returns the end node or `null` if no connection is in progress. */
toNode: NodeType | null;
};