chore(core): update composable jsdocs

This commit is contained in:
braks
2024-02-15 17:46:21 +01:00
committed by Braks
parent ee8748e936
commit fbb3f63134
23 changed files with 104 additions and 18 deletions
@@ -7,7 +7,7 @@ import { areConnectionMapsEqual, handleConnectionChange } from '../utils'
import { useNodeId } from './useNodeId'
import { useVueFlow } from './useVueFlow'
interface UseHandleConnectionsParams {
export interface UseHandleConnectionsParams {
type: MaybeRefOrGetter<HandleType>
id?: MaybeRefOrGetter<string | null>
nodeId?: MaybeRefOrGetter<string | null>
@@ -18,22 +18,19 @@ interface UseHandleConnectionsParams {
/**
* Composable that returns existing connections of a handle
*
* @param UseHandleConnectionsParams
* @param UseHandleConnectionsParams.type - handle type `source` or `target`
* @param UseHandleConnectionsParams.nodeId - node id - if not provided, the node id from the `useNodeId` (meaning, the context-based injection) is used
* @param UseHandleConnectionsParams.id - the handle id (this is required if the node has multiple handles of the same type)
* @param UseHandleConnectionsParams.onConnect - gets called when a connection is created
* @param UseHandleConnectionsParams.onDisconnect - gets called when a connection is removed
* @public
* @param params
* @param params.type - handle type `source` or `target`
* @param params.nodeId - node id - if not provided, the node id from the `useNodeId` (meaning, the context-based injection) is used
* @param params.id - the handle id (this is required if the node has multiple handles of the same type)
* @param params.onConnect - gets called when a connection is created
* @param params.onDisconnect - gets called when a connection is removed
*
* @returns An array of connections
*/
export function useHandleConnections({
type,
id,
nodeId,
onConnect,
onDisconnect,
}: UseHandleConnectionsParams): ComputedRef<Connection[]> {
export function useHandleConnections(params: UseHandleConnectionsParams): ComputedRef<Connection[]> {
const { type, id, nodeId, onConnect, onDisconnect } = params
const { connectionLookup } = useVueFlow()
const _nodeId = useNodeId()