From 0b06491ef9c139d13c8ea73a26c1b18070fe0381 Mon Sep 17 00:00:00 2001 From: moklick Date: Wed, 12 Feb 2025 14:42:12 +0100 Subject: [PATCH] chore(tsdocs): cleanup --- .../additional-components/Controls/types.ts | 6 +++++ .../additional-components/MiniMap/types.ts | 4 ++++ .../NodeResizer/types.ts | 9 ++++++++ .../NodeToolbar/types.ts | 3 +++ .../react/src/components/Handle/index.tsx | 12 ++++++---- packages/react/src/components/Panel/index.tsx | 23 +++++++++++-------- packages/react/src/types/edges.ts | 7 ++++++ packages/system/src/types/edges.ts | 3 +++ packages/system/src/xyresizer/types.ts | 15 ++++++++++++ 9 files changed, 68 insertions(+), 14 deletions(-) diff --git a/packages/react/src/additional-components/Controls/types.ts b/packages/react/src/additional-components/Controls/types.ts index c36275d9..bccd1117 100644 --- a/packages/react/src/additional-components/Controls/types.ts +++ b/packages/react/src/additional-components/Controls/types.ts @@ -3,6 +3,9 @@ import type { PanelPosition } from '@xyflow/system'; import type { FitViewOptions } from '../../types'; +/** + * @expand + */ export type ControlProps = { /** Show button for zoom in/out */ showZoom?: boolean; @@ -35,4 +38,7 @@ export type ControlProps = { orientation?: 'horizontal' | 'vertical'; }; +/** + * @expand + */ export type ControlButtonProps = ButtonHTMLAttributes; diff --git a/packages/react/src/additional-components/MiniMap/types.ts b/packages/react/src/additional-components/MiniMap/types.ts index 351395f9..8416f835 100644 --- a/packages/react/src/additional-components/MiniMap/types.ts +++ b/packages/react/src/additional-components/MiniMap/types.ts @@ -6,6 +6,9 @@ import type { Node } from '../../types'; export type GetMiniMapNodeAttribute = (node: NodeType) => string; +/** + * @expand + */ export type MiniMapProps = Omit, 'onClick'> & { /** Color of nodes on minimap */ nodeColor?: string | GetMiniMapNodeAttribute; @@ -62,6 +65,7 @@ export type MiniMapNodes = Pick< * The props that are passed to the MiniMapNode component * * @public + * @expand */ export type MiniMapNodeProps = { id: string; diff --git a/packages/react/src/additional-components/NodeResizer/types.ts b/packages/react/src/additional-components/NodeResizer/types.ts index 2d1a7c15..1295440f 100644 --- a/packages/react/src/additional-components/NodeResizer/types.ts +++ b/packages/react/src/additional-components/NodeResizer/types.ts @@ -9,6 +9,9 @@ import type { OnResizeEnd, } from '@xyflow/system'; +/** + * @expand + */ export type NodeResizerProps = { /** * Id of the node it is resizing @@ -47,6 +50,9 @@ export type NodeResizerProps = { onResizeEnd?: OnResizeEnd; }; +/** + * @expand + */ export type ResizeControlProps = Pick< NodeResizerProps, | 'nodeId' @@ -77,6 +83,9 @@ export type ResizeControlProps = Pick< children?: ReactNode; }; +/** + * @expand + */ export type ResizeControlLineProps = ResizeControlProps & { position?: ControlLinePosition; }; diff --git a/packages/react/src/additional-components/NodeToolbar/types.ts b/packages/react/src/additional-components/NodeToolbar/types.ts index 00bec37c..91a717da 100644 --- a/packages/react/src/additional-components/NodeToolbar/types.ts +++ b/packages/react/src/additional-components/NodeToolbar/types.ts @@ -1,6 +1,9 @@ import type { HTMLAttributes } from 'react'; import type { Position, Align } from '@xyflow/system'; +/** + * @expand + */ export type NodeToolbarProps = HTMLAttributes & { /** Id of the node, or array of ids the toolbar should be displayed at */ nodeId?: string | string[]; diff --git a/packages/react/src/components/Handle/index.tsx b/packages/react/src/components/Handle/index.tsx index 72e7ad21..df7b428b 100644 --- a/packages/react/src/components/Handle/index.tsx +++ b/packages/react/src/components/Handle/index.tsx @@ -28,10 +28,14 @@ import { useNodeId } from '../../contexts/NodeIdContext'; import { type ReactFlowState } from '../../types'; import { fixedForwardRef } from '../../utils'; -export interface HandleProps extends HandlePropsSystem, Omit, 'id'> { - /** Callback called when connection is made */ - onConnect?: OnConnect; -} +/** + * @expand + */ +export type HandleProps = HandlePropsSystem & + Omit, 'id'> & { + /** Callback called when connection is made */ + onConnect?: OnConnect; + }; const selector = (s: ReactFlowState) => ({ connectOnClick: s.connectOnClick, diff --git a/packages/react/src/components/Panel/index.tsx b/packages/react/src/components/Panel/index.tsx index 461cc1ba..8d854b91 100644 --- a/packages/react/src/components/Panel/index.tsx +++ b/packages/react/src/components/Panel/index.tsx @@ -5,6 +5,19 @@ import type { PanelPosition } from '@xyflow/system'; import { useStore } from '../../hooks/useStore'; import type { ReactFlowState } from '../../types'; +/** + * @expand + */ +export type PanelProps = HTMLAttributes & { + /** + * The position of the panel + */ + position?: PanelPosition; + children: ReactNode; +}; + +const selector = (s: ReactFlowState) => (s.userSelectionActive ? 'none' : 'all'); + /** * The `` component helps you position content above the viewport. * It is used internally by the [``](/api-reference/components/minimap) @@ -30,16 +43,6 @@ import type { ReactFlowState } from '../../types'; *} *``` */ -export type PanelProps = HTMLAttributes & { - /** - * The position of the panel - */ - position?: PanelPosition; - children: ReactNode; -}; - -const selector = (s: ReactFlowState) => (s.userSelectionActive ? 'none' : 'all'); - export const Panel = forwardRef( ({ position = 'top-left', children, className, style, ...rest }, ref) => { const pointerEvents = useStore(selector); diff --git a/packages/react/src/types/edges.ts b/packages/react/src/types/edges.ts index e25fdeb8..4d1e3f04 100644 --- a/packages/react/src/types/edges.ts +++ b/packages/react/src/types/edges.ts @@ -132,6 +132,7 @@ export type EdgeProps = Pick< /** * BaseEdge component props * @public + * @expand */ export type BaseEdgeProps = Omit, 'd'> & EdgeLabelOptions & { @@ -148,6 +149,7 @@ export type BaseEdgeProps = Omit, 'd'> & /** * Helper type for edge components that get exported by the library * @public + * @expand */ export type EdgeComponentProps = EdgePosition & EdgeLabelOptions & { @@ -167,30 +169,35 @@ export type EdgeComponentWithPathOptions = EdgeComponentProps & { /** * BezierEdge component props * @public + * @expand */ export type BezierEdgeProps = EdgeComponentWithPathOptions; /** * SmoothStepEdge component props * @public + * @expand */ export type SmoothStepEdgeProps = EdgeComponentWithPathOptions; /** * StepEdge component props * @public + * @expand */ export type StepEdgeProps = EdgeComponentWithPathOptions; /** * StraightEdge component props * @public + * @expand */ export type StraightEdgeProps = Omit; /** * SimpleBezier component props * @public + * @expand */ export type SimpleBezierEdgeProps = EdgeComponentProps; diff --git a/packages/system/src/types/edges.ts b/packages/system/src/types/edges.ts index 9f52b5a3..76382e73 100644 --- a/packages/system/src/types/edges.ts +++ b/packages/system/src/types/edges.ts @@ -118,6 +118,9 @@ export type MarkerProps = EdgeMarker & { id: string; }; +/** + * @inline + */ export type EdgePosition = { sourceX: number; sourceY: number; diff --git a/packages/system/src/xyresizer/types.ts b/packages/system/src/xyresizer/types.ts index 99480512..34cad9e8 100644 --- a/packages/system/src/xyresizer/types.ts +++ b/packages/system/src/xyresizer/types.ts @@ -11,10 +11,25 @@ export type ResizeParamsWithDirection = ResizeParams & { direction: number[]; }; +/** + * Used to determine the control line position of the NodeResizer + * + * @public + */ 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'; +/** + * Used to determine the variant of the resize control + * + * @public + */ export enum ResizeControlVariant { Line = 'line', Handle = 'handle',