1
1
import type { CSSProperties , ComputedRef , ToRefs } from 'vue'
2
2
import type { KeyFilter } from '@vueuse/core'
3
- import type { PanZoomInstance , Viewport } from '@xyflow/system'
3
+ import type { InternalNodeBase , NodeBase , PanZoomInstance , Viewport } from '@xyflow/system'
4
4
import type { ViewportHelper } from '../composables'
5
5
import type {
6
6
Dimensions ,
7
7
ElementData ,
8
- Elements ,
9
- FlowElements ,
10
8
FlowExportObject ,
11
9
FlowOptions ,
12
10
FlowProps ,
@@ -161,8 +159,6 @@ export interface State extends Omit<FlowProps, 'id' | 'modelValue'> {
161
159
ariaLiveMessage : string
162
160
}
163
161
164
- export type SetElements = ( elements : Elements | ( ( elements : FlowElements ) => Elements ) ) => void
165
-
166
162
export type SetNodes = ( nodes : Node [ ] | ( ( nodes : GraphNode [ ] ) => Node [ ] ) ) => void
167
163
168
164
export type SetEdges = ( edges : Edge [ ] | ( ( edges : GraphEdge [ ] ) => Edge [ ] ) ) => void
@@ -206,9 +202,9 @@ export type UpdateNodeDimensions = (updates: UpdateNodeDimensionsParams[]) => vo
206
202
207
203
export type UpdateNodeInternals = ( nodeIds ?: string [ ] ) => void
208
204
209
- export type FindNode = < Data = ElementData , CustomEvents extends Record < string , CustomEvent > = any > (
205
+ export type FindNode = < NodeType extends NodeBase = NodeBase > (
210
206
id : string | undefined | null ,
211
- ) => GraphNode < Data , CustomEvents > | undefined
207
+ ) => InternalNodeBase < NodeType > | undefined
212
208
213
209
export type FindEdge = < Data = ElementData , CustomEvents extends Record < string , CustomEvent > = any > (
214
210
id : string | undefined | null ,
@@ -235,8 +231,6 @@ export type UpdateNodeData = <Data = ElementData, CustomEvents extends Record<st
235
231
export type IsNodeIntersecting = ( node : ( Partial < Node > & { id : Node [ 'id' ] } ) | Rect , area : Rect , partially ?: boolean ) => boolean
236
232
237
233
export interface Actions extends Omit < ViewportHelper , 'viewportInitialized' > {
238
- /** parses elements (nodes + edges) and re-sets the state */
239
- setElements : SetElements
240
234
/** parses nodes and re-sets the state */
241
235
setNodes : SetNodes
242
236
/** parses edges and re-sets the state */
@@ -265,11 +259,6 @@ export interface Actions extends Omit<ViewportHelper, 'viewportInitialized'> {
265
259
applyEdgeChanges : ( changes : EdgeChange [ ] ) => GraphEdge [ ]
266
260
/** applies default node change handler */
267
261
applyNodeChanges : ( changes : NodeChange [ ] ) => GraphNode [ ]
268
- /**
269
- * manually select elements and add to state
270
- * @deprecated will be removed in the next major, use {@link Actions.addSelectedNodes} or {@link Actions.addSelectedEdges} instead
271
- */
272
- addSelectedElements : ( elements : FlowElements ) => void
273
262
/** manually select edges and add to state */
274
263
addSelectedEdges : ( edges : GraphEdge [ ] ) => void
275
264
/** manually select nodes and add to state */
@@ -278,11 +267,6 @@ export interface Actions extends Omit<ViewportHelper, 'viewportInitialized'> {
278
267
removeSelectedEdges : ( edges : GraphEdge [ ] ) => void
279
268
/** manually unselect nodes and remove from state */
280
269
removeSelectedNodes : ( nodes : GraphNode [ ] ) => void
281
- /**
282
- * @deprecated will be replaced in the next major
283
- * unselect selected elements (if none are passed, all elements are unselected)
284
- */
285
- removeSelectedElements : ( elements ?: Elements ) => void
286
270
/** apply min zoom value to panzoom */
287
271
setMinZoom : ( zoom : number ) => void
288
272
/** apply max zoom value to panzoom */
@@ -341,11 +325,6 @@ export interface Getters {
341
325
getEdgeTypes : Record < keyof DefaultEdgeTypes | string , EdgeComponent >
342
326
/** returns object containing current node types */
343
327
getNodeTypes : Record < keyof DefaultNodeTypes | string , NodeComponent >
344
- /**
345
- * get all elements
346
- * @deprecated - will be removed in next major version
347
- */
348
- getElements : FlowElements
349
328
/** all visible node */
350
329
getNodes : GraphNode [ ]
351
330
/** all visible edges */
@@ -360,8 +339,6 @@ export interface Getters {
360
339
* @deprecated use {@link Actions.findEdge} instead
361
340
*/
362
341
getEdge : ( id : string ) => GraphEdge | undefined
363
- /** returns all currently selected elements */
364
- getSelectedElements : FlowElements
365
342
/** returns all currently selected nodes */
366
343
getSelectedNodes : GraphNode [ ]
367
344
/** returns all currently selected edges */
0 commit comments