Skip to content

Commit daff22f

Browse files
committed
chore(core): deprecate some node props
1 parent 3220e20 commit daff22f

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

packages/core/src/types/node.ts

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ export type HeightFunc = (node: GraphNode) => number | string | void
3232
export interface Node<Data = ElementData, CustomEvents extends Record<string, CustomEvent> = any, Type extends string = string> {
3333
/** Unique node id */
3434
id: string
35-
/** A node label */
35+
/**
36+
* @deprecated - will be removed in next major release and replaced with `{ data: { label: string | VNode | Component } }`
37+
* A node label
38+
*/
3639
label?: string | VNode | Component
3740
/** initial node position x, y */
3841
position: XYPosition
@@ -54,11 +57,15 @@ export interface Node<Data = ElementData, CustomEvents extends Record<string, Cu
5457
deletable?: boolean
5558
/** element selector as drag handle for node (can only be dragged from the dragHandle el) */
5659
dragHandle?: string
57-
/** @deprecated will be removed in next major release */
58-
/** called when used as target for new connection */
60+
/**
61+
* @deprecated will be removed in next major release
62+
* called when used as target for new connection
63+
*/
5964
isValidTargetPos?: ValidConnectionFunc
60-
/** @deprecated will be removed in next major release */
61-
/** called when used as source for new connection */
65+
/**
66+
* @deprecated will be removed in next major release
67+
* called when used as source for new connection
68+
*/
6269
isValidSourcePos?: ValidConnectionFunc
6370
/** define node extent, i.e. area in which node can be moved */
6471
extent?: CoordinateExtent | CoordinateExtentRange | 'parent'
@@ -86,13 +93,16 @@ export interface Node<Data = ElementData, CustomEvents extends Record<string, Cu
8693
/** Is node hidden */
8794
hidden?: boolean
8895
/**
89-
* @deprecated will be removed in the next major release
96+
* @deprecated - will be removed in the next major release
9097
* overwrites current node type
9198
*/
9299
template?: NodeComponent
93100
/** Additional data that is passed to your custom components */
94101
data?: Data
95-
/** contextual and custom events that are passed to your custom components */
102+
/**
103+
* @deprecated - will be removed in the next major release
104+
* contextual and custom events that are passed to your custom components
105+
*/
96106
events?: Partial<NodeEventsHandler<CustomEvents>>
97107
zIndex?: number
98108
ariaLabel?: string
@@ -127,33 +137,39 @@ export interface NodeProps<Data = ElementData, CustomEvents = object, Type exten
127137
type: Type
128138
/** is node selected */
129139
selected: boolean
130-
/** can node handles be connected */
140+
/** can node handles be connected, you need to forward this to your handles for this prop to have any effect */
131141
connectable: HandleConnectable
132-
/** node x, y (relative) position on graph */
142+
/**
143+
* @deprecated - will be removed in next major release and replaced with `computedPosition`
144+
* node x, y (relative) position on graph
145+
*/
133146
position: XYPosition
134147
/** dom element dimensions (width, height) */
135148
dimensions: Dimensions
136149
/**
150+
* @deprecated - will be removed in next major release and replaced with `{ data: { label: string | VNode | Component } }`
137151
* node label, either pass a string or a VNode
138152
* For example like this: `h('div', props, children)`)
139153
* Object is just a type-hack for Vue, ignore that
140154
*/
141155
label?: string | VNode | Component | object
142156
/**
143-
* @deprecated will be removed in next major release and replaced by just `isValidConnection` prop
157+
* @deprecated will be removed in next major release
144158
* called when used as target for new connection
145159
*/
146160
isValidTargetPos?: ValidConnectionFunc
147161
/**
148-
* @deprecated will be removed in next major release and replaced by just `isValidConnection` prop
162+
* @deprecated will be removed in next major release
149163
* called when used as source for new connection
150164
*/
151165
isValidSourcePos?: ValidConnectionFunc
152166
/**
153-
* todo: rename to `parentNodeId`
167+
* @deprecated - will be removed in next major release. Use `parentNodeId` instead
154168
* parent node id
155169
*/
156170
parent?: string
171+
/** parent node id */
172+
parentNodeId?: string
157173
/** is node currently dragging */
158174
dragging: boolean
159175
/** is node currently resizing */
@@ -169,7 +185,10 @@ export interface NodeProps<Data = ElementData, CustomEvents = object, Type exten
169185

170186
/** additional data of node */
171187
data: Data
172-
/** contextual and custom events of node */
188+
/**
189+
* @deprecated - will be removed in next major release
190+
* contextual and custom events of node
191+
*/
173192
events: NodeEventsOn<CustomEvents>
174193
}
175194

0 commit comments

Comments
 (0)