update: move component related types to component-type file

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-21 16:54:24 +01:00
parent 062aee45b2
commit d24de0c0c2
6 changed files with 62 additions and 15 deletions

58
src/types/components.ts Normal file
View File

@@ -0,0 +1,58 @@
import { CSSProperties } from 'vue'
import { BackgroundVariant, Dimensions, ElementId, FitViewParams, Position, XYPosition } from './flow'
import { Connection } from './connection'
import { Node } from '~/types/node'
export type HandleType = 'source' | 'target'
export interface HandleElement extends XYPosition, Dimensions {
id?: ElementId | null
position: Position
}
export type ValidConnectionFunc = (connection: Connection) => boolean
export interface BackgroundProps {
variant?: BackgroundVariant
gap?: number
color?: string
size?: number
}
export interface ControlProps {
showZoom?: boolean
showFitView?: boolean
showInteractive?: boolean
fitViewParams?: FitViewParams
}
export interface ControlEvents {
(event: 'zoom-in'): void
(event: 'zoom-out'): void
(event: 'fit-view'): void
(event: 'interaction-change', active: boolean): void
}
export type StringFunc = (node: Node) => string
export type ShapeRendering = 'inherit' | 'auto' | 'geometricPrecision' | 'optimizeSpeed' | 'crispEdges' | undefined
interface MiniMapProps {
nodeColor?: string | StringFunc
nodeStrokeColor?: string | StringFunc
nodeClassName?: string | StringFunc
nodeBorderRadius?: number
nodeStrokeWidth?: number
maskColor?: string
}
interface MiniMapNodeProps {
x?: number
y?: number
width?: number
height?: number
borderRadius?: number
color?: string
shapeRendering?: CSSProperties['shapeRendering']
strokeColor?: string
strokeWidth?: number
}

View File

@@ -1,5 +1,5 @@
import { ElementId, Position } from './flow'
import { HandleType } from './handle'
import { HandleType } from './components'
export enum ConnectionLineType {
Bezier = 'default',

View File

@@ -1,11 +0,0 @@
import { Dimensions, ElementId, Position, XYPosition } from './flow'
import { Connection } from './connection'
export type HandleType = 'source' | 'target'
export interface HandleElement extends XYPosition, Dimensions {
id?: ElementId | null
position: Position
}
export type ValidConnectionFunc = (connection: Connection) => boolean

View File

@@ -1,7 +1,7 @@
export * from './flow'
export * from './connection'
export * from './edge'
export * from './handle'
export * from './components'
export * from './node'
export * from './zoom'
export * from './store'

View File

@@ -1,6 +1,6 @@
import { Component, CSSProperties, DefineComponent } from 'vue'
import { XYPosition, ElementId, Position } from './flow'
import { HandleElement } from './handle'
import { HandleElement } from './components'
interface VFInternals {
position: XYPosition

View File

@@ -12,7 +12,7 @@ import {
Transform,
XYPosition,
} from './flow'
import { HandleType } from './handle'
import { HandleType } from './components'
import {
ConnectionMode,
OnConnectEndFunc,