@@ -7,10 +7,18 @@ import { Preset } from '../types'
77import { AddConnectionAction , RemoveConnectionAction } from './actions/connection'
88import { AddNodeAction , DragNodeAction , Position , RemoveNodeAction } from './actions/node'
99
10+ export {
11+ AddConnectionAction ,
12+ AddNodeAction ,
13+ DragNodeAction ,
14+ RemoveConnectionAction ,
15+ RemoveNodeAction
16+ }
17+
1018type NodeActions < S extends BaseSchemes > =
11- | AddNodeAction < S >
12- | RemoveNodeAction < S >
13- | DragNodeAction < S >
19+ | AddNodeAction < S , BaseArea < S > >
20+ | RemoveNodeAction < S , BaseArea < S > >
21+ | DragNodeAction < S , BaseArea < S > >
1422
1523type ConnectionActions < S extends BaseSchemes > =
1624 | AddConnectionAction < S >
@@ -30,7 +38,7 @@ function trackNodes<S extends BaseSchemes>(history: HistoryPlugin<S, NodeActions
3038 if ( context . type === 'nodecreated' ) {
3139 const { id } = context . data
3240
33- history . add ( new AddNodeAction < S > ( editor , area , id ) )
41+ history . add ( new AddNodeAction ( editor , area , id ) )
3442 nodes . set ( id , editor . getNode ( context . data . id ) )
3543 }
3644 if ( context . type === 'noderemoved' ) {
@@ -40,7 +48,7 @@ function trackNodes<S extends BaseSchemes>(history: HistoryPlugin<S, NodeActions
4048
4149 if ( ! node ) throw new Error ( 'node' )
4250 if ( ! position ) throw new Error ( 'position' + id )
43- history . add ( new RemoveNodeAction < S > ( editor , area , node , position ) )
51+ history . add ( new RemoveNodeAction ( editor , area , node , position ) )
4452
4553 positions . delete ( id )
4654 nodes . delete ( id )
@@ -75,7 +83,7 @@ function trackNodes<S extends BaseSchemes>(history: HistoryPlugin<S, NodeActions
7583 if ( context . type === 'nodetranslated' ) {
7684 const { id, position, previous } = context . data
7785 const recent = history . getRecent ( timing )
78- . filter ( ( n ) : n is ( { time : number , action : DragNodeAction < S > } ) => n . action instanceof DragNodeAction )
86+ . filter ( ( n ) : n is ( { time : number , action : DragNodeAction < S , BaseArea < S > > } ) => n . action instanceof DragNodeAction )
7987 . filter ( n => n . action . nodeId === id )
8088
8189 if ( recent . length > 1 ) throw new Error ( '> 1' )
@@ -84,7 +92,7 @@ function trackNodes<S extends BaseSchemes>(history: HistoryPlugin<S, NodeActions
8492 recent [ 0 ] . action . new = position
8593 recent [ 0 ] . time = Date . now ( )
8694 } else {
87- history . add ( new DragNodeAction < S > ( area , id , previous ) )
95+ history . add ( new DragNodeAction ( area , id , previous ) )
8896 }
8997 }
9098
0 commit comments