refactor(core): move MaybeElement type

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-02-01 23:00:08 +01:00
committed by Braks
parent 6ea60349fd
commit 51270caa73
2 changed files with 3 additions and 5 deletions
+2 -1
View File
@@ -2,7 +2,7 @@ import type { CSSProperties } from 'vue'
import type { KeyFilter } from '@vueuse/core'
import type { DefaultEdgeOptions, Edge, EdgeUpdatable, GraphEdge } from './edge'
import type { CoordinateExtent, GraphNode, Node } from './node'
import type { ConnectionLineOptions, ConnectionLineType, ConnectionMode, Connector } from './connection'
import type { Connection, ConnectionLineOptions, ConnectionLineType, ConnectionMode, Connector } from './connection'
import type { PanOnScrollMode, ViewportTransform } from './zoom'
import type { EdgeTypesObject, NodeTypesObject } from './components'
import type { CustomEvent } from './hooks'
@@ -39,6 +39,7 @@ export type Elements<
EdgeEvents extends Record<string, CustomEvent> = any,
> = Element<NodeData, EdgeData, NodeEvents, EdgeEvents>[]
export type MaybeElement = Node | Edge | Connection | FlowElement | Element
export interface CustomThemeVars {
[key: string]: string | number | undefined
}
+1 -4
View File
@@ -8,12 +8,11 @@ import type {
Dimensions,
Edge,
EdgeMarkerType,
Element,
ElementData,
Elements,
FlowElement,
GraphEdge,
GraphNode,
MaybeElement,
Node,
Rect,
ViewportTransform,
@@ -54,8 +53,6 @@ export const getHostForElement = (element: HTMLElement): Document => {
else return window.document
}
type MaybeElement = Node | Edge | Connection | FlowElement | Element
export const isEdge = <Data = ElementData>(element: MaybeElement): element is Edge<Data> =>
element && 'id' in element && 'source' in element && 'target' in element