@xyflow/system 0.0.54 → 0.0.56
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 +80 -60
- package/dist/esm/index.mjs +80 -60
- 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 +17 -8
- package/dist/esm/utils/general.d.ts.map +1 -1
- 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 +17 -8
- package/dist/umd/utils/general.d.ts.map +1 -1
- package/dist/umd/utils/graph.d.ts +19 -16
- package/dist/umd/utils/graph.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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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M,oBAAoB,GAAG;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,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;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAwLD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,EAC7B,YAAgB,EAChB,OAAO,EACP,OAAO,EACP,MAAW,GACZ,EAAE,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAyB5G"}
|
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
export type GetStraightPathParams = {
|
|
2
|
+
/** The `x` position of the source handle. */
|
|
2
3
|
sourceX: number;
|
|
4
|
+
/** The `y` position of the source handle. */
|
|
3
5
|
sourceY: number;
|
|
6
|
+
/** The `x` position of the target handle. */
|
|
4
7
|
targetX: number;
|
|
8
|
+
/** The `y` position of the target handle. */
|
|
5
9
|
targetY: number;
|
|
6
10
|
};
|
|
7
11
|
/**
|
|
8
12
|
* Calculates the straight line path between two points.
|
|
9
13
|
* @public
|
|
10
|
-
* @
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
15
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
16
|
+
*
|
|
17
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
18
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
19
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
20
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
21
|
+
* middle of this path.
|
|
22
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
23
|
+
* middle of this path.
|
|
15
24
|
* @example
|
|
16
25
|
* ```js
|
|
17
26
|
* const source = { x: 0, y: 20 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"straight-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/straight-edge.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"straight-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/straight-edge.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,qBAAqB,GAAG;IAClC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,GACR,EAAE,qBAAqB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAS1G"}
|
|
@@ -24,16 +24,16 @@ export declare const snapPosition: (position: XYPosition, snapGrid?: SnapGrid) =
|
|
|
24
24
|
export declare const pointToRendererPoint: ({ x, y }: XYPosition, [tx, ty, tScale]: Transform, snapToGrid?: boolean, snapGrid?: SnapGrid) => XYPosition;
|
|
25
25
|
export declare const rendererPointToPoint: ({ x, y }: XYPosition, [tx, ty, tScale]: Transform) => XYPosition;
|
|
26
26
|
/**
|
|
27
|
-
* Returns a viewport that encloses the given bounds with
|
|
27
|
+
* Returns a viewport that encloses the given bounds with padding.
|
|
28
28
|
* @public
|
|
29
29
|
* @remarks You can determine bounds of nodes with {@link getNodesBounds} and {@link getBoundsOfRects}
|
|
30
|
-
* @param bounds - Bounds to fit inside viewport
|
|
31
|
-
* @param width - Width of the viewport
|
|
32
|
-
* @param height - Height of the viewport
|
|
33
|
-
* @param minZoom - Minimum zoom level of the resulting viewport
|
|
34
|
-
* @param maxZoom - Maximum zoom level of the resulting viewport
|
|
35
|
-
* @param padding -
|
|
36
|
-
* @returns A
|
|
30
|
+
* @param bounds - Bounds to fit inside viewport.
|
|
31
|
+
* @param width - Width of the viewport.
|
|
32
|
+
* @param height - Height of the viewport.
|
|
33
|
+
* @param minZoom - Minimum zoom level of the resulting viewport.
|
|
34
|
+
* @param maxZoom - Maximum zoom level of the resulting viewport.
|
|
35
|
+
* @param padding - Padding around the bounds.
|
|
36
|
+
* @returns A transformed {@link Viewport} that encloses the given bounds which you can pass to e.g. {@link setViewport}.
|
|
37
37
|
* @example
|
|
38
38
|
* const { x, y, zoom } = getViewportForBounds(
|
|
39
39
|
* { x: 0, y: 0, width: 100, height: 100},
|
|
@@ -71,4 +71,13 @@ export declare function evaluateAbsolutePosition(position: XYPosition, dimension
|
|
|
71
71
|
height?: number | undefined;
|
|
72
72
|
} | undefined, parentId: string, nodeLookup: NodeLookup, nodeOrigin: NodeOrigin): XYPosition;
|
|
73
73
|
export declare function areSetsEqual(a: Set<string>, b: Set<string>): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Polyfill for Promise.withResolvers until we can use it in all browsers
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
export declare function withResolvers<T>(): {
|
|
79
|
+
promise: Promise<T>;
|
|
80
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
81
|
+
reject: (reason?: unknown) => void;
|
|
82
|
+
};
|
|
74
83
|
//# sourceMappingURL=general.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/utils/general.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,OAAO,EAER,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,eAAO,MAAM,KAAK,QAAS,MAAM,iCAAqB,MAA2C,CAAC;AAElG,eAAO,MAAM,aAAa,2EAGZ,QAAQ,UAAU,CAAC;;;CAI/B,CAAC;AAEH,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,QAAQ,EAC7D,aAAa,EAAE,UAAU,EACzB,eAAe,EAAE,UAAU,EAC3B,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC;;;EAanC;AAoBD,eAAO,MAAM,WAAW,QACjB,UAAU,UACP,UAAU,UACX,MAAM,aACH,MAAM,KACf,MAAM,EAKR,CAAC;AAEF,eAAO,MAAM,gBAAgB,SAAU,GAAG,QAAQ,GAAG,KAAG,GAKtD,CAAC;AAEH,eAAO,MAAM,SAAS,4BAA6B,IAAI,KAAG,GAKxD,CAAC;AAEH,eAAO,MAAM,SAAS,qBAAsB,GAAG,KAAG,IAKhD,CAAC;AAEH,eAAO,MAAM,UAAU,SAAU,gBAAgB,GAAG,QAAQ,8BAAoC,IAW/F,CAAC;AAEF,eAAO,MAAM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AAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAKpC;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAK/F;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,UAAU,EACpB,UAAU;;;aAA+D,EACzE,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,GACrB,UAAU,CAWZ;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,WAY1D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,KAAK;IAClC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC7C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC,CASA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Transform, type XYPosition, type Rect, type NodeOrigin, type NodeBase, type EdgeBase, type FitViewParamsBase, type FitViewOptionsBase, CoordinateExtent, OnError, OnBeforeDeleteBase, NodeLookup, InternalNodeBase, NodeDragItem } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
* Test whether an object is
|
|
3
|
+
* Test whether an object is usable as an Edge
|
|
4
4
|
* @public
|
|
5
5
|
* @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Edge if it returns true
|
|
6
6
|
* @param element - The element to test
|
|
@@ -8,7 +8,7 @@ import { type Transform, type XYPosition, type Rect, type NodeOrigin, type NodeB
|
|
|
8
8
|
*/
|
|
9
9
|
export declare const isEdgeBase: <EdgeType extends EdgeBase = EdgeBase>(element: any) => element is EdgeType;
|
|
10
10
|
/**
|
|
11
|
-
* Test whether an object is
|
|
11
|
+
* Test whether an object is usable as a Node
|
|
12
12
|
* @public
|
|
13
13
|
* @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Node if it returns true
|
|
14
14
|
* @param element - The element to test
|
|
@@ -20,10 +20,10 @@ export declare const isInternalNodeBase: <NodeType extends InternalNodeBase = In
|
|
|
20
20
|
* This util is used to tell you what nodes, if any, are connected to the given node
|
|
21
21
|
* as the _target_ of an edge.
|
|
22
22
|
* @public
|
|
23
|
-
* @param node - The node to get the connected nodes from
|
|
24
|
-
* @param nodes - The array of all nodes
|
|
25
|
-
* @param edges - The array of all edges
|
|
26
|
-
* @returns An array of nodes that are connected over
|
|
23
|
+
* @param node - The node to get the connected nodes from.
|
|
24
|
+
* @param nodes - The array of all nodes.
|
|
25
|
+
* @param edges - The array of all edges.
|
|
26
|
+
* @returns An array of nodes that are connected over edges where the source is the given node.
|
|
27
27
|
*
|
|
28
28
|
* @example
|
|
29
29
|
* ```ts
|
|
@@ -46,10 +46,10 @@ export declare const getOutgoers: <NodeType extends NodeBase = NodeBase, EdgeTyp
|
|
|
46
46
|
* This util is used to tell you what nodes, if any, are connected to the given node
|
|
47
47
|
* as the _source_ of an edge.
|
|
48
48
|
* @public
|
|
49
|
-
* @param node - The node to get the connected nodes from
|
|
50
|
-
* @param nodes - The array of all nodes
|
|
51
|
-
* @param edges - The array of all edges
|
|
52
|
-
* @returns An array of nodes that are connected over
|
|
49
|
+
* @param node - The node to get the connected nodes from.
|
|
50
|
+
* @param nodes - The array of all nodes.
|
|
51
|
+
* @param edges - The array of all edges.
|
|
52
|
+
* @returns An array of nodes that are connected over edges where the target is the given node.
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
|
@@ -70,6 +70,10 @@ export declare const getIncomers: <NodeType extends NodeBase = NodeBase, EdgeTyp
|
|
|
70
70
|
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[];
|
|
71
71
|
export declare const getNodePositionWithOrigin: (node: NodeBase, nodeOrigin?: NodeOrigin) => XYPosition;
|
|
72
72
|
export type GetNodesBoundsParams<NodeType extends NodeBase = NodeBase> = {
|
|
73
|
+
/**
|
|
74
|
+
* Origin of the nodes: `[0, 0]` for top-left, `[0.5, 0.5]` for center.
|
|
75
|
+
* @default [0, 0]
|
|
76
|
+
*/
|
|
73
77
|
nodeOrigin?: NodeOrigin;
|
|
74
78
|
nodeLookup?: NodeLookup<InternalNodeBase<NodeType>>;
|
|
75
79
|
};
|
|
@@ -79,9 +83,8 @@ export type GetNodesBoundsParams<NodeType extends NodeBase = NodeBase> = {
|
|
|
79
83
|
* to calculate the correct transform to fit the given nodes in a viewport.
|
|
80
84
|
* @public
|
|
81
85
|
* @remarks Useful when combined with {@link getViewportForBounds} to calculate the correct transform to fit the given nodes in a viewport.
|
|
82
|
-
* @param nodes - Nodes to calculate the bounds for
|
|
83
|
-
* @
|
|
84
|
-
* @returns Bounding box enclosing all nodes
|
|
86
|
+
* @param nodes - Nodes to calculate the bounds for.
|
|
87
|
+
* @returns Bounding box enclosing all nodes.
|
|
85
88
|
*
|
|
86
89
|
* @remarks This function was previously called `getRectOfNodes`
|
|
87
90
|
*
|
|
@@ -124,9 +127,9 @@ export declare const getNodesInside: <NodeType extends NodeBase = NodeBase>(node
|
|
|
124
127
|
* This utility filters an array of edges, keeping only those where either the source or target
|
|
125
128
|
* node is present in the given array of nodes.
|
|
126
129
|
* @public
|
|
127
|
-
* @param nodes - Nodes you want to get the connected edges for
|
|
128
|
-
* @param edges - All edges
|
|
129
|
-
* @returns Array of edges that connect any of the given nodes with each other
|
|
130
|
+
* @param nodes - Nodes you want to get the connected edges for.
|
|
131
|
+
* @param edges - All edges.
|
|
132
|
+
* @returns Array of edges that connect any of the given nodes with each other.
|
|
130
133
|
*
|
|
131
134
|
* @example
|
|
132
135
|
* ```js
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/utils/graph.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACb,MAAM,UAAU,CAAC;AAGlB;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,kDAAmD,GAAG,wBACd,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,kDAAmD,GAAG,wBACiB,CAAC;AAE/F,eAAO,MAAM,kBAAkB,kEACpB,GAAG,wBACyG,CAAC;AAExH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,qFAChB,QAAQ,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,SACxB,QAAQ,EAAE,SACV,QAAQ,EAAE,KAChB,QAAQ,EAaV,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,WAAW,qFAChB,QAAQ,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,SACxB,QAAQ,EAAE,SACV,QAAQ,EAAE,KAChB,QAAQ,EAYV,CAAC;AAEF,eAAO,MAAM,yBAAyB,SAAU,QAAQ,8BAAoC,UAU3F,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,IAAI;IACvE,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;CACrD,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/utils/graph.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,E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