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:
@@ -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';
|
import type { ReactFlowState } from '../types';
|
||||||
|
|
||||||
export type UseNodesInitializedOptions = {
|
export type UseNodesInitializedOptions = {
|
||||||
|
/** @default false */
|
||||||
includeHiddenNodes?: boolean;
|
includeHiddenNodes?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -29,8 +30,8 @@ const selector = (options: UseNodesInitializedOptions) => (s: ReactFlowState) =>
|
|||||||
*`false` and then `true` again once the node has been measured.
|
*`false` and then `true` again once the node has been measured.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
* @param options.includeHiddenNodes - defaults to false
|
* @returns Whether or not the nodes have been initialized by the `<ReactFlow />` component and
|
||||||
* @returns boolean indicating whether all nodes are initialized
|
* given a width and height.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* ```jsx
|
* ```jsx
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useStoreApi } from './useStore';
|
|||||||
import type { OnSelectionChangeFunc, Node, Edge } from '../types';
|
import type { OnSelectionChangeFunc, Node, Edge } from '../types';
|
||||||
|
|
||||||
export type UseOnSelectionChangeOptions<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
export type UseOnSelectionChangeOptions<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
||||||
|
/** The handler to register. */
|
||||||
onChange: OnSelectionChangeFunc<NodeType, EdgeType>;
|
onChange: OnSelectionChangeFunc<NodeType, EdgeType>;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -13,8 +14,6 @@ export type UseOnSelectionChangeOptions<NodeType extends Node = Node, EdgeType e
|
|||||||
*_either_ nodes or edges changes.
|
*_either_ nodes or edges changes.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
* @param params.onChange - The handler to register
|
|
||||||
*
|
|
||||||
* @example
|
* @example
|
||||||
* ```jsx
|
* ```jsx
|
||||||
*import { useState } from 'react';
|
*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
|
* 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
|
* 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
|
* will update the internal dimensions of the node and properly reposition handles
|
||||||
*on the canvas if necessary.
|
* on the canvas if necessary.
|
||||||
*
|
*
|
||||||
* @public
|
* @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
|
* @example
|
||||||
* ```jsx
|
* ```jsx
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ const viewportSelector = (state: ReactFlowState) => ({
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The `useViewport` hook is a convenient way to read the current state of the
|
* The `useViewport` hook is a convenient way to read the current state of the
|
||||||
*{@link Viewport} in a component. Components that use this hook
|
* {@link Viewport} in a component. Components that use this hook
|
||||||
*will re-render **whenever the viewport changes**.
|
* will re-render **whenever the viewport changes**.
|
||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
* @returns The current viewport
|
* @returns The current viewport.
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user