diff --git a/packages/svelte/src/lib/types/general.ts b/packages/svelte/src/lib/types/general.ts index 5d33a97c..84e48d65 100644 --- a/packages/svelte/src/lib/types/general.ts +++ b/packages/svelte/src/lib/types/general.ts @@ -23,13 +23,26 @@ export type ConnectionData = { }; export type HandleComponentProps = { + /** type of the handle + * @example HandleType.Source, HandleType.Target + */ type: HandleType; + /** position of the handle + * @example Position.TopLeft, Position.TopRight, + * Position.BottomLeft, Position.BottomRight + */ position?: Position; + /** id of the handle + * @remarks optional if there is only one handle of this type + */ id?: string; class?: string; style?: string; + /** should you be able to connect from/to this handle */ isConnectable?: boolean; + /** shoould you be able to connect from this handle */ isConnectableStart?: boolean; + /** should you be able to connect to this handle */ isConnectableEnd?: boolean; onconnect?: (connections: Connection[]) => void; ondisconnect?: (connections: Connection[]) => void; diff --git a/packages/system/src/types/handles.ts b/packages/system/src/types/handles.ts index c1ea7d0e..911ecf51 100644 --- a/packages/system/src/types/handles.ts +++ b/packages/system/src/types/handles.ts @@ -27,12 +27,29 @@ export type ConnectionHandle = { }; export type HandleProps = { + /** type of the handle + * @example HandleType.Source, HandleType.Target + */ type: HandleType; + /** position of the handle + * @example Position.TopLeft, Position.TopRight, + * Position.BottomLeft, Position.BottomRight + */ position: Position; + /** should you be able to connect to/from this handle */ isConnectable?: boolean; + /** shoud you be able to connect from this handle */ isConnectableStart?: boolean; + /** should you be able to connect to this handle */ isConnectableEnd?: boolean; + /** callback called when connection is made */ onConnect?: OnConnect; + /** callback if connection is valid + * @remarks connection becomes an edge if isValidConnection returns true + */ isValidConnection?: IsValidConnection; + /** id of the handle + * @remarks optional if there is only one handle of this type + */ id?: string; };