import type { ShortcutModifierDefinition } from '@svelte-put/shortcut'; import type { FitViewOptionsBase, XYPosition, Handle, Connection, OnBeforeDeleteBase } from '@xyflow/system'; import type { Node } from './nodes'; import type { Edge } from './edges'; export type KeyModifier = ShortcutModifierDefinition; export type KeyDefinitionObject = { key: string; modifier?: KeyModifier; }; export type KeyDefinition = string | KeyDefinitionObject; export type ConnectionData = { connectionPosition: XYPosition | null; connectionStartHandle: Handle | null; connectionEndHandle: Handle | null; connectionStatus: string | null; }; /** * @inline */ export type FitViewOptions = FitViewOptionsBase; /** * This type can be used to type the `onDelete` function with a custom node and edge type. * * @public */ export type OnDelete = (params: { nodes: NodeType[]; edges: EdgeType[]; }) => void; export type OnBeforeConnect = (connection: Connection) => EdgeType | Connection | void | false | null; export type OnBeforeReconnect = (newEdge: EdgeType, oldEdge: EdgeType) => EdgeType | void | false | null; export type OnBeforeDelete = OnBeforeDeleteBase; /** * This type can be used to type the `isValidConnection` function. * If the function returns `true`, the connection is valid and can be created. */ export type IsValidConnection = (edge: EdgeType | Connection) => boolean; export type OnSelectionChange = (params: { nodes: NodeType[]; edges: EdgeType[]; }) => void;