1- import type { Component , VNode } from 'vue'
2- import type { NodeBase } from '@xyflow/system'
3- import type { Dimensions , Position , Styles , XYPosition , XYZPosition } from './flow'
4- import type { HandleConnectable , HandleElement , ValidConnectionFunc } from './handle'
5- import type { NodeEventsOn } from './hooks'
1+ import type { NodeBase , NodeProps as NodePropsBase } from '@xyflow/system'
2+ import type { Styles } from './flow'
3+ import type { HandleConnectable , HandleElement } from './handle'
64
75export type ElementData = Record < string , unknown >
86
@@ -25,17 +23,11 @@ export interface NodeHandleBounds {
2523 target ?: HandleElement [ ]
2624}
2725
28- /** @deprecated will be removed in next major release */
29- export type WidthFunc = ( node : GraphNode ) => number | string | void
30-
31- /** @deprecated will be removed in next major release */
32- export type HeightFunc = ( node : GraphNode ) => number | string | void
33-
3426/**
3527 * The node data structure that gets used for the nodes prop.
3628 * @public
3729 */
38- export interface Node < NodeData extends Record < string , unknown > = Record < string , unknown > , NodeType extends string = string >
30+ export interface Node < NodeData extends ElementData = ElementData , NodeType extends string = string >
3931 extends Omit < NodeBase < NodeData , NodeType > , 'connectable' | 'extent' | 'origin' > {
4032 /** Disable/enable connecting node */
4133 connectable ?: HandleConnectable
@@ -47,80 +39,8 @@ export interface Node<NodeData extends Record<string, unknown> = Record<string,
4739 style ?: Styles
4840}
4941
50- export interface GraphNode < Data extends ElementData = ElementData , Type extends string = string > extends Node < Data , Type > {
51- /** absolute position in relation to parent elements + z-index */
52- computedPosition : XYZPosition
53- handleBounds : NodeHandleBounds
54- /** node width, height */
55- dimensions : Dimensions
56- isParent : boolean
57- selected : boolean
58- resizing : boolean
59- dragging : boolean
60- }
61-
6242/** these props are passed to node components */
63- export interface NodeProps < Data = ElementData , CustomEvents = object , Type extends string = string > {
64- /** unique node id */
65- id : string
66- /** node type */
67- type : Type
68- /** is node selected */
69- selected : boolean
43+ export interface NodeProps < NodeType extends NodeBase = NodeBase > extends Omit < NodePropsBase < NodeType > , 'isConnectable' > {
7044 /** can node handles be connected, you need to forward this to your handles for this prop to have any effect */
71- connectable : HandleConnectable
72- /**
73- * @deprecated - will be removed in next major release and replaced with `computedPosition`
74- * node x, y (relative) position on graph
75- */
76- position : XYPosition
77- /** dom element dimensions (width, height) */
78- dimensions : Dimensions
79- /**
80- * @deprecated - will be removed in next major release and replaced with `{ data: { label: string | VNode | Component } }`
81- * node label, either pass a string or a VNode
82- * For example like this: `h('div', props, children)`)
83- * Object is just a type-hack for Vue, ignore that
84- */
85- label ?: string | VNode | Component | object
86- /**
87- * @deprecated will be removed in next major release
88- * called when used as target for new connection
89- */
90- isValidTargetPos ?: ValidConnectionFunc
91- /**
92- * @deprecated will be removed in next major release
93- * called when used as source for new connection
94- */
95- isValidSourcePos ?: ValidConnectionFunc
96- /**
97- * @deprecated - will be removed in next major release. Use `parentNodeId` instead
98- * parent node id
99- */
100- parent ?: string
101- /**
102- * todo: rename to `parentId` in next major release
103- * parent node id
104- */
105- parentNodeId ?: string
106- /** is node currently dragging */
107- dragging : boolean
108- /** is node currently resizing */
109- resizing : boolean
110- /** node z-index */
111- zIndex : number
112- /** handle position */
113- targetPosition ?: Position
114- /** handle position */
115- sourcePosition ?: Position
116- /** drag handle query selector */
117- dragHandle ?: string
118-
119- /** additional data of node */
120- data : Data
121- /**
122- * @deprecated - will be removed in next major release
123- * contextual and custom events of node
124- */
125- events : NodeEventsOn < CustomEvents >
45+ isConnectable : HandleConnectable
12646}
0 commit comments