From 09021550dc72ac240fcbb6adb3cf530d91575f79 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Sat, 5 Apr 2025 17:34:06 +0200 Subject: [PATCH] Improve TSDoc comments for `type UseOnViewportChangeOptions` and `useOnViewportChange` hook --- .changeset/purple-bees-laugh.md | 5 +++++ packages/react/src/hooks/useOnViewportChange.ts | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 .changeset/purple-bees-laugh.md diff --git a/.changeset/purple-bees-laugh.md b/.changeset/purple-bees-laugh.md new file mode 100644 index 00000000..99e6d107 --- /dev/null +++ b/.changeset/purple-bees-laugh.md @@ -0,0 +1,5 @@ +--- +'@xyflow/react': patch +--- + +Improve TSDoc comments for `type UseOnViewportChangeOptions` and `useOnViewportChange` hook diff --git a/packages/react/src/hooks/useOnViewportChange.ts b/packages/react/src/hooks/useOnViewportChange.ts index c82eb344..9a13c4fb 100644 --- a/packages/react/src/hooks/useOnViewportChange.ts +++ b/packages/react/src/hooks/useOnViewportChange.ts @@ -4,21 +4,20 @@ import type { OnViewportChange } from '@xyflow/system'; import { useStoreApi } from './useStore'; export type UseOnViewportChangeOptions = { + /** Gets called when the viewport starts changing. */ onStart?: OnViewportChange; + /** Gets called when the viewport changes. */ onChange?: OnViewportChange; + /** Gets called when the viewport stops changing. */ onEnd?: OnViewportChange; }; /** * The `useOnViewportChange` hook lets you listen for changes to the viewport such - *as panning and zooming. You can provide a callback for each phase of a viewport - *change: `onStart`, `onChange`, and `onEnd`. + * as panning and zooming. You can provide a callback for each phase of a viewport + * change: `onStart`, `onChange`, and `onEnd`. * * @public - * @param params.onStart - gets called when the viewport starts changing - * @param params.onChange - gets called when the viewport changes - * @param params.onEnd - gets called when the viewport stops changing - * * @example * ```jsx *import { useCallback } from 'react';