@xyflow/system 0.0.54 → 0.0.55
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/dist/esm/index.js +64 -57
- package/dist/esm/index.mjs +64 -57
- package/dist/esm/utils/edges/bezier-edge.d.ts +25 -8
- package/dist/esm/utils/edges/bezier-edge.d.ts.map +1 -1
- package/dist/esm/utils/edges/general.d.ts +11 -8
- package/dist/esm/utils/edges/general.d.ts.map +1 -1
- package/dist/esm/utils/edges/smoothstep-edge.d.ts +26 -9
- package/dist/esm/utils/edges/smoothstep-edge.d.ts.map +1 -1
- package/dist/esm/utils/edges/straight-edge.d.ts +14 -5
- package/dist/esm/utils/edges/straight-edge.d.ts.map +1 -1
- package/dist/esm/utils/general.d.ts +8 -8
- package/dist/esm/utils/graph.d.ts +19 -16
- package/dist/esm/utils/graph.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/utils/edges/bezier-edge.d.ts +25 -8
- package/dist/umd/utils/edges/bezier-edge.d.ts.map +1 -1
- package/dist/umd/utils/edges/general.d.ts +11 -8
- package/dist/umd/utils/edges/general.d.ts.map +1 -1
- package/dist/umd/utils/edges/smoothstep-edge.d.ts +26 -9
- package/dist/umd/utils/edges/smoothstep-edge.d.ts.map +1 -1
- package/dist/umd/utils/edges/straight-edge.d.ts +14 -5
- package/dist/umd/utils/edges/straight-edge.d.ts.map +1 -1
- package/dist/umd/utils/general.d.ts +8 -8
- package/dist/umd/utils/graph.d.ts +19 -16
- package/dist/umd/utils/graph.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/esm/index.js
CHANGED
|
@@ -165,7 +165,7 @@ function getConnectionStatus(isValid) {
|
|
|
165
165
|
|
|
166
166
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
167
167
|
/**
|
|
168
|
-
* Test whether an object is
|
|
168
|
+
* Test whether an object is usable as an Edge
|
|
169
169
|
* @public
|
|
170
170
|
* @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Edge if it returns true
|
|
171
171
|
* @param element - The element to test
|
|
@@ -173,7 +173,7 @@ function getConnectionStatus(isValid) {
|
|
|
173
173
|
*/
|
|
174
174
|
const isEdgeBase = (element) => 'id' in element && 'source' in element && 'target' in element;
|
|
175
175
|
/**
|
|
176
|
-
* Test whether an object is
|
|
176
|
+
* Test whether an object is usable as a Node
|
|
177
177
|
* @public
|
|
178
178
|
* @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Node if it returns true
|
|
179
179
|
* @param element - The element to test
|
|
@@ -185,10 +185,10 @@ const isInternalNodeBase = (element) => 'id' in element && 'internals' in elemen
|
|
|
185
185
|
* This util is used to tell you what nodes, if any, are connected to the given node
|
|
186
186
|
* as the _target_ of an edge.
|
|
187
187
|
* @public
|
|
188
|
-
* @param node - The node to get the connected nodes from
|
|
189
|
-
* @param nodes - The array of all nodes
|
|
190
|
-
* @param edges - The array of all edges
|
|
191
|
-
* @returns An array of nodes that are connected over
|
|
188
|
+
* @param node - The node to get the connected nodes from.
|
|
189
|
+
* @param nodes - The array of all nodes.
|
|
190
|
+
* @param edges - The array of all edges.
|
|
191
|
+
* @returns An array of nodes that are connected over edges where the source is the given node.
|
|
192
192
|
*
|
|
193
193
|
* @example
|
|
194
194
|
* ```ts
|
|
@@ -220,10 +220,10 @@ const getOutgoers = (node, nodes, edges) => {
|
|
|
220
220
|
* This util is used to tell you what nodes, if any, are connected to the given node
|
|
221
221
|
* as the _source_ of an edge.
|
|
222
222
|
* @public
|
|
223
|
-
* @param node - The node to get the connected nodes from
|
|
224
|
-
* @param nodes - The array of all nodes
|
|
225
|
-
* @param edges - The array of all edges
|
|
226
|
-
* @returns An array of nodes that are connected over
|
|
223
|
+
* @param node - The node to get the connected nodes from.
|
|
224
|
+
* @param nodes - The array of all nodes.
|
|
225
|
+
* @param edges - The array of all edges.
|
|
226
|
+
* @returns An array of nodes that are connected over edges where the target is the given node.
|
|
227
227
|
*
|
|
228
228
|
* @example
|
|
229
229
|
* ```ts
|
|
@@ -267,9 +267,8 @@ const getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {
|
|
|
267
267
|
* to calculate the correct transform to fit the given nodes in a viewport.
|
|
268
268
|
* @public
|
|
269
269
|
* @remarks Useful when combined with {@link getViewportForBounds} to calculate the correct transform to fit the given nodes in a viewport.
|
|
270
|
-
* @param nodes - Nodes to calculate the bounds for
|
|
271
|
-
* @
|
|
272
|
-
* @returns Bounding box enclosing all nodes
|
|
270
|
+
* @param nodes - Nodes to calculate the bounds for.
|
|
271
|
+
* @returns Bounding box enclosing all nodes.
|
|
273
272
|
*
|
|
274
273
|
* @remarks This function was previously called `getRectOfNodes`
|
|
275
274
|
*
|
|
@@ -297,7 +296,7 @@ const getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {
|
|
|
297
296
|
*const bounds = getNodesBounds(nodes);
|
|
298
297
|
*```
|
|
299
298
|
*/
|
|
300
|
-
const getNodesBounds = (nodes, params = { nodeOrigin: [0, 0]
|
|
299
|
+
const getNodesBounds = (nodes, params = { nodeOrigin: [0, 0] }) => {
|
|
301
300
|
if (process.env.NODE_ENV === 'development' && !params.nodeLookup) {
|
|
302
301
|
console.warn('Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows.');
|
|
303
302
|
}
|
|
@@ -367,9 +366,9 @@ excludeNonSelectableNodes = false) => {
|
|
|
367
366
|
* This utility filters an array of edges, keeping only those where either the source or target
|
|
368
367
|
* node is present in the given array of nodes.
|
|
369
368
|
* @public
|
|
370
|
-
* @param nodes - Nodes you want to get the connected edges for
|
|
371
|
-
* @param edges - All edges
|
|
372
|
-
* @returns Array of edges that connect any of the given nodes with each other
|
|
369
|
+
* @param nodes - Nodes you want to get the connected edges for.
|
|
370
|
+
* @param edges - All edges.
|
|
371
|
+
* @returns Array of edges that connect any of the given nodes with each other.
|
|
373
372
|
*
|
|
374
373
|
* @example
|
|
375
374
|
* ```js
|
|
@@ -703,16 +702,16 @@ function calculateAppliedPaddings(bounds, x, y, zoom, width, height) {
|
|
|
703
702
|
};
|
|
704
703
|
}
|
|
705
704
|
/**
|
|
706
|
-
* Returns a viewport that encloses the given bounds with
|
|
705
|
+
* Returns a viewport that encloses the given bounds with padding.
|
|
707
706
|
* @public
|
|
708
707
|
* @remarks You can determine bounds of nodes with {@link getNodesBounds} and {@link getBoundsOfRects}
|
|
709
|
-
* @param bounds - Bounds to fit inside viewport
|
|
710
|
-
* @param width - Width of the viewport
|
|
711
|
-
* @param height - Height of the viewport
|
|
712
|
-
* @param minZoom - Minimum zoom level of the resulting viewport
|
|
713
|
-
* @param maxZoom - Maximum zoom level of the resulting viewport
|
|
714
|
-
* @param padding -
|
|
715
|
-
* @returns A
|
|
708
|
+
* @param bounds - Bounds to fit inside viewport.
|
|
709
|
+
* @param width - Width of the viewport.
|
|
710
|
+
* @param height - Height of the viewport.
|
|
711
|
+
* @param minZoom - Minimum zoom level of the resulting viewport.
|
|
712
|
+
* @param maxZoom - Maximum zoom level of the resulting viewport.
|
|
713
|
+
* @param padding - Padding around the bounds.
|
|
714
|
+
* @returns A transformed {@link Viewport} that encloses the given bounds which you can pass to e.g. {@link setViewport}.
|
|
716
715
|
* @example
|
|
717
716
|
* const { x, y, zoom } = getViewportForBounds(
|
|
718
717
|
* { x: 0, y: 0, width: 100, height: 100},
|
|
@@ -884,14 +883,15 @@ function getControlWithCurvature({ pos, x1, y1, x2, y2, c }) {
|
|
|
884
883
|
* The `getBezierPath` util returns everything you need to render a bezier edge
|
|
885
884
|
*between two nodes.
|
|
886
885
|
* @public
|
|
887
|
-
* @
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
886
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
887
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
888
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
889
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
890
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
891
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
892
|
+
* middle of this path.
|
|
893
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
894
|
+
* middle of this path.
|
|
895
895
|
* @example
|
|
896
896
|
* ```js
|
|
897
897
|
* const source = { x: 0, y: 20 };
|
|
@@ -988,9 +988,9 @@ const connectionExists = (edge, edges) => {
|
|
|
988
988
|
/**
|
|
989
989
|
* This util is a convenience function to add a new Edge to an array of edges. It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
|
|
990
990
|
* @public
|
|
991
|
-
* @param edgeParams - Either an Edge or a Connection you want to add
|
|
992
|
-
* @param edges -
|
|
993
|
-
* @returns A new array of edges with the new edge added
|
|
991
|
+
* @param edgeParams - Either an `Edge` or a `Connection` you want to add.
|
|
992
|
+
* @param edges - The array of all current edges.
|
|
993
|
+
* @returns A new array of edges with the new edge added.
|
|
994
994
|
*
|
|
995
995
|
* @remarks If an edge with the same `target` and `source` already exists (and the same
|
|
996
996
|
*`targetHandle` and `sourceHandle` if those are set), then this util won't add
|
|
@@ -1028,11 +1028,10 @@ const addEdge = (edgeParams, edges) => {
|
|
|
1028
1028
|
*This searches your edge array for an edge with a matching `id` and updates its
|
|
1029
1029
|
*properties with the connection you provide.
|
|
1030
1030
|
* @public
|
|
1031
|
-
* @param oldEdge - The edge you want to update
|
|
1032
|
-
* @param newConnection - The new connection you want to update the edge with
|
|
1033
|
-
* @param edges - The array of all current edges
|
|
1034
|
-
* @
|
|
1035
|
-
* @returns the updated edges array
|
|
1031
|
+
* @param oldEdge - The edge you want to update.
|
|
1032
|
+
* @param newConnection - The new connection you want to update the edge with.
|
|
1033
|
+
* @param edges - The array of all current edges.
|
|
1034
|
+
* @returns The updated edges array.
|
|
1036
1035
|
*
|
|
1037
1036
|
* @example
|
|
1038
1037
|
* ```js
|
|
@@ -1066,11 +1065,16 @@ const reconnectEdge = (oldEdge, newConnection, edges, options = { shouldReplaceI
|
|
|
1066
1065
|
/**
|
|
1067
1066
|
* Calculates the straight line path between two points.
|
|
1068
1067
|
* @public
|
|
1069
|
-
* @
|
|
1070
|
-
*
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1068
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
1069
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
1070
|
+
*
|
|
1071
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
1072
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
1073
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
1074
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
1075
|
+
* middle of this path.
|
|
1076
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
1077
|
+
* middle of this path.
|
|
1074
1078
|
* @example
|
|
1075
1079
|
* ```js
|
|
1076
1080
|
* const source = { x: 0, y: 20 };
|
|
@@ -1111,8 +1115,8 @@ const getDirection = ({ source, sourcePosition = Position.Bottom, target, }) =>
|
|
|
1111
1115
|
};
|
|
1112
1116
|
const distance = (a, b) => Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2));
|
|
1113
1117
|
/*
|
|
1114
|
-
*
|
|
1115
|
-
* It's not as good as a real orthogonal edge routing but it's faster and good enough as a default for step and smooth step edges
|
|
1118
|
+
* With this function we try to mimic an orthogonal edge routing behaviour
|
|
1119
|
+
* It's not as good as a real orthogonal edge routing, but it's faster and good enough as a default for step and smooth step edges
|
|
1116
1120
|
*/
|
|
1117
1121
|
function getPoints({ source, sourcePosition = Position.Bottom, target, targetPosition = Position.Top, center, offset, }) {
|
|
1118
1122
|
const sourceDir = handleDirections[sourcePosition];
|
|
@@ -1243,16 +1247,19 @@ function getBend(a, b, c, size) {
|
|
|
1243
1247
|
}
|
|
1244
1248
|
/**
|
|
1245
1249
|
* The `getSmoothStepPath` util returns everything you need to render a stepped path
|
|
1246
|
-
*between two nodes. The `borderRadius` property can be used to choose how rounded
|
|
1247
|
-
*the corners of those steps are.
|
|
1250
|
+
* between two nodes. The `borderRadius` property can be used to choose how rounded
|
|
1251
|
+
* the corners of those steps are.
|
|
1248
1252
|
* @public
|
|
1249
|
-
* @
|
|
1250
|
-
*
|
|
1251
|
-
*
|
|
1252
|
-
*
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1253
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
1254
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
1255
|
+
*
|
|
1256
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
1257
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
1258
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
1259
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
1260
|
+
* middle of this path.
|
|
1261
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
1262
|
+
* middle of this path.
|
|
1256
1263
|
* @example
|
|
1257
1264
|
* ```js
|
|
1258
1265
|
* const source = { x: 0, y: 20 };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -165,7 +165,7 @@ function getConnectionStatus(isValid) {
|
|
|
165
165
|
|
|
166
166
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
167
167
|
/**
|
|
168
|
-
* Test whether an object is
|
|
168
|
+
* Test whether an object is usable as an Edge
|
|
169
169
|
* @public
|
|
170
170
|
* @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Edge if it returns true
|
|
171
171
|
* @param element - The element to test
|
|
@@ -173,7 +173,7 @@ function getConnectionStatus(isValid) {
|
|
|
173
173
|
*/
|
|
174
174
|
const isEdgeBase = (element) => 'id' in element && 'source' in element && 'target' in element;
|
|
175
175
|
/**
|
|
176
|
-
* Test whether an object is
|
|
176
|
+
* Test whether an object is usable as a Node
|
|
177
177
|
* @public
|
|
178
178
|
* @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Node if it returns true
|
|
179
179
|
* @param element - The element to test
|
|
@@ -185,10 +185,10 @@ const isInternalNodeBase = (element) => 'id' in element && 'internals' in elemen
|
|
|
185
185
|
* This util is used to tell you what nodes, if any, are connected to the given node
|
|
186
186
|
* as the _target_ of an edge.
|
|
187
187
|
* @public
|
|
188
|
-
* @param node - The node to get the connected nodes from
|
|
189
|
-
* @param nodes - The array of all nodes
|
|
190
|
-
* @param edges - The array of all edges
|
|
191
|
-
* @returns An array of nodes that are connected over
|
|
188
|
+
* @param node - The node to get the connected nodes from.
|
|
189
|
+
* @param nodes - The array of all nodes.
|
|
190
|
+
* @param edges - The array of all edges.
|
|
191
|
+
* @returns An array of nodes that are connected over edges where the source is the given node.
|
|
192
192
|
*
|
|
193
193
|
* @example
|
|
194
194
|
* ```ts
|
|
@@ -220,10 +220,10 @@ const getOutgoers = (node, nodes, edges) => {
|
|
|
220
220
|
* This util is used to tell you what nodes, if any, are connected to the given node
|
|
221
221
|
* as the _source_ of an edge.
|
|
222
222
|
* @public
|
|
223
|
-
* @param node - The node to get the connected nodes from
|
|
224
|
-
* @param nodes - The array of all nodes
|
|
225
|
-
* @param edges - The array of all edges
|
|
226
|
-
* @returns An array of nodes that are connected over
|
|
223
|
+
* @param node - The node to get the connected nodes from.
|
|
224
|
+
* @param nodes - The array of all nodes.
|
|
225
|
+
* @param edges - The array of all edges.
|
|
226
|
+
* @returns An array of nodes that are connected over edges where the target is the given node.
|
|
227
227
|
*
|
|
228
228
|
* @example
|
|
229
229
|
* ```ts
|
|
@@ -267,9 +267,8 @@ const getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {
|
|
|
267
267
|
* to calculate the correct transform to fit the given nodes in a viewport.
|
|
268
268
|
* @public
|
|
269
269
|
* @remarks Useful when combined with {@link getViewportForBounds} to calculate the correct transform to fit the given nodes in a viewport.
|
|
270
|
-
* @param nodes - Nodes to calculate the bounds for
|
|
271
|
-
* @
|
|
272
|
-
* @returns Bounding box enclosing all nodes
|
|
270
|
+
* @param nodes - Nodes to calculate the bounds for.
|
|
271
|
+
* @returns Bounding box enclosing all nodes.
|
|
273
272
|
*
|
|
274
273
|
* @remarks This function was previously called `getRectOfNodes`
|
|
275
274
|
*
|
|
@@ -297,7 +296,7 @@ const getNodePositionWithOrigin = (node, nodeOrigin = [0, 0]) => {
|
|
|
297
296
|
*const bounds = getNodesBounds(nodes);
|
|
298
297
|
*```
|
|
299
298
|
*/
|
|
300
|
-
const getNodesBounds = (nodes, params = { nodeOrigin: [0, 0]
|
|
299
|
+
const getNodesBounds = (nodes, params = { nodeOrigin: [0, 0] }) => {
|
|
301
300
|
if (process.env.NODE_ENV === 'development' && !params.nodeLookup) {
|
|
302
301
|
console.warn('Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows.');
|
|
303
302
|
}
|
|
@@ -367,9 +366,9 @@ excludeNonSelectableNodes = false) => {
|
|
|
367
366
|
* This utility filters an array of edges, keeping only those where either the source or target
|
|
368
367
|
* node is present in the given array of nodes.
|
|
369
368
|
* @public
|
|
370
|
-
* @param nodes - Nodes you want to get the connected edges for
|
|
371
|
-
* @param edges - All edges
|
|
372
|
-
* @returns Array of edges that connect any of the given nodes with each other
|
|
369
|
+
* @param nodes - Nodes you want to get the connected edges for.
|
|
370
|
+
* @param edges - All edges.
|
|
371
|
+
* @returns Array of edges that connect any of the given nodes with each other.
|
|
373
372
|
*
|
|
374
373
|
* @example
|
|
375
374
|
* ```js
|
|
@@ -703,16 +702,16 @@ function calculateAppliedPaddings(bounds, x, y, zoom, width, height) {
|
|
|
703
702
|
};
|
|
704
703
|
}
|
|
705
704
|
/**
|
|
706
|
-
* Returns a viewport that encloses the given bounds with
|
|
705
|
+
* Returns a viewport that encloses the given bounds with padding.
|
|
707
706
|
* @public
|
|
708
707
|
* @remarks You can determine bounds of nodes with {@link getNodesBounds} and {@link getBoundsOfRects}
|
|
709
|
-
* @param bounds - Bounds to fit inside viewport
|
|
710
|
-
* @param width - Width of the viewport
|
|
711
|
-
* @param height - Height of the viewport
|
|
712
|
-
* @param minZoom - Minimum zoom level of the resulting viewport
|
|
713
|
-
* @param maxZoom - Maximum zoom level of the resulting viewport
|
|
714
|
-
* @param padding -
|
|
715
|
-
* @returns A
|
|
708
|
+
* @param bounds - Bounds to fit inside viewport.
|
|
709
|
+
* @param width - Width of the viewport.
|
|
710
|
+
* @param height - Height of the viewport.
|
|
711
|
+
* @param minZoom - Minimum zoom level of the resulting viewport.
|
|
712
|
+
* @param maxZoom - Maximum zoom level of the resulting viewport.
|
|
713
|
+
* @param padding - Padding around the bounds.
|
|
714
|
+
* @returns A transformed {@link Viewport} that encloses the given bounds which you can pass to e.g. {@link setViewport}.
|
|
716
715
|
* @example
|
|
717
716
|
* const { x, y, zoom } = getViewportForBounds(
|
|
718
717
|
* { x: 0, y: 0, width: 100, height: 100},
|
|
@@ -884,14 +883,15 @@ function getControlWithCurvature({ pos, x1, y1, x2, y2, c }) {
|
|
|
884
883
|
* The `getBezierPath` util returns everything you need to render a bezier edge
|
|
885
884
|
*between two nodes.
|
|
886
885
|
* @public
|
|
887
|
-
* @
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
886
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
887
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
888
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
889
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
890
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
891
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
892
|
+
* middle of this path.
|
|
893
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
894
|
+
* middle of this path.
|
|
895
895
|
* @example
|
|
896
896
|
* ```js
|
|
897
897
|
* const source = { x: 0, y: 20 };
|
|
@@ -988,9 +988,9 @@ const connectionExists = (edge, edges) => {
|
|
|
988
988
|
/**
|
|
989
989
|
* This util is a convenience function to add a new Edge to an array of edges. It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
|
|
990
990
|
* @public
|
|
991
|
-
* @param edgeParams - Either an Edge or a Connection you want to add
|
|
992
|
-
* @param edges -
|
|
993
|
-
* @returns A new array of edges with the new edge added
|
|
991
|
+
* @param edgeParams - Either an `Edge` or a `Connection` you want to add.
|
|
992
|
+
* @param edges - The array of all current edges.
|
|
993
|
+
* @returns A new array of edges with the new edge added.
|
|
994
994
|
*
|
|
995
995
|
* @remarks If an edge with the same `target` and `source` already exists (and the same
|
|
996
996
|
*`targetHandle` and `sourceHandle` if those are set), then this util won't add
|
|
@@ -1028,11 +1028,10 @@ const addEdge = (edgeParams, edges) => {
|
|
|
1028
1028
|
*This searches your edge array for an edge with a matching `id` and updates its
|
|
1029
1029
|
*properties with the connection you provide.
|
|
1030
1030
|
* @public
|
|
1031
|
-
* @param oldEdge - The edge you want to update
|
|
1032
|
-
* @param newConnection - The new connection you want to update the edge with
|
|
1033
|
-
* @param edges - The array of all current edges
|
|
1034
|
-
* @
|
|
1035
|
-
* @returns the updated edges array
|
|
1031
|
+
* @param oldEdge - The edge you want to update.
|
|
1032
|
+
* @param newConnection - The new connection you want to update the edge with.
|
|
1033
|
+
* @param edges - The array of all current edges.
|
|
1034
|
+
* @returns The updated edges array.
|
|
1036
1035
|
*
|
|
1037
1036
|
* @example
|
|
1038
1037
|
* ```js
|
|
@@ -1066,11 +1065,16 @@ const reconnectEdge = (oldEdge, newConnection, edges, options = { shouldReplaceI
|
|
|
1066
1065
|
/**
|
|
1067
1066
|
* Calculates the straight line path between two points.
|
|
1068
1067
|
* @public
|
|
1069
|
-
* @
|
|
1070
|
-
*
|
|
1071
|
-
*
|
|
1072
|
-
*
|
|
1073
|
-
*
|
|
1068
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
1069
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
1070
|
+
*
|
|
1071
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
1072
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
1073
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
1074
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
1075
|
+
* middle of this path.
|
|
1076
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
1077
|
+
* middle of this path.
|
|
1074
1078
|
* @example
|
|
1075
1079
|
* ```js
|
|
1076
1080
|
* const source = { x: 0, y: 20 };
|
|
@@ -1111,8 +1115,8 @@ const getDirection = ({ source, sourcePosition = Position.Bottom, target, }) =>
|
|
|
1111
1115
|
};
|
|
1112
1116
|
const distance = (a, b) => Math.sqrt(Math.pow(b.x - a.x, 2) + Math.pow(b.y - a.y, 2));
|
|
1113
1117
|
/*
|
|
1114
|
-
*
|
|
1115
|
-
* It's not as good as a real orthogonal edge routing but it's faster and good enough as a default for step and smooth step edges
|
|
1118
|
+
* With this function we try to mimic an orthogonal edge routing behaviour
|
|
1119
|
+
* It's not as good as a real orthogonal edge routing, but it's faster and good enough as a default for step and smooth step edges
|
|
1116
1120
|
*/
|
|
1117
1121
|
function getPoints({ source, sourcePosition = Position.Bottom, target, targetPosition = Position.Top, center, offset, }) {
|
|
1118
1122
|
const sourceDir = handleDirections[sourcePosition];
|
|
@@ -1243,16 +1247,19 @@ function getBend(a, b, c, size) {
|
|
|
1243
1247
|
}
|
|
1244
1248
|
/**
|
|
1245
1249
|
* The `getSmoothStepPath` util returns everything you need to render a stepped path
|
|
1246
|
-
*between two nodes. The `borderRadius` property can be used to choose how rounded
|
|
1247
|
-
*the corners of those steps are.
|
|
1250
|
+
* between two nodes. The `borderRadius` property can be used to choose how rounded
|
|
1251
|
+
* the corners of those steps are.
|
|
1248
1252
|
* @public
|
|
1249
|
-
* @
|
|
1250
|
-
*
|
|
1251
|
-
*
|
|
1252
|
-
*
|
|
1253
|
-
*
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1253
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
1254
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
1255
|
+
*
|
|
1256
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
1257
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
1258
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
1259
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
1260
|
+
* middle of this path.
|
|
1261
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
1262
|
+
* middle of this path.
|
|
1256
1263
|
* @example
|
|
1257
1264
|
* ```js
|
|
1258
1265
|
* const source = { x: 0, y: 20 };
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { Position } from '../../types';
|
|
2
2
|
export type GetBezierPathParams = {
|
|
3
|
+
/** The `x` position of the source handle. */
|
|
3
4
|
sourceX: number;
|
|
5
|
+
/** The `y` position of the source handle. */
|
|
4
6
|
sourceY: number;
|
|
7
|
+
/**
|
|
8
|
+
* The position of the source handle.
|
|
9
|
+
* @default Position.Bottom
|
|
10
|
+
*/
|
|
5
11
|
sourcePosition?: Position;
|
|
12
|
+
/** The `x` position of the target handle. */
|
|
6
13
|
targetX: number;
|
|
14
|
+
/** The `y` position of the target handle. */
|
|
7
15
|
targetY: number;
|
|
16
|
+
/**
|
|
17
|
+
* The position of the target handle.
|
|
18
|
+
* @default Position.Top
|
|
19
|
+
*/
|
|
8
20
|
targetPosition?: Position;
|
|
21
|
+
/**
|
|
22
|
+
* The curvature of the bezier edge.
|
|
23
|
+
* @default 0.25
|
|
24
|
+
*/
|
|
9
25
|
curvature?: number;
|
|
10
26
|
};
|
|
11
27
|
export type GetControlWithCurvatureParams = {
|
|
@@ -30,14 +46,15 @@ export declare function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY
|
|
|
30
46
|
* The `getBezierPath` util returns everything you need to render a bezier edge
|
|
31
47
|
*between two nodes.
|
|
32
48
|
* @public
|
|
33
|
-
* @
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
49
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
50
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
51
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
52
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
53
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
54
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
55
|
+
* middle of this path.
|
|
56
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
57
|
+
* middle of this path.
|
|
41
58
|
* @example
|
|
42
59
|
* ```js
|
|
43
60
|
* const source = { x: 0, y: 20 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bezier-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/bezier-edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CA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;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,GAAG,EAAE,QAAQ,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,GACf,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAWnC;AAuBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,EAC7B,SAAgB,GACjB,EAAE,mBAAmB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAmCxG"}
|
|
@@ -24,9 +24,9 @@ export declare function isEdgeVisible({ sourceNode, targetNode, width, height, t
|
|
|
24
24
|
/**
|
|
25
25
|
* This util is a convenience function to add a new Edge to an array of edges. It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
|
|
26
26
|
* @public
|
|
27
|
-
* @param edgeParams - Either an Edge or a Connection you want to add
|
|
28
|
-
* @param edges -
|
|
29
|
-
* @returns A new array of edges with the new edge added
|
|
27
|
+
* @param edgeParams - Either an `Edge` or a `Connection` you want to add.
|
|
28
|
+
* @param edges - The array of all current edges.
|
|
29
|
+
* @returns A new array of edges with the new edge added.
|
|
30
30
|
*
|
|
31
31
|
* @remarks If an edge with the same `target` and `source` already exists (and the same
|
|
32
32
|
*`targetHandle` and `sourceHandle` if those are set), then this util won't add
|
|
@@ -35,6 +35,10 @@ export declare function isEdgeVisible({ sourceNode, targetNode, width, height, t
|
|
|
35
35
|
*/
|
|
36
36
|
export declare const addEdge: <EdgeType extends EdgeBase>(edgeParams: EdgeType | Connection, edges: EdgeType[]) => EdgeType[];
|
|
37
37
|
export type ReconnectEdgeOptions = {
|
|
38
|
+
/**
|
|
39
|
+
* Should the id of the old edge be replaced with the new connection id.
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
38
42
|
shouldReplaceId?: boolean;
|
|
39
43
|
};
|
|
40
44
|
/**
|
|
@@ -42,11 +46,10 @@ export type ReconnectEdgeOptions = {
|
|
|
42
46
|
*This searches your edge array for an edge with a matching `id` and updates its
|
|
43
47
|
*properties with the connection you provide.
|
|
44
48
|
* @public
|
|
45
|
-
* @param oldEdge - The edge you want to update
|
|
46
|
-
* @param newConnection - The new connection you want to update the edge with
|
|
47
|
-
* @param edges - The array of all current edges
|
|
48
|
-
* @
|
|
49
|
-
* @returns the updated edges array
|
|
49
|
+
* @param oldEdge - The edge you want to update.
|
|
50
|
+
* @param newConnection - The new connection you want to update the edge with.
|
|
51
|
+
* @param edges - The array of all current edges.
|
|
52
|
+
* @returns The updated edges array.
|
|
50
53
|
*
|
|
51
54
|
* @example
|
|
52
55
|
* ```js
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/general.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAA6B,QAAQ,EAAE,MAAM,OAAO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,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,uCACf,QAAQ,iBACF,UAAU,SAClB,QAAQ,EAAE,YACR,oBAAoB,KAC5B,QAAQ,EA4BV,CAAC"}
|
|
@@ -1,28 +1,45 @@
|
|
|
1
1
|
import { Position } from '../../types';
|
|
2
2
|
export interface GetSmoothStepPathParams {
|
|
3
|
+
/** The `x` position of the source handle. */
|
|
3
4
|
sourceX: number;
|
|
5
|
+
/** The `y` position of the source handle. */
|
|
4
6
|
sourceY: number;
|
|
7
|
+
/**
|
|
8
|
+
* The position of the source handle.
|
|
9
|
+
* @default Position.Bottom
|
|
10
|
+
*/
|
|
5
11
|
sourcePosition?: Position;
|
|
12
|
+
/** The `x` position of the target handle. */
|
|
6
13
|
targetX: number;
|
|
14
|
+
/** The `y` position of the target handle. */
|
|
7
15
|
targetY: number;
|
|
16
|
+
/**
|
|
17
|
+
* The position of the target handle.
|
|
18
|
+
* @default Position.Top
|
|
19
|
+
*/
|
|
8
20
|
targetPosition?: Position;
|
|
21
|
+
/** @default 5 */
|
|
9
22
|
borderRadius?: number;
|
|
10
23
|
centerX?: number;
|
|
11
24
|
centerY?: number;
|
|
25
|
+
/** @default 20 */
|
|
12
26
|
offset?: number;
|
|
13
27
|
}
|
|
14
28
|
/**
|
|
15
29
|
* The `getSmoothStepPath` util returns everything you need to render a stepped path
|
|
16
|
-
*between two nodes. The `borderRadius` property can be used to choose how rounded
|
|
17
|
-
*the corners of those steps are.
|
|
30
|
+
* between two nodes. The `borderRadius` property can be used to choose how rounded
|
|
31
|
+
* the corners of those steps are.
|
|
18
32
|
* @public
|
|
19
|
-
* @
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
33
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
34
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
35
|
+
*
|
|
36
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
37
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
38
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
39
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
40
|
+
* middle of this path.
|
|
41
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
42
|
+
* middle of this path.
|
|
26
43
|
* @example
|
|
27
44
|
* ```js
|
|
28
45
|
* const source = { x: 0, y: 20 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smoothstep-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/smoothstep-edge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAwLD
|
|
1
|
+
{"version":3,"file":"smoothstep-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/smoothstep-edge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,6CAA6C;IA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