refactor(core): move MaybeElement type
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -2,7 +2,7 @@ import type { CSSProperties } from 'vue'
|
|||||||
import type { KeyFilter } from '@vueuse/core'
|
import type { KeyFilter } from '@vueuse/core'
|
||||||
import type { DefaultEdgeOptions, Edge, EdgeUpdatable, GraphEdge } from './edge'
|
import type { DefaultEdgeOptions, Edge, EdgeUpdatable, GraphEdge } from './edge'
|
||||||
import type { CoordinateExtent, GraphNode, Node } from './node'
|
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 { PanOnScrollMode, ViewportTransform } from './zoom'
|
||||||
import type { EdgeTypesObject, NodeTypesObject } from './components'
|
import type { EdgeTypesObject, NodeTypesObject } from './components'
|
||||||
import type { CustomEvent } from './hooks'
|
import type { CustomEvent } from './hooks'
|
||||||
@@ -39,6 +39,7 @@ export type Elements<
|
|||||||
EdgeEvents extends Record<string, CustomEvent> = any,
|
EdgeEvents extends Record<string, CustomEvent> = any,
|
||||||
> = Element<NodeData, EdgeData, NodeEvents, EdgeEvents>[]
|
> = Element<NodeData, EdgeData, NodeEvents, EdgeEvents>[]
|
||||||
|
|
||||||
|
export type MaybeElement = Node | Edge | Connection | FlowElement | Element
|
||||||
export interface CustomThemeVars {
|
export interface CustomThemeVars {
|
||||||
[key: string]: string | number | undefined
|
[key: string]: string | number | undefined
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,11 @@ import type {
|
|||||||
Dimensions,
|
Dimensions,
|
||||||
Edge,
|
Edge,
|
||||||
EdgeMarkerType,
|
EdgeMarkerType,
|
||||||
Element,
|
|
||||||
ElementData,
|
ElementData,
|
||||||
Elements,
|
Elements,
|
||||||
FlowElement,
|
|
||||||
GraphEdge,
|
GraphEdge,
|
||||||
GraphNode,
|
GraphNode,
|
||||||
|
MaybeElement,
|
||||||
Node,
|
Node,
|
||||||
Rect,
|
Rect,
|
||||||
ViewportTransform,
|
ViewportTransform,
|
||||||
@@ -54,8 +53,6 @@ export const getHostForElement = (element: HTMLElement): Document => {
|
|||||||
else return window.document
|
else return window.document
|
||||||
}
|
}
|
||||||
|
|
||||||
type MaybeElement = Node | Edge | Connection | FlowElement | Element
|
|
||||||
|
|
||||||
export const isEdge = <Data = ElementData>(element: MaybeElement): element is Edge<Data> =>
|
export const isEdge = <Data = ElementData>(element: MaybeElement): element is Edge<Data> =>
|
||||||
element && 'id' in element && 'source' in element && 'target' in element
|
element && 'id' in element && 'source' in element && 'target' in element
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user