Improve TSDoc comments for interface GetSimpleBezierPathParams and getSimpleBezierPath
This commit is contained in:
5
.changeset/tall-dryers-smell.md
Normal file
5
.changeset/tall-dryers-smell.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@xyflow/react': patch
|
||||
---
|
||||
|
||||
Improve TSDoc comments for `interface GetSimpleBezierPathParams` and `getSimpleBezierPath`
|
||||
@@ -7,9 +7,11 @@ import type { SimpleBezierEdgeProps } from '../../types';
|
||||
export interface GetSimpleBezierPathParams {
|
||||
sourceX: number;
|
||||
sourceY: number;
|
||||
/** @default Position.Bottom */
|
||||
sourcePosition?: Position;
|
||||
targetX: number;
|
||||
targetY: number;
|
||||
/** @default Position.Top */
|
||||
targetPosition?: Position;
|
||||
}
|
||||
|
||||
@@ -33,6 +35,14 @@ function getControl({ pos, x1, y1, x2, y2 }: GetControlParams): [number, number]
|
||||
* The `getSimpleBezierPath` util returns everything you need to render a simple
|
||||
* bezier edge between two nodes.
|
||||
* @public
|
||||
* @returns
|
||||
* - `path`: the path to use in an SVG `<path>` element.
|
||||
* - `labelX`: the `x` position you can use to render a label for this edge.
|
||||
* - `labelY`: the `y` position you can use to render a label for this edge.
|
||||
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
||||
* middle of this path.
|
||||
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
||||
* middle of this path.
|
||||
*/
|
||||
export function getSimpleBezierPath({
|
||||
sourceX,
|
||||
@@ -85,8 +95,8 @@ function createSimpleBezierEdge(params: { isInternal: boolean }) {
|
||||
sourceY,
|
||||
targetX,
|
||||
targetY,
|
||||
sourcePosition = Position.Bottom,
|
||||
targetPosition = Position.Top,
|
||||
sourcePosition,
|
||||
targetPosition,
|
||||
label,
|
||||
labelStyle,
|
||||
labelShowBg,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useStore, useStoreApi } from '../../hooks/useStore';
|
||||
import type { Node, Edge, ReactFlowState, ReactFlowProps, FitViewOptions } from '../../types';
|
||||
import { defaultNodeOrigin } from '../../container/ReactFlow/init-values';
|
||||
|
||||
// these fields exist in the global store and we need to keep them up to date
|
||||
// These fields exist in the global store, and we need to keep them up to date
|
||||
const reactFlowFieldsToTrack = [
|
||||
'nodes',
|
||||
'edges',
|
||||
|
||||
@@ -147,9 +147,9 @@ function applyChange(change: any, element: any): any {
|
||||
/**
|
||||
* Drop in function that applies node changes to an array of nodes.
|
||||
* @public
|
||||
* @param changes - Array of changes to apply
|
||||
* @param nodes - Array of nodes to apply the changes to
|
||||
* @returns Array of updated nodes
|
||||
* @param changes - Array of changes to apply.
|
||||
* @param nodes - Array of nodes to apply the changes to.
|
||||
* @returns Array of updated nodes.
|
||||
* @example
|
||||
*```tsx
|
||||
*import { useState, useCallback } from 'react';
|
||||
@@ -185,9 +185,9 @@ export function applyNodeChanges<NodeType extends Node = Node>(
|
||||
/**
|
||||
* Drop in function that applies edge changes to an array of edges.
|
||||
* @public
|
||||
* @param changes - Array of changes to apply
|
||||
* @param edges - Array of edge to apply the changes to
|
||||
* @returns Array of updated edges
|
||||
* @param changes - Array of changes to apply.
|
||||
* @param edges - Array of edge to apply the changes to.
|
||||
* @returns Array of updated edges.
|
||||
* @example
|
||||
* ```tsx
|
||||
*import { useState, useCallback } from 'react';
|
||||
|
||||
Reference in New Issue
Block a user