-
Notifications
You must be signed in to change notification settings - Fork 11
/
types.ts
102 lines (91 loc) · 2.06 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { Edge, Node, XYPosition } from "reactflow";
import { ControlPoint } from "../layout/edge/point";
interface WorkflowNode {
id: string;
type: string;
}
interface WorkflowEdge {
id: string;
source: string;
target: string;
sourceHandle: string;
targetHandle: string;
}
export interface Workflow {
nodes: WorkflowNode[];
edges: WorkflowEdge[];
}
export type ReactflowNode<
D = any,
T extends string | undefined = string | undefined
> = Node<D, T>;
export type ReactflowEdge<D = any> = Edge<D>;
export type ReactflowNodeData = WorkflowNode & {
/**
* The output ports of the current node.
*
* Format of Port ID: `nodeID#source#idx`
*/
sourceHandles: string[];
/**
* The input port of the current node (only one).
*
* Format of Port ID: `nodeID#target#idx`
*/
targetHandles: string[];
};
export interface ReactflowEdgePort {
/**
* Total number of edges in this direction (source or target).
*/
edges: number;
/**
* Number of ports
*/
portCount: number;
/**
* Port's index.
*/
portIndex: number;
/**
* Total number of Edges under the current port.
*/
edgeCount: number;
/**
* Index of the Edge under the current port.
*/
edgeIndex: number;
}
export interface EdgeLayout {
/**
* SVG path for edge rendering
*/
path: string;
/**
* Control points on the edge.
*/
points: ControlPoint[];
labelPosition: XYPosition;
/**
* Current layout dependent variables (re-layout when changed).
*/
deps?: any;
/**
* Potential control points on the edge, for debugging purposes only.
*/
inputPoints: ControlPoint[];
}
export interface ReactflowEdgeData {
/**
* Data related to the current edge's layout, such as control points.
*/
layout?: EdgeLayout;
sourcePort: ReactflowEdgePort;
targetPort: ReactflowEdgePort;
}
export type ReactflowNodeWithData = ReactflowNode<ReactflowNodeData>;
export type ReactflowEdgeWithData = ReactflowEdge<ReactflowEdgeData>;
export interface Reactflow {
nodes: ReactflowNodeWithData[];
edges: ReactflowEdgeWithData[];
}