refactor(types): use interfaces
This commit is contained in:
+20
-20
@@ -13,22 +13,11 @@ export enum Position {
|
||||
Bottom = 'bottom',
|
||||
}
|
||||
|
||||
export type XYPosition = {
|
||||
export interface XYPosition {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
|
||||
export enum GridType {
|
||||
Lines = 'lines',
|
||||
Dots = 'dots',
|
||||
}
|
||||
|
||||
export type HandleType = 'source' | 'target';
|
||||
|
||||
export type NodeTypesType = { [key: string]: React.ReactNode };
|
||||
|
||||
export type EdgeTypesType = NodeTypesType;
|
||||
|
||||
export interface Dimensions {
|
||||
width: number;
|
||||
height: number;
|
||||
@@ -41,12 +30,6 @@ export interface Box extends XYPosition {
|
||||
y2: number;
|
||||
}
|
||||
|
||||
export interface SelectionRect extends Rect {
|
||||
startX: number;
|
||||
startY: number;
|
||||
draw: boolean;
|
||||
}
|
||||
|
||||
export interface Node {
|
||||
id: ElementId;
|
||||
position: XYPosition;
|
||||
@@ -71,6 +54,23 @@ export interface Edge {
|
||||
animated?: boolean;
|
||||
}
|
||||
|
||||
export enum GridType {
|
||||
Lines = 'lines',
|
||||
Dots = 'dots',
|
||||
}
|
||||
|
||||
export type HandleType = 'source' | 'target';
|
||||
|
||||
export type NodeTypesType = { [key: string]: React.ReactNode };
|
||||
|
||||
export type EdgeTypesType = NodeTypesType;
|
||||
|
||||
export interface SelectionRect extends Rect {
|
||||
startX: number;
|
||||
startY: number;
|
||||
draw: boolean;
|
||||
}
|
||||
|
||||
export interface EdgeProps {
|
||||
sourceX: number;
|
||||
sourceY: number;
|
||||
@@ -142,10 +142,10 @@ type OnLoadParams = {
|
||||
|
||||
export type OnLoadFunc = (params: OnLoadParams) => void;
|
||||
|
||||
export type Connection = {
|
||||
export interface Connection {
|
||||
source: ElementId | null;
|
||||
target: ElementId | null;
|
||||
};
|
||||
}
|
||||
|
||||
export type OnConnectFunc = (connection: Connection) => void;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user