Merge pull request #5165 from dimaMachina/tsdoc2-11
Improve TSDoc comments for `useViewport`, `useUpdateNodeInternals`, `useOnSelectionChange`, `useNodesInitialized` hooks and `UseOnSelectionChangeOptions`, `UseNodesInitializedOptions` types
This commit is contained in:
5
.changeset/beige-apes-repair.md
Normal file
5
.changeset/beige-apes-repair.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@xyflow/react': patch
|
||||
---
|
||||
|
||||
Improve TSDoc comments for `useViewport`, `useUpdateNodeInternals`, `useOnSelectionChange`, `useNodesInitialized` hooks and `UseOnSelectionChangeOptions`, `UseNodesInitializedOptions` types
|
||||
@@ -4,6 +4,7 @@ import { useStore } from './useStore';
|
||||
import type { ReactFlowState } from '../types';
|
||||
|
||||
export type UseNodesInitializedOptions = {
|
||||
/** @default false */
|
||||
includeHiddenNodes?: boolean;
|
||||
};
|
||||
|
||||
@@ -29,8 +30,8 @@ const selector = (options: UseNodesInitializedOptions) => (s: ReactFlowState) =>
|
||||
*`false` and then `true` again once the node has been measured.
|
||||
*
|
||||
* @public
|
||||
* @param options.includeHiddenNodes - defaults to false
|
||||
* @returns boolean indicating whether all nodes are initialized
|
||||
* @returns Whether or not the nodes have been initialized by the `<ReactFlow />` component and
|
||||
* given a width and height.
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useStoreApi } from './useStore';
|
||||
import type { OnSelectionChangeFunc, Node, Edge } from '../types';
|
||||
|
||||
export type UseOnSelectionChangeOptions<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
||||
/** The handler to register. */
|
||||
onChange: OnSelectionChangeFunc<NodeType, EdgeType>;
|
||||
};
|
||||
|
||||
@@ -13,8 +14,6 @@ export type UseOnSelectionChangeOptions<NodeType extends Node = Node, EdgeType e
|
||||
*_either_ nodes or edges changes.
|
||||
*
|
||||
* @public
|
||||
* @param params.onChange - The handler to register
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
*import { useState } from 'react';
|
||||
|
||||
@@ -5,12 +5,13 @@ import { useStoreApi } from '../hooks/useStore';
|
||||
|
||||
/**
|
||||
* When you programmatically add or remove handles to a node or update a node's
|
||||
*handle position, you need to let React Flow know about it using this hook. This
|
||||
*will update the internal dimensions of the node and properly reposition handles
|
||||
*on the canvas if necessary.
|
||||
* handle position, you need to let React Flow know about it using this hook. This
|
||||
* will update the internal dimensions of the node and properly reposition handles
|
||||
* on the canvas if necessary.
|
||||
*
|
||||
* @public
|
||||
* @returns function for updating node internals
|
||||
* @returns Use this function to tell React Flow to update the internal state of one or more nodes
|
||||
* that you have changed programmatically.
|
||||
*
|
||||
* @example
|
||||
* ```jsx
|
||||
|
||||
@@ -12,11 +12,11 @@ const viewportSelector = (state: ReactFlowState) => ({
|
||||
|
||||
/**
|
||||
* The `useViewport` hook is a convenient way to read the current state of the
|
||||
*{@link Viewport} in a component. Components that use this hook
|
||||
*will re-render **whenever the viewport changes**.
|
||||
* {@link Viewport} in a component. Components that use this hook
|
||||
* will re-render **whenever the viewport changes**.
|
||||
*
|
||||
* @public
|
||||
* @returns The current viewport
|
||||
* @returns The current viewport.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user