11<script lang="ts" setup>
2- import type { Connection , Edge , Elements , FlowEvents , VueFlowStore , FlowTransform , Node , SnapGrid } from ' @braks/vue-flow'
2+ import type {
3+ Connection ,
4+ Edge ,
5+ Elements ,
6+ FlowEvents ,
7+ Node ,
8+ SnapGrid ,
9+ Styles ,
10+ ViewpaneTransform ,
11+ VueFlowStore ,
12+ } from ' @braks/vue-flow'
313import { Background , Controls , MarkerType , MiniMap , VueFlow , addEdge } from ' @braks/vue-flow'
414
515const onNodeDragStart = (e : FlowEvents [' nodeDragStart' ]) => console .log (' drag start' , e )
@@ -18,7 +28,7 @@ const onLoad = (flowInstance: VueFlowStore) => {
1828 flowInstance .fitView ()
1929}
2030
21- const onMoveEnd = (transform ? : FlowTransform ) => console .log (' zoom/move end' , transform )
31+ const onMoveEnd = (e : FlowEvents [ ' moveEnd ' ] ) => console .log (' zoom/move end' , e . flowTransform )
2232const onEdgeContextMenu = (e : FlowEvents [' edgeContextMenu' ]) => console .log (' edge context menu' , e )
2333const onEdgeMouseEnter = (e : FlowEvents [' edgeMouseEnter' ]) => console .log (' edge mouse enter' , e )
2434const onEdgeMouseMove = (e : FlowEvents [' edgeMouseMove' ]) => console .log (' edge mouse move' , e )
@@ -83,7 +93,7 @@ const initialElements: Elements = [
8393const snapGrid: SnapGrid = [16 , 16 ]
8494
8595const nodeStrokeColor = (n : Node ): string => {
86- if (n .style ?.background ) return n .style .background as string
96+ if (( n .style as Styles ) ?.background ) return ( n .style as Styles ) .background as string
8797 if (n .type === ' input' ) return ' #0041d0'
8898 if (n .type === ' output' ) return ' #ff0072'
8999 if (n .type === ' default' ) return ' #1a192b'
@@ -92,7 +102,7 @@ const nodeStrokeColor = (n: Node): string => {
92102}
93103
94104const nodeColor = (n : Node ): string => {
95- if (n .style ?.background ) return n .style .background as string
105+ if (( n .style as Styles ) ?.background ) return ( n .style as Styles ) .background as string
96106
97107 return ' #fff'
98108}
@@ -121,7 +131,6 @@ const onConnect = (params: Connection | Edge) => (elements.value = addEdge(param
121131 @selection-drag-stop =" onSelectionDragStop"
122132 @selection-context-menu =" onSelectionContextMenu"
123133 @move-end =" onMoveEnd"
124- @edge-update =" onEdgeMouseMove"
125134 @edge-context-menu =" onEdgeContextMenu"
126135 @edge-mouse-enter =" onEdgeMouseEnter"
127136 @edge-mouse-move =" onEdgeMouseMove"
0 commit comments