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';
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import { useStoreApi } from '../hooks/useStore';
|
|||||||
* 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
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const viewportSelector = (state: ReactFlowState) => ({
|
|||||||
* 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