refactor(types): Split types into separate files

* for better organization split typings into separate files
* use index as barrel file
This commit is contained in:
Braks
2021-10-20 22:39:54 +02:00
parent 769378a2ea
commit 3557284a40
9 changed files with 396 additions and 425 deletions
+60
View File
@@ -0,0 +1,60 @@
import { ComponentPublicInstance } from 'vue'
import { XYPosition } from './types'
import { ElementId, Position } from './index'
export interface Node<T = any> {
id: ElementId
position: XYPosition
type?: string
__rf: {
position: XYPosition
isDragging?: boolean
width: number | null
height: number | null
handleBounds?: any
}
data?: T
style?: any
className?: string
targetPosition?: Position
sourcePosition?: Position
isHidden?: boolean
draggable?: boolean
selectable?: boolean
connectable?: boolean
}
export type NodePosUpdate = {
id: ElementId
pos: XYPosition
}
export type NodeDiffUpdate = {
id?: ElementId
diff?: XYPosition
isDragging?: boolean
}
export type TranslateExtent = [[number, number], [number, number]]
export type NodeExtent = TranslateExtent
export type NodeDimensionUpdate = {
id: ElementId
nodeElement: HTMLDivElement
forceUpdate?: boolean
}
export interface NodeProps<T = any> {
id: ElementId
type: string
data: T
selected: boolean
isConnectable: boolean
xPos?: number
yPos?: number
targetPosition?: Position
sourcePosition?: Position
isDragging?: boolean
}
export type NodeType = ComponentPublicInstance<NodeProps>