chore(types): handle ReactFlow type annotations
This commit is contained in:
@@ -22,7 +22,7 @@ import { useStore, useStoreApi } from '../../hooks/useStore';
|
|||||||
import { useNodeId } from '../../contexts/NodeIdContext';
|
import { useNodeId } from '../../contexts/NodeIdContext';
|
||||||
import { type ReactFlowState } from '../../types';
|
import { type ReactFlowState } from '../../types';
|
||||||
|
|
||||||
export type HandleComponentProps = HandleProps & Omit<HTMLAttributes<HTMLDivElement>, 'id'>;
|
export interface HandleComponentProps extends HandleProps, Omit<HTMLAttributes<HTMLDivElement>, 'id'> {}
|
||||||
|
|
||||||
const selector = (s: ReactFlowState) => ({
|
const selector = (s: ReactFlowState) => ({
|
||||||
connectOnClick: s.connectOnClick,
|
connectOnClick: s.connectOnClick,
|
||||||
@@ -221,4 +221,7 @@ const HandleComponent = forwardRef<HTMLDivElement, HandleComponentProps>(
|
|||||||
|
|
||||||
HandleComponent.displayName = 'Handle';
|
HandleComponent.displayName = 'Handle';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Handle component is the part of a node that can be used to connect nodes.
|
||||||
|
*/
|
||||||
export const Handle = memo(HandleComponent);
|
export const Handle = memo(HandleComponent);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ import type {
|
|||||||
* ReactFlow component props.
|
* ReactFlow component props.
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export type ReactFlowProps = Omit<HTMLAttributes<HTMLDivElement>, 'onError'> & {
|
export interface ReactFlowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onError'> {
|
||||||
/** An array of nodes to render in a controlled flow.
|
/** An array of nodes to render in a controlled flow.
|
||||||
* @example
|
* @example
|
||||||
* const nodes = [
|
* const nodes = [
|
||||||
@@ -502,6 +502,6 @@ export type ReactFlowProps = Omit<HTMLAttributes<HTMLDivElement>, 'onError'> & {
|
|||||||
* @example 'system' | 'light' | 'dark'
|
* @example 'system' | 'light' | 'dark'
|
||||||
*/
|
*/
|
||||||
colorMode?: ColorMode;
|
colorMode?: ColorMode;
|
||||||
};
|
}
|
||||||
|
|
||||||
export type ReactFlowRefType = HTMLDivElement;
|
export type ReactFlowRefType = HTMLDivElement;
|
||||||
|
|||||||
@@ -126,6 +126,10 @@
|
|||||||
// @todo implement connectablestart, connectableend
|
// @todo implement connectablestart, connectableend
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
@component
|
||||||
|
The Handle component is the part of a node that can be used to connect nodes.
|
||||||
|
-->
|
||||||
<div
|
<div
|
||||||
data-handleid={handleId}
|
data-handleid={handleId}
|
||||||
data-nodeid={nodeId}
|
data-nodeid={nodeId}
|
||||||
|
|||||||
Reference in New Issue
Block a user