@xyflow/react 12.0.0-next.6 → 12.0.0-next.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/dist/base.css +2 -16
- package/dist/esm/additional-components/Background/types.d.ts +13 -0
- package/dist/esm/additional-components/Background/types.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/types.d.ts +14 -0
- package/dist/esm/additional-components/Controls/types.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/types.d.ts +21 -0
- package/dist/esm/additional-components/MiniMap/types.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/types.d.ts +25 -0
- package/dist/esm/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeToolbar/types.d.ts +10 -0
- package/dist/esm/additional-components/NodeToolbar/types.d.ts.map +1 -1
- package/dist/esm/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
- package/dist/esm/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/esm/components/Handle/index.d.ts +6 -2
- package/dist/esm/components/Handle/index.d.ts.map +1 -1
- package/dist/esm/components/Panel/index.d.ts +3 -0
- package/dist/esm/components/Panel/index.d.ts.map +1 -1
- package/dist/esm/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -1
- package/dist/esm/container/FlowRenderer/index.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/index.d.ts +4 -117
- package/dist/esm/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/esm/hooks/useConnection.d.ts +13 -7
- package/dist/esm/hooks/useConnection.d.ts.map +1 -1
- package/dist/esm/hooks/useDrag.d.ts +1 -1
- package/dist/esm/hooks/useDrag.d.ts.map +1 -1
- package/dist/esm/hooks/useHandleConnections.d.ts +1 -1
- package/dist/esm/hooks/useNodesEdgesState.d.ts +2 -2
- package/dist/esm/hooks/useNodesEdgesState.d.ts.map +1 -1
- package/dist/esm/hooks/useNodesInitialized.d.ts.map +1 -1
- package/dist/esm/hooks/useOnSelectionChange.d.ts +1 -1
- package/dist/esm/hooks/useUpdateNodePositions.d.ts.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +76 -96
- package/dist/esm/index.mjs +76 -96
- package/dist/esm/store/initialState.d.ts.map +1 -1
- package/dist/esm/types/changes.d.ts +2 -2
- package/dist/esm/types/changes.d.ts.map +1 -1
- package/dist/esm/types/component-props.d.ts +346 -8
- package/dist/esm/types/component-props.d.ts.map +1 -1
- package/dist/esm/types/edges.d.ts +11 -0
- package/dist/esm/types/edges.d.ts.map +1 -1
- package/dist/esm/types/general.d.ts +83 -6
- package/dist/esm/types/general.d.ts.map +1 -1
- package/dist/esm/types/instance.d.ts +93 -9
- package/dist/esm/types/instance.d.ts.map +1 -1
- package/dist/esm/types/nodes.d.ts +3 -3
- package/dist/esm/types/nodes.d.ts.map +1 -1
- package/dist/esm/types/store.d.ts +2 -2
- package/dist/esm/types/store.d.ts.map +1 -1
- package/dist/esm/utils/changes.d.ts +3 -3
- package/dist/esm/utils/changes.d.ts.map +1 -1
- package/dist/esm/utils/general.d.ts +2 -49
- package/dist/esm/utils/general.d.ts.map +1 -1
- package/dist/style.css +10 -12
- package/dist/umd/additional-components/Background/types.d.ts +13 -0
- package/dist/umd/additional-components/Background/types.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/types.d.ts +14 -0
- package/dist/umd/additional-components/Controls/types.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/types.d.ts +21 -0
- package/dist/umd/additional-components/MiniMap/types.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/types.d.ts +25 -0
- package/dist/umd/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeToolbar/types.d.ts +10 -0
- package/dist/umd/additional-components/NodeToolbar/types.d.ts.map +1 -1
- package/dist/umd/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
- package/dist/umd/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/umd/components/Handle/index.d.ts +6 -2
- package/dist/umd/components/Handle/index.d.ts.map +1 -1
- package/dist/umd/components/Panel/index.d.ts +3 -0
- package/dist/umd/components/Panel/index.d.ts.map +1 -1
- package/dist/umd/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -1
- package/dist/umd/container/FlowRenderer/index.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/index.d.ts +4 -117
- package/dist/umd/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/umd/hooks/useConnection.d.ts +13 -7
- package/dist/umd/hooks/useConnection.d.ts.map +1 -1
- package/dist/umd/hooks/useDrag.d.ts +1 -1
- package/dist/umd/hooks/useDrag.d.ts.map +1 -1
- package/dist/umd/hooks/useHandleConnections.d.ts +1 -1
- package/dist/umd/hooks/useNodesEdgesState.d.ts +2 -2
- package/dist/umd/hooks/useNodesEdgesState.d.ts.map +1 -1
- package/dist/umd/hooks/useNodesInitialized.d.ts.map +1 -1
- package/dist/umd/hooks/useOnSelectionChange.d.ts +1 -1
- package/dist/umd/hooks/useUpdateNodePositions.d.ts.map +1 -1
- package/dist/umd/index.d.ts +3 -3
- package/dist/umd/index.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/store/initialState.d.ts.map +1 -1
- package/dist/umd/types/changes.d.ts +2 -2
- package/dist/umd/types/changes.d.ts.map +1 -1
- package/dist/umd/types/component-props.d.ts +346 -8
- package/dist/umd/types/component-props.d.ts.map +1 -1
- package/dist/umd/types/edges.d.ts +11 -0
- package/dist/umd/types/edges.d.ts.map +1 -1
- package/dist/umd/types/general.d.ts +83 -6
- package/dist/umd/types/general.d.ts.map +1 -1
- package/dist/umd/types/instance.d.ts +93 -9
- package/dist/umd/types/instance.d.ts.map +1 -1
- package/dist/umd/types/nodes.d.ts +3 -3
- package/dist/umd/types/nodes.d.ts.map +1 -1
- package/dist/umd/types/store.d.ts +2 -2
- package/dist/umd/types/store.d.ts.map +1 -1
- package/dist/umd/utils/changes.d.ts +3 -3
- package/dist/umd/utils/changes.d.ts.map +1 -1
- package/dist/umd/utils/general.d.ts +2 -49
- package/dist/umd/utils/general.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { FitViewParamsBase, FitViewOptionsBase, ZoomInOut, ZoomTo, SetViewport, GetZoom, GetViewport, SetCenter, FitBounds, XYPosition, NodeProps } from '@xyflow/system';
|
|
1
|
+
import { FitViewParamsBase, FitViewOptionsBase, ZoomInOut, ZoomTo, SetViewport, GetZoom, GetViewport, SetCenter, FitBounds, XYPosition, NodeProps, OnBeforeDeleteBase } from '@xyflow/system';
|
|
2
2
|
import type { NodeChange, EdgeChange, Node, Edge, ReactFlowInstance, EdgeProps } from '.';
|
|
3
3
|
import { ComponentType } from 'react';
|
|
4
|
-
export type OnNodesChange = (changes: NodeChange[]) => void;
|
|
5
|
-
export type OnEdgesChange = (changes: EdgeChange[]) => void;
|
|
6
|
-
export type OnNodesDelete = (nodes:
|
|
4
|
+
export type OnNodesChange<NodeType extends Node = Node> = (changes: NodeChange<NodeType>[]) => void;
|
|
5
|
+
export type OnEdgesChange<EdgeType extends Edge = Edge> = (changes: EdgeChange<EdgeType>[]) => void;
|
|
6
|
+
export type OnNodesDelete<NodeType extends Node = Node> = (nodes: NodeType[]) => void;
|
|
7
7
|
export type OnEdgesDelete = (edges: Edge[]) => void;
|
|
8
8
|
export type OnDelete = (params: {
|
|
9
9
|
nodes: Node[];
|
|
@@ -29,17 +29,94 @@ export type FitViewOptions = FitViewOptionsBase<Node>;
|
|
|
29
29
|
export type FitView = (fitViewOptions?: FitViewOptions) => boolean;
|
|
30
30
|
export type OnInit<NodeType extends Node = Node, EdgeType extends Edge = Edge> = (reactFlowInstance: ReactFlowInstance<NodeType, EdgeType>) => void;
|
|
31
31
|
export type ViewportHelperFunctions = {
|
|
32
|
+
/**
|
|
33
|
+
* Zooms viewport in by 1.2.
|
|
34
|
+
*
|
|
35
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
36
|
+
*/
|
|
32
37
|
zoomIn: ZoomInOut;
|
|
38
|
+
/**
|
|
39
|
+
* Zooms viewport out by 1 / 1.2.
|
|
40
|
+
*
|
|
41
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
42
|
+
*/
|
|
33
43
|
zoomOut: ZoomInOut;
|
|
44
|
+
/**
|
|
45
|
+
* Sets the current zoom level.
|
|
46
|
+
*
|
|
47
|
+
* @param zoomLevel - the zoom level to set
|
|
48
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
49
|
+
*/
|
|
34
50
|
zoomTo: ZoomTo;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the current zoom level.
|
|
53
|
+
*
|
|
54
|
+
* @returns current zoom as a number
|
|
55
|
+
*/
|
|
35
56
|
getZoom: GetZoom;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the current viewport.
|
|
59
|
+
*
|
|
60
|
+
* @param viewport - the viewport to set
|
|
61
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
62
|
+
*/
|
|
36
63
|
setViewport: SetViewport;
|
|
64
|
+
/**
|
|
65
|
+
* Returns the current viewport.
|
|
66
|
+
*
|
|
67
|
+
* @returns Viewport
|
|
68
|
+
*/
|
|
37
69
|
getViewport: GetViewport;
|
|
70
|
+
/**
|
|
71
|
+
* Fits the view.
|
|
72
|
+
*
|
|
73
|
+
* @param options.padding - optional padding
|
|
74
|
+
* @param options.includeHiddenNodes - optional includeHiddenNodes
|
|
75
|
+
* @param options.minZoom - optional minZoom
|
|
76
|
+
* @param options.maxZoom - optional maxZoom
|
|
77
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
78
|
+
* @param options.nodes - optional nodes to fit the view to
|
|
79
|
+
*/
|
|
38
80
|
fitView: FitView;
|
|
81
|
+
/**
|
|
82
|
+
* Sets the center of the view to the given position.
|
|
83
|
+
*
|
|
84
|
+
* @param x - x position
|
|
85
|
+
* @param y - y position
|
|
86
|
+
* @param options.zoom - optional zoom
|
|
87
|
+
*/
|
|
39
88
|
setCenter: SetCenter;
|
|
89
|
+
/**
|
|
90
|
+
* Fits the view to the given bounds .
|
|
91
|
+
*
|
|
92
|
+
* @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to
|
|
93
|
+
* @param options.padding - optional padding
|
|
94
|
+
*/
|
|
40
95
|
fitBounds: FitBounds;
|
|
41
|
-
|
|
42
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Converts a screen / client position to a flow position.
|
|
98
|
+
*
|
|
99
|
+
* @param clientPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
|
100
|
+
* @param options.snapToGrid - if true, the converted position will be snapped to the grid
|
|
101
|
+
* @returns position as { x: number, y: number }
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* const flowPosition = screenToFlowPosition({ x: event.clientX, y: event.clientY })
|
|
105
|
+
*/
|
|
106
|
+
screenToFlowPosition: (clientPosition: XYPosition, options?: {
|
|
107
|
+
snapToGrid: boolean;
|
|
108
|
+
}) => XYPosition;
|
|
109
|
+
/**
|
|
110
|
+
* Converts a flow position to a screen / client position.
|
|
111
|
+
*
|
|
112
|
+
* @param flowPosition - the screen / client position. When you are working with events you can use event.clientX and event.clientY
|
|
113
|
+
* @returns position as { x: number, y: number }
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* const clientPosition = flowToScreenPosition({ x: node.position.x, y: node.position.y })
|
|
117
|
+
*/
|
|
118
|
+
flowToScreenPosition: (flowPosition: XYPosition) => XYPosition;
|
|
43
119
|
viewportInitialized: boolean;
|
|
44
120
|
};
|
|
121
|
+
export type OnBeforeDelete<NodeType extends Node = Node, EdgeType extends Edge = Edge> = OnBeforeDeleteBase<NodeType, EdgeType>;
|
|
45
122
|
//# sourceMappingURL=general.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/general.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,WAAW,EACX,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/general.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,WAAW,EACX,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAC1F,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC;AACpG,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC;AAEpG,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;AACtF,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;AACpD,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE;IAAE,KAAK,EA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AKG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;;;OAIG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB;;;;;;;;;OASG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;;;;;;;;OASG;IACH,oBAAoB,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,KAAK,UAAU,CAAC;IACpG;;;;;;;;OAQG;IACH,oBAAoB,EAAE,CAAC,YAAY,EAAE,UAAU,KAAK,UAAU,CAAC;IAC/D,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,kBAAkB,CACzG,QAAQ,EACR,QAAQ,CACT,CAAC"}
|
|
@@ -33,15 +33,6 @@ export declare namespace Instance {
|
|
|
33
33
|
type IsNodeIntersecting<NodeType extends Node = Node> = (node: NodeType | {
|
|
34
34
|
id: Node['id'];
|
|
35
35
|
} | Rect, area: Rect, partially?: boolean) => boolean;
|
|
36
|
-
type getConnectedEdges = (id: string | (Node | {
|
|
37
|
-
id: Node['id'];
|
|
38
|
-
})[]) => Edge[];
|
|
39
|
-
type getIncomers = (node: string | Node | {
|
|
40
|
-
id: Node['id'];
|
|
41
|
-
}) => Node[];
|
|
42
|
-
type getOutgoers = (node: string | Node | {
|
|
43
|
-
id: Node['id'];
|
|
44
|
-
}) => Node[];
|
|
45
36
|
type UpdateNode<NodeType extends Node = Node> = (id: string, nodeUpdate: Partial<NodeType> | ((node: NodeType) => Partial<NodeType>), options?: {
|
|
46
37
|
replace: boolean;
|
|
47
38
|
}) => void;
|
|
@@ -50,19 +41,112 @@ export declare namespace Instance {
|
|
|
50
41
|
}) => void;
|
|
51
42
|
}
|
|
52
43
|
export type ReactFlowInstance<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
|
44
|
+
/**
|
|
45
|
+
* Returns nodes.
|
|
46
|
+
*
|
|
47
|
+
* @returns nodes array
|
|
48
|
+
*/
|
|
53
49
|
getNodes: Instance.GetNodes<NodeType>;
|
|
50
|
+
/**
|
|
51
|
+
* Sets nodes.
|
|
52
|
+
*
|
|
53
|
+
* @param payload - the nodes to set or a function that receives the current nodes and returns the new nodes
|
|
54
|
+
*/
|
|
54
55
|
setNodes: Instance.SetNodes<NodeType>;
|
|
56
|
+
/**
|
|
57
|
+
* Adds nodes.
|
|
58
|
+
*
|
|
59
|
+
* @param payload - the nodes to add
|
|
60
|
+
*/
|
|
55
61
|
addNodes: Instance.AddNodes<NodeType>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns a node by id.
|
|
64
|
+
*
|
|
65
|
+
* @param id - the node id
|
|
66
|
+
* @returns the node or undefined if no node was found
|
|
67
|
+
*/
|
|
56
68
|
getNode: Instance.GetNode<NodeType>;
|
|
69
|
+
/**
|
|
70
|
+
* Returns edges.
|
|
71
|
+
*
|
|
72
|
+
* @returns edges array
|
|
73
|
+
*/
|
|
57
74
|
getEdges: Instance.GetEdges<EdgeType>;
|
|
75
|
+
/**
|
|
76
|
+
* Sets edges.
|
|
77
|
+
*
|
|
78
|
+
* @param payload - the edges to set or a function that receives the current edges and returns the new edges
|
|
79
|
+
*/
|
|
58
80
|
setEdges: Instance.SetEdges<EdgeType>;
|
|
81
|
+
/**
|
|
82
|
+
* Adds edges.
|
|
83
|
+
*
|
|
84
|
+
* @param payload - the edges to add
|
|
85
|
+
*/
|
|
59
86
|
addEdges: Instance.AddEdges<EdgeType>;
|
|
87
|
+
/**
|
|
88
|
+
* Returns an edge by id.
|
|
89
|
+
*
|
|
90
|
+
* @param id - the edge id
|
|
91
|
+
* @returns the edge or undefined if no edge was found
|
|
92
|
+
*/
|
|
60
93
|
getEdge: Instance.GetEdge<EdgeType>;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the nodes, edges and the viewport as a JSON object.
|
|
96
|
+
*
|
|
97
|
+
* @returns the nodes, edges and the viewport as a JSON object
|
|
98
|
+
*/
|
|
61
99
|
toObject: Instance.ToObject<NodeType, EdgeType>;
|
|
100
|
+
/**
|
|
101
|
+
* Deletes nodes and edges.
|
|
102
|
+
*
|
|
103
|
+
* @param params.nodes - optional nodes array to delete
|
|
104
|
+
* @param params.edges - optional edges array to delete
|
|
105
|
+
*
|
|
106
|
+
* @returns a promise that resolves with the deleted nodes and edges
|
|
107
|
+
*/
|
|
62
108
|
deleteElements: Instance.DeleteElements;
|
|
109
|
+
/**
|
|
110
|
+
* Returns all nodes that intersect with the given node or rect.
|
|
111
|
+
*
|
|
112
|
+
* @param node - the node or rect to check for intersections
|
|
113
|
+
* @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed node or rect
|
|
114
|
+
* @param nodes - optional nodes array to check for intersections
|
|
115
|
+
*
|
|
116
|
+
* @returns an array of intersecting nodes
|
|
117
|
+
*/
|
|
63
118
|
getIntersectingNodes: Instance.GetIntersectingNodes<NodeType>;
|
|
119
|
+
/**
|
|
120
|
+
* Checks if the given node or rect intersects with the passed rect.
|
|
121
|
+
*
|
|
122
|
+
* @param node - the node or rect to check for intersections
|
|
123
|
+
* @param area - the rect to check for intersections
|
|
124
|
+
* @param partially - if true, the node is considered to be intersecting if it partially overlaps with the passed react
|
|
125
|
+
*
|
|
126
|
+
* @returns true if the node or rect intersects with the given area
|
|
127
|
+
*/
|
|
64
128
|
isNodeIntersecting: Instance.IsNodeIntersecting<NodeType>;
|
|
129
|
+
/**
|
|
130
|
+
* Updates a node.
|
|
131
|
+
*
|
|
132
|
+
* @param id - id of the node to update
|
|
133
|
+
* @param nodeUpdate - the node update as an object or a function that receives the current node and returns the node update
|
|
134
|
+
* @param options.replace - if true, the node is replaced with the node update, otherwise the changes get merged
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* updateNode('node-1', (node) => ({ position: { x: node.position.x + 10, y: node.position.y } }));
|
|
138
|
+
*/
|
|
65
139
|
updateNode: Instance.UpdateNode<NodeType>;
|
|
140
|
+
/**
|
|
141
|
+
* Updates the data attribute of a node.
|
|
142
|
+
*
|
|
143
|
+
* @param id - id of the node to update
|
|
144
|
+
* @param dataUpdate - the data update as an object or a function that receives the current data and returns the data update
|
|
145
|
+
* @param options.replace - if true, the data is replaced with the data update, otherwise the changes get merged
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* updateNodeData('node-1', { label: 'A new label' });
|
|
149
|
+
*/
|
|
66
150
|
updateNodeData: Instance.UpdateNodeData<NodeType>;
|
|
67
151
|
viewportInitialized: boolean;
|
|
68
152
|
} & Omit<ViewportHelperFunctions, 'initialized'>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/instance.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,uBAAuB,EAAE,MAAM,GAAG,CAAC;AAE7D,MAAM,MAAM,mBAAmB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IAC5F,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,CAAC,IAAI,GAAG;QAAE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;KAAE,CAAC,EAAE,CAAC;IACtC,KAAK,CAAC,EAAE,CAAC,IAAI,GAAG;QAAE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA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;;;;OASG;IACH,cAAc,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAClD,mBAAmB,EAAE,OAAO,CAAC;CAC9B,GAAG,IAAI,CAAC,uBAAuB,EAAE,aAAa,CAAC,CAAC"}
|
|
@@ -11,9 +11,9 @@ export type Node<NodeData = any, NodeType extends string | undefined = string |
|
|
|
11
11
|
resizing?: boolean;
|
|
12
12
|
focusable?: boolean;
|
|
13
13
|
};
|
|
14
|
-
export type NodeMouseHandler = (event: ReactMouseEvent, node:
|
|
15
|
-
export type
|
|
16
|
-
export type
|
|
14
|
+
export type NodeMouseHandler<NodeType extends Node = Node> = (event: ReactMouseEvent, node: NodeType) => void;
|
|
15
|
+
export type SelectionDragHandler<NodeType extends Node = Node> = (event: ReactMouseEvent, nodes: NodeType[]) => void;
|
|
16
|
+
export type OnNodeDrag<NodeType extends Node = Node> = (event: ReactMouseEvent, node: NodeType, nodes: NodeType[]) => void;
|
|
17
17
|
export type NodeWrapperProps = {
|
|
18
18
|
id: string;
|
|
19
19
|
nodesConnectable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EA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,gBAAgB,CAAC;IAChC,aAAa,CAAC,EAAE,gBAAgB,CAAC;IACjC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConnectionMode, type ConnectionStatus, type CoordinateExtent, type NodeDimensionUpdate, type UpdateNodePositions, type NodeOrigin, type OnConnect, type OnError, type OnViewportChange, type SelectionRect, type SnapGrid, type ConnectingHandle, type Transform, type XYPosition, type PanZoomInstance, type PanBy, type OnConnectStart, type OnConnectEnd, type
|
|
2
|
-
import type { Edge, Node, NodeChange, OnNodesChange, OnEdgesChange, DefaultEdgeOptions, FitViewOptions, OnNodesDelete, OnEdgesDelete, OnSelectionChangeFunc, UnselectNodesAndEdgesParams, OnDelete } from '.';
|
|
1
|
+
import { ConnectionMode, type ConnectionStatus, type CoordinateExtent, type NodeDimensionUpdate, type UpdateNodePositions, type NodeOrigin, type OnConnect, type OnError, type OnViewportChange, type SelectionRect, type SnapGrid, type ConnectingHandle, type Transform, type XYPosition, type PanZoomInstance, type PanBy, type OnConnectStart, type OnConnectEnd, type OnSelectionDrag, type OnMoveStart, type OnMove, type OnMoveEnd, type IsValidConnection, type UpdateConnection, type EdgeLookup, type ConnectionLookup, type NodeLookup } from '@xyflow/system';
|
|
2
|
+
import type { Edge, Node, NodeChange, OnNodesChange, OnEdgesChange, DefaultEdgeOptions, FitViewOptions, OnNodesDelete, OnEdgesDelete, OnSelectionChangeFunc, UnselectNodesAndEdgesParams, OnDelete, OnNodeDrag, OnBeforeDelete } from '.';
|
|
3
3
|
export type ReactFlowStore = {
|
|
4
4
|
rfId: string;
|
|
5
5
|
width: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,KAAK,EACV,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/types/store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,OAAO,EACZ,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,KAAK,EACV,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,c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AU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,kBAAkB,EAAE,CAAC,eAAe,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAChE,aAAa,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,IAAI,CAAC;IACtD,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,kBAAkB,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IACpD,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,OAAO,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,gBAAgB,CAAC"}
|
|
@@ -21,7 +21,7 @@ export declare function handleParentExpand(updatedElements: any[], updateItem: a
|
|
|
21
21
|
<ReactFLow nodes={nodes} edges={edges} onNodesChange={onNodesChange} />
|
|
22
22
|
);
|
|
23
23
|
*/
|
|
24
|
-
export declare function applyNodeChanges<NodeType extends Node = Node>(changes: NodeChange[], nodes: NodeType[]): NodeType[];
|
|
24
|
+
export declare function applyNodeChanges<NodeType extends Node = Node>(changes: NodeChange<NodeType>[], nodes: NodeType[]): NodeType[];
|
|
25
25
|
/**
|
|
26
26
|
* Drop in function that applies edge changes to an array of edges.
|
|
27
27
|
* @public
|
|
@@ -42,7 +42,7 @@ export declare function applyNodeChanges<NodeType extends Node = Node>(changes:
|
|
|
42
42
|
<ReactFlow nodes={nodes} edges={edges} onEdgesChange={onEdgesChange} />
|
|
43
43
|
);
|
|
44
44
|
*/
|
|
45
|
-
export declare function applyEdgeChanges<EdgeType extends Edge = Edge>(changes: EdgeChange[], edges: EdgeType[]): EdgeType[];
|
|
45
|
+
export declare function applyEdgeChanges<EdgeType extends Edge = Edge>(changes: EdgeChange<EdgeType>[], edges: EdgeType[]): EdgeType[];
|
|
46
46
|
export declare const createSelectionChange: (id: string, selected: boolean) => NodeSelectionChange | EdgeSelectionChange;
|
|
47
47
|
export declare function getSelectionChanges(items: any[], selectedIds?: Set<string>, mutateItem?: boolean): NodeSelectionChange[] | EdgeSelectionChange[];
|
|
48
48
|
/**
|
|
@@ -56,7 +56,7 @@ export declare function getSelectionChanges(items: any[], selectedIds?: Set<stri
|
|
|
56
56
|
*/
|
|
57
57
|
export declare function getElementsDiffChanges({ items, lookup, }: {
|
|
58
58
|
items: Node[] | undefined;
|
|
59
|
-
lookup: NodeLookup
|
|
59
|
+
lookup: NodeLookup<Node>;
|
|
60
60
|
}): NodeChange[];
|
|
61
61
|
export declare function getElementsDiffChanges({ items, lookup, }: {
|
|
62
62
|
items: Edge[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/utils/changes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE7G,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/utils/changes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE7G,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,GAAG,QA2CzE;AAwHD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAC3D,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,EAC/B,KAAK,EAAE,QAAQ,EAAE,GAChB,QAAQ,EAAE,CAEZ;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAC3D,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,EAC/B,KAAK,EAAE,QAAQ,EAAE,GAChB,QAAQ,EAAE,CAEZ;AAED,eAAO,MAAM,qBAAqB,OAAQ,MAAM,YAAY,OAAO,KAAG,mBAAmB,GAAG,mBAI1F,CAAC;AAEH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,GAAG,EAAE,EACZ,WAAW,GAAE,GAAG,CAAC,MAAM,CAAa,EACpC,UAAU,UAAQ,GACjB,mBAAmB,EAAE,GAAG,mBAAmB,EAAE,CAmB/C;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;CAC1B,GAAG,UAAU,EAAE,CAAC;AACjB,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAC;CACpB,GAAG,UAAU,EAAE,CAAC"}
|
|
@@ -6,7 +6,7 @@ import type { Edge, Node } from '../types';
|
|
|
6
6
|
* @param element - The element to test
|
|
7
7
|
* @returns A boolean indicating whether the element is an Node
|
|
8
8
|
*/
|
|
9
|
-
export declare const isNode:
|
|
9
|
+
export declare const isNode: <NodeType extends Node<any, string | undefined> = Node<any, string | undefined>>(element: unknown) => element is NodeType;
|
|
10
10
|
/**
|
|
11
11
|
* Test whether an object is useable as an Edge
|
|
12
12
|
* @public
|
|
@@ -14,52 +14,5 @@ export declare const isNode: (element: any) => element is Node<any, string | und
|
|
|
14
14
|
* @param element - The element to test
|
|
15
15
|
* @returns A boolean indicating whether the element is an Edge
|
|
16
16
|
*/
|
|
17
|
-
export declare const isEdge: (element:
|
|
18
|
-
/**
|
|
19
|
-
* Pass in a node, and get connected nodes where edge.source === node.id
|
|
20
|
-
* @public
|
|
21
|
-
* @param node - The node to get the connected nodes from
|
|
22
|
-
* @param nodes - The array of all nodes
|
|
23
|
-
* @param edges - The array of all edges
|
|
24
|
-
* @returns An array of nodes that are connected over eges where the source is the given node
|
|
25
|
-
*/
|
|
26
|
-
export declare const getOutgoers: (node: Node<any, string | undefined> | {
|
|
27
|
-
id: string;
|
|
28
|
-
}, nodes: Node<any, string | undefined>[], edges: Edge<any>[]) => Node<any, string | undefined>[];
|
|
29
|
-
/**
|
|
30
|
-
* Pass in a node, and get connected nodes where edge.target === node.id
|
|
31
|
-
* @public
|
|
32
|
-
* @param node - The node to get the connected nodes from
|
|
33
|
-
* @param nodes - The array of all nodes
|
|
34
|
-
* @param edges - The array of all edges
|
|
35
|
-
* @returns An array of nodes that are connected over eges where the target is the given node
|
|
36
|
-
*/
|
|
37
|
-
export declare const getIncomers: (node: Node<any, string | undefined> | {
|
|
38
|
-
id: string;
|
|
39
|
-
}, nodes: Node<any, string | undefined>[], edges: Edge<any>[]) => Node<any, string | undefined>[];
|
|
40
|
-
/**
|
|
41
|
-
* This util is a convenience function to add a new Edge to an array of edges
|
|
42
|
-
* @remarks It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
|
|
43
|
-
* @public
|
|
44
|
-
* @param edgeParams - Either an Edge or a Connection you want to add
|
|
45
|
-
* @param edges - The array of all current edges
|
|
46
|
-
* @returns A new array of edges with the new edge added
|
|
47
|
-
*/
|
|
48
|
-
export declare const addEdge: (edgeParams: Edge<any> | import("@xyflow/system").Connection, edges: Edge<any>[]) => Edge<any>[];
|
|
49
|
-
/**
|
|
50
|
-
* A handy utility to update an existing Edge with new properties
|
|
51
|
-
* @param oldEdge - The edge you want to update
|
|
52
|
-
* @param newConnection - The new connection you want to update the edge with
|
|
53
|
-
* @param edges - The array of all current edges
|
|
54
|
-
* @param options.shouldReplaceId - should the id of the old edge be replaced with the new connection id
|
|
55
|
-
* @returns the updated edges array
|
|
56
|
-
*/
|
|
57
|
-
export declare const updateEdge: (oldEdge: Edge<any>, newConnection: import("@xyflow/system").Connection, edges: Edge<any>[], options?: import("@xyflow/system").UpdateEdgeOptions | undefined) => Edge<any>[];
|
|
58
|
-
/**
|
|
59
|
-
* Get all connecting edges for a given set of nodes
|
|
60
|
-
* @param nodes - Nodes you want to get the connected edges for
|
|
61
|
-
* @param edges - All edges
|
|
62
|
-
* @returns Array of edges that connect any of the given nodes with each other
|
|
63
|
-
*/
|
|
64
|
-
export declare const getConnectedEdges: (nodes: Node<any, string | undefined>[], edges: Edge<any>[]) => Edge<any>[];
|
|
17
|
+
export declare const isEdge: <EdgeType extends Edge<any> = Edge<any>>(element: unknown) => element is EdgeType;
|
|
65
18
|
//# sourceMappingURL=general.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/utils/general.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/utils/general.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,4FAA2C,OAAO,wBACtC,CAAC;AAEhC;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,oDAA2C,OAAO,wBACtC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyflow/react",
|
|
3
|
-
"version": "12.0.0-next.
|
|
3
|
+
"version": "12.0.0-next.8",
|
|
4
4
|
"description": "React Flow - A highly customizable React library for building node-based editors and interactive flow charts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"classcat": "^5.0.3",
|
|
44
44
|
"zustand": "^4.4.0",
|
|
45
|
-
"@xyflow/system": "0.0.
|
|
45
|
+
"@xyflow/system": "0.0.16"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=17",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"react": "^18.2.0",
|
|
64
64
|
"typescript": "5.1.3",
|
|
65
65
|
"@xyflow/eslint-config": "0.0.0",
|
|
66
|
-
"@xyflow/
|
|
67
|
-
"@xyflow/
|
|
66
|
+
"@xyflow/tsconfig": "0.0.0",
|
|
67
|
+
"@xyflow/rollup-config": "0.0.0"
|
|
68
68
|
},
|
|
69
69
|
"rollup": {
|
|
70
70
|
"globals": {
|