chore(tsdocs): cleanup

This commit is contained in:
moklick
2025-02-12 14:42:12 +01:00
parent c3dc6d3851
commit 0b06491ef9
9 changed files with 68 additions and 14 deletions
@@ -3,6 +3,9 @@ import type { PanelPosition } from '@xyflow/system';
import type { FitViewOptions } from '../../types'; import type { FitViewOptions } from '../../types';
/**
* @expand
*/
export type ControlProps = { export type ControlProps = {
/** Show button for zoom in/out */ /** Show button for zoom in/out */
showZoom?: boolean; showZoom?: boolean;
@@ -35,4 +38,7 @@ export type ControlProps = {
orientation?: 'horizontal' | 'vertical'; orientation?: 'horizontal' | 'vertical';
}; };
/**
* @expand
*/
export type ControlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>; export type ControlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
@@ -6,6 +6,9 @@ import type { Node } from '../../types';
export type GetMiniMapNodeAttribute<NodeType extends Node = Node> = (node: NodeType) => string; export type GetMiniMapNodeAttribute<NodeType extends Node = Node> = (node: NodeType) => string;
/**
* @expand
*/
export type MiniMapProps<NodeType extends Node = Node> = Omit<HTMLAttributes<SVGSVGElement>, 'onClick'> & { export type MiniMapProps<NodeType extends Node = Node> = Omit<HTMLAttributes<SVGSVGElement>, 'onClick'> & {
/** Color of nodes on minimap */ /** Color of nodes on minimap */
nodeColor?: string | GetMiniMapNodeAttribute<NodeType>; nodeColor?: string | GetMiniMapNodeAttribute<NodeType>;
@@ -62,6 +65,7 @@ export type MiniMapNodes<NodeType extends Node = Node> = Pick<
* The props that are passed to the MiniMapNode component * The props that are passed to the MiniMapNode component
* *
* @public * @public
* @expand
*/ */
export type MiniMapNodeProps = { export type MiniMapNodeProps = {
id: string; id: string;
@@ -9,6 +9,9 @@ import type {
OnResizeEnd, OnResizeEnd,
} from '@xyflow/system'; } from '@xyflow/system';
/**
* @expand
*/
export type NodeResizerProps = { export type NodeResizerProps = {
/** /**
* Id of the node it is resizing * Id of the node it is resizing
@@ -47,6 +50,9 @@ export type NodeResizerProps = {
onResizeEnd?: OnResizeEnd; onResizeEnd?: OnResizeEnd;
}; };
/**
* @expand
*/
export type ResizeControlProps = Pick< export type ResizeControlProps = Pick<
NodeResizerProps, NodeResizerProps,
| 'nodeId' | 'nodeId'
@@ -77,6 +83,9 @@ export type ResizeControlProps = Pick<
children?: ReactNode; children?: ReactNode;
}; };
/**
* @expand
*/
export type ResizeControlLineProps = ResizeControlProps & { export type ResizeControlLineProps = ResizeControlProps & {
position?: ControlLinePosition; position?: ControlLinePosition;
}; };
@@ -1,6 +1,9 @@
import type { HTMLAttributes } from 'react'; import type { HTMLAttributes } from 'react';
import type { Position, Align } from '@xyflow/system'; import type { Position, Align } from '@xyflow/system';
/**
* @expand
*/
export type NodeToolbarProps = HTMLAttributes<HTMLDivElement> & { export type NodeToolbarProps = HTMLAttributes<HTMLDivElement> & {
/** Id of the node, or array of ids the toolbar should be displayed at */ /** Id of the node, or array of ids the toolbar should be displayed at */
nodeId?: string | string[]; nodeId?: string | string[];
@@ -28,10 +28,14 @@ import { useNodeId } from '../../contexts/NodeIdContext';
import { type ReactFlowState } from '../../types'; import { type ReactFlowState } from '../../types';
import { fixedForwardRef } from '../../utils'; import { fixedForwardRef } from '../../utils';
export interface HandleProps extends HandlePropsSystem, Omit<HTMLAttributes<HTMLDivElement>, 'id'> { /**
/** Callback called when connection is made */ * @expand
onConnect?: OnConnect; */
} export type HandleProps = HandlePropsSystem &
Omit<HTMLAttributes<HTMLDivElement>, 'id'> & {
/** Callback called when connection is made */
onConnect?: OnConnect;
};
const selector = (s: ReactFlowState) => ({ const selector = (s: ReactFlowState) => ({
connectOnClick: s.connectOnClick, connectOnClick: s.connectOnClick,
+13 -10
View File
@@ -5,6 +5,19 @@ import type { PanelPosition } from '@xyflow/system';
import { useStore } from '../../hooks/useStore'; import { useStore } from '../../hooks/useStore';
import type { ReactFlowState } from '../../types'; import type { ReactFlowState } from '../../types';
/**
* @expand
*/
export type PanelProps = HTMLAttributes<HTMLDivElement> & {
/**
* The position of the panel
*/
position?: PanelPosition;
children: ReactNode;
};
const selector = (s: ReactFlowState) => (s.userSelectionActive ? 'none' : 'all');
/** /**
* The `<Panel />` component helps you position content above the viewport. * The `<Panel />` component helps you position content above the viewport.
* It is used internally by the [`<MiniMap />`](/api-reference/components/minimap) * It is used internally by the [`<MiniMap />`](/api-reference/components/minimap)
@@ -30,16 +43,6 @@ import type { ReactFlowState } from '../../types';
*} *}
*``` *```
*/ */
export type PanelProps = HTMLAttributes<HTMLDivElement> & {
/**
* The position of the panel
*/
position?: PanelPosition;
children: ReactNode;
};
const selector = (s: ReactFlowState) => (s.userSelectionActive ? 'none' : 'all');
export const Panel = forwardRef<HTMLDivElement, PanelProps>( export const Panel = forwardRef<HTMLDivElement, PanelProps>(
({ position = 'top-left', children, className, style, ...rest }, ref) => { ({ position = 'top-left', children, className, style, ...rest }, ref) => {
const pointerEvents = useStore(selector); const pointerEvents = useStore(selector);
+7
View File
@@ -132,6 +132,7 @@ export type EdgeProps<EdgeType extends Edge = Edge> = Pick<
/** /**
* BaseEdge component props * BaseEdge component props
* @public * @public
* @expand
*/ */
export type BaseEdgeProps = Omit<SVGAttributes<SVGPathElement>, 'd'> & export type BaseEdgeProps = Omit<SVGAttributes<SVGPathElement>, 'd'> &
EdgeLabelOptions & { EdgeLabelOptions & {
@@ -148,6 +149,7 @@ export type BaseEdgeProps = Omit<SVGAttributes<SVGPathElement>, 'd'> &
/** /**
* Helper type for edge components that get exported by the library * Helper type for edge components that get exported by the library
* @public * @public
* @expand
*/ */
export type EdgeComponentProps = EdgePosition & export type EdgeComponentProps = EdgePosition &
EdgeLabelOptions & { EdgeLabelOptions & {
@@ -167,30 +169,35 @@ export type EdgeComponentWithPathOptions<PathOptions> = EdgeComponentProps & {
/** /**
* BezierEdge component props * BezierEdge component props
* @public * @public
* @expand
*/ */
export type BezierEdgeProps = EdgeComponentWithPathOptions<BezierPathOptions>; export type BezierEdgeProps = EdgeComponentWithPathOptions<BezierPathOptions>;
/** /**
* SmoothStepEdge component props * SmoothStepEdge component props
* @public * @public
* @expand
*/ */
export type SmoothStepEdgeProps = EdgeComponentWithPathOptions<SmoothStepPathOptions>; export type SmoothStepEdgeProps = EdgeComponentWithPathOptions<SmoothStepPathOptions>;
/** /**
* StepEdge component props * StepEdge component props
* @public * @public
* @expand
*/ */
export type StepEdgeProps = EdgeComponentWithPathOptions<StepPathOptions>; export type StepEdgeProps = EdgeComponentWithPathOptions<StepPathOptions>;
/** /**
* StraightEdge component props * StraightEdge component props
* @public * @public
* @expand
*/ */
export type StraightEdgeProps = Omit<EdgeComponentProps, 'sourcePosition' | 'targetPosition'>; export type StraightEdgeProps = Omit<EdgeComponentProps, 'sourcePosition' | 'targetPosition'>;
/** /**
* SimpleBezier component props * SimpleBezier component props
* @public * @public
* @expand
*/ */
export type SimpleBezierEdgeProps = EdgeComponentProps; export type SimpleBezierEdgeProps = EdgeComponentProps;
+3
View File
@@ -118,6 +118,9 @@ export type MarkerProps = EdgeMarker & {
id: string; id: string;
}; };
/**
* @inline
*/
export type EdgePosition = { export type EdgePosition = {
sourceX: number; sourceX: number;
sourceY: number; sourceY: number;
+15
View File
@@ -11,10 +11,25 @@ export type ResizeParamsWithDirection = ResizeParams & {
direction: number[]; direction: number[];
}; };
/**
* Used to determine the control line position of the NodeResizer
*
* @public
*/
export type ControlLinePosition = 'top' | 'bottom' | 'left' | 'right'; export type ControlLinePosition = 'top' | 'bottom' | 'left' | 'right';
/**
* Used to determine the control position of the NodeResizer
*
* @public
*/
export type ControlPosition = ControlLinePosition | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'; export type ControlPosition = ControlLinePosition | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
/**
* Used to determine the variant of the resize control
*
* @public
*/
export enum ResizeControlVariant { export enum ResizeControlVariant {
Line = 'line', Line = 'line',
Handle = 'handle', Handle = 'handle',