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