rete-connection-plugin
packageSignal types produced by ConnectionPlugin instance
type Connection =
| { data: Object; type: "connectionpick" }
| { data: Object; type: "connectiondrop" };
Connection plugin. Responsible for user interaction with connections (creation, deletion)
class ConnectionPlugin<Schemes extends ClassicScheme, K extends unknown>
Parameter | Extends | Description |
---|---|---|
Schemes | ClassicScheme | |
K | unknown |
Extends Scope<Connection, Requires | K>
Emits connectionpick
connectiondrop
Listens pointermove
pointerup
render
unmount
Add preset to the plugin
addPreset(preset: Preset<Schemes>): void
Parameter | Type | Description |
---|---|---|
preset | Preset<Schemes> | Preset to add |
Returns void
Drop pseudo-connection if exists
drop(): void
Emits connectiondrop
Returns void
Built-in presets
Classic preset. Uses ClassicFlow
for managing connections by user
setup(): () => ClassicFlow<ClassicScheme, any[]>
Returns () => ClassicFlow<ClassicScheme, any[]>
Bidirect flow. User can pick a socket and connect it by releasing mouse button. More simple than classic flow, but less functional (can't remove connection by clicking on input socket).
class BidirectFlow<Schemes extends ClassicScheme, K extends any[]>
Parameter | Extends | Description |
---|---|---|
Schemes | ClassicScheme | |
K | any[] |
Implements StateContext<Schemes, K>, Flow<Schemes, K>
Classic flow. User can pick/click a socket and connect it by releasing/clicking on another socket. If connection already exists and user clicks on input socket, connection will be removed.
class ClassicFlow<Schemes extends ClassicScheme, K extends any[]>
Parameter | Extends | Description |
---|---|---|
Schemes | ClassicScheme | |
K | any[] |
Implements StateContext<Schemes, K>, Flow<Schemes, K>
Bidirect flow params
type BidirectParams<Schemes extends ClassicScheme> = {
makeConnection: Function;
pickByClick: boolean;
};
Parameter | Extends | Description |
---|---|---|
Schemes | ClassicScheme |
Classic flow params
type ClassicParams<Schemes extends ClassicScheme> = {
canMakeConnection: Function;
makeConnection: Function;
};
Parameter | Extends | Description |
---|---|---|
Schemes | ClassicScheme |
Create pseudoconnection. Used to trigger rendering of connection that is being created by user.
Has additional isPseudo
property in payload.
createPseudoconnection(extra: Partial<Schemes["Connection"]>): { mount: Function, unmount: Function, isMounted: unknown, render: unknown }
Parameter | Type | Description |
---|---|---|
extra | Partial<Schemes["Connection"]> | Extra payload to add to connection |
Returns { mount: Function, unmount: Function, isMounted: unknown, render: unknown }