added Edge Reconnection

This commit is contained in:
peterkogo
2025-04-11 15:32:07 +02:00
parent d94f3f490a
commit a3e3055186
17 changed files with 314 additions and 165 deletions
@@ -66,9 +66,6 @@
nodes = $bindable([]),
edges = $bindable([]),
viewport = $bindable(undefined),
nodesDraggable = $bindable(true),
nodesConnectable = $bindable(true),
elementsSelectable = $bindable(true),
...props
}: SvelteFlowProps & HTMLAttributes<HTMLDivElement> = $props();
@@ -32,6 +32,9 @@
edgeTypes,
colorMode: _colorMode,
isValidConnection,
onmove,
onmovestart,
onmoveend,
onerror,
ondelete,
onbeforedelete,
@@ -39,6 +42,10 @@
onconnect,
onconnectstart,
onconnectend,
onbeforereconnect,
onreconnect,
onreconnectstart,
onreconnectend,
onclickconnectstart,
onclickconnectend,
clickConnect,
@@ -18,7 +18,10 @@ import type {
OnConnect,
OnConnectStart,
OnConnectEnd,
ColorModeClass
ColorModeClass,
OnReconnect,
OnRecoonnectStart,
OnReconnectEnd
} from '@xyflow/system';
import type {
@@ -32,7 +35,8 @@ import type {
OnDelete,
OnBeforeConnect,
OnBeforeDelete,
IsValidConnection
IsValidConnection,
OnBeforeReconnect
} from '$lib/types';
import type { Component } from 'svelte';
@@ -356,16 +360,22 @@ export type SvelteFlowProps = NodeEvents &
ondelete?: OnDelete;
/** This handler gets called before the user deletes nodes or edges and provides a way to abort the deletion by returning false. */
onbeforedelete?: OnBeforeDelete;
/** This handler gets called when a new edge is created. You can use it to modify the newly created edge. */
onbeforeconnect?: OnBeforeConnect;
/** This event gets fired when a connection successfully completes and an edge is created. */
onconnect?: OnConnect;
/** When a user starts to drag a connection line, this event gets fired. */
onconnectstart?: OnConnectStart;
/** When a user stops dragging a connection line, this event gets fired. */
onconnectend?: OnConnectEnd;
/** This event gets fired when after an edge was reconnected*/
onreconnect?: OnReconnect;
/** This event gets fired when a user starts to reconnect an edge */
onreconnectstart?: OnRecoonnectStart;
/** This event gets fired when a user stops reconnecting an edge */
onreconnectend?: OnReconnectEnd;
/** This handler gets called when an edge is reconnected. You can use it to modify the edge before the update is applied. */
onbeforereconnect?: OnBeforeReconnect;
/** A connection is started by clicking on a handle */
onclickconnectstart?: OnConnectStart;
/** A connection is finished by clicking on a handle */