@xyflow/system 0.0.73 → 0.0.74
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 +50 -26
- package/dist/esm/index.mjs +50 -26
- package/dist/esm/types/general.d.ts +9 -0
- package/dist/esm/types/general.d.ts.map +1 -1
- package/dist/esm/utils/edges/general.d.ts +27 -3
- package/dist/esm/utils/edges/general.d.ts.map +1 -1
- package/dist/esm/utils/store.d.ts +4 -1
- package/dist/esm/utils/store.d.ts.map +1 -1
- package/dist/esm/xyhandle/XYHandle.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/types/general.d.ts +9 -0
- package/dist/umd/types/general.d.ts.map +1 -1
- package/dist/umd/utils/edges/general.d.ts +27 -3
- package/dist/umd/utils/edges/general.d.ts.map +1 -1
- package/dist/umd/utils/store.d.ts +4 -1
- package/dist/umd/utils/store.d.ts.map +1 -1
- package/dist/umd/xyhandle/XYHandle.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Connection, InternalNodeBase, Transform, EdgeBase } from '../..';
|
|
1
|
+
import { Connection, InternalNodeBase, Transform, EdgeBase, ZIndexMode } from '../..';
|
|
2
2
|
export declare function getEdgeCenter({ sourceX, sourceY, targetX, targetY, }: {
|
|
3
3
|
sourceX: number;
|
|
4
4
|
sourceY: number;
|
|
@@ -11,13 +11,14 @@ export type GetEdgeZIndexParams = {
|
|
|
11
11
|
selected?: boolean;
|
|
12
12
|
zIndex?: number;
|
|
13
13
|
elevateOnSelect?: boolean;
|
|
14
|
+
zIndexMode?: ZIndexMode;
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
16
17
|
* Returns the z-index for an edge based on the node it connects and whether it is selected.
|
|
17
18
|
* By default, edges are rendered below nodes. This behaviour is different for edges that are
|
|
18
19
|
* connected to nodes with a parent, as they are rendered above the parent node.
|
|
19
20
|
*/
|
|
20
|
-
export declare function getElevatedEdgeZIndex({ sourceNode, targetNode, selected, zIndex, elevateOnSelect, }: GetEdgeZIndexParams): number;
|
|
21
|
+
export declare function getElevatedEdgeZIndex({ sourceNode, targetNode, selected, zIndex, elevateOnSelect, zIndexMode, }: GetEdgeZIndexParams): number;
|
|
21
22
|
type IsEdgeVisibleParams = {
|
|
22
23
|
sourceNode: InternalNodeBase;
|
|
23
24
|
targetNode: InternalNodeBase;
|
|
@@ -26,11 +27,30 @@ type IsEdgeVisibleParams = {
|
|
|
26
27
|
transform: Transform;
|
|
27
28
|
};
|
|
28
29
|
export declare function isEdgeVisible({ sourceNode, targetNode, width, height, transform }: IsEdgeVisibleParams): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Type for a custom edge ID generator function.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
export type GetEdgeId = (params: Connection | EdgeBase) => string;
|
|
35
|
+
/**
|
|
36
|
+
* The default edge ID generator function. Generates an ID based on the source, target, and handles.
|
|
37
|
+
* @public
|
|
38
|
+
* @param params - The connection or edge to generate an ID for.
|
|
39
|
+
* @returns The generated edge ID.
|
|
40
|
+
*/
|
|
41
|
+
export declare const getEdgeId: ({ source, sourceHandle, target, targetHandle }: Connection | EdgeBase) => string;
|
|
42
|
+
export type AddEdgeOptions = {
|
|
43
|
+
/**
|
|
44
|
+
* Custom function to generate edge IDs. If not provided, the default `getEdgeId` function is used.
|
|
45
|
+
*/
|
|
46
|
+
getEdgeId?: GetEdgeId;
|
|
47
|
+
};
|
|
29
48
|
/**
|
|
30
49
|
* 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.
|
|
31
50
|
* @public
|
|
32
51
|
* @param edgeParams - Either an `Edge` or a `Connection` you want to add.
|
|
33
52
|
* @param edges - The array of all current edges.
|
|
53
|
+
* @param options - Optional configuration object.
|
|
34
54
|
* @returns A new array of edges with the new edge added.
|
|
35
55
|
*
|
|
36
56
|
* @remarks If an edge with the same `target` and `source` already exists (and the same
|
|
@@ -38,13 +58,17 @@ export declare function isEdgeVisible({ sourceNode, targetNode, width, height, t
|
|
|
38
58
|
*a new edge even if the `id` property is different.
|
|
39
59
|
*
|
|
40
60
|
*/
|
|
41
|
-
export declare const addEdge: <EdgeType extends EdgeBase>(edgeParams: EdgeType | Connection, edges: EdgeType[]) => EdgeType[];
|
|
61
|
+
export declare const addEdge: <EdgeType extends EdgeBase>(edgeParams: EdgeType | Connection, edges: EdgeType[], options?: AddEdgeOptions) => EdgeType[];
|
|
42
62
|
export type ReconnectEdgeOptions = {
|
|
43
63
|
/**
|
|
44
64
|
* Should the id of the old edge be replaced with the new connection id.
|
|
45
65
|
* @default true
|
|
46
66
|
*/
|
|
47
67
|
shouldReplaceId?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Custom function to generate edge IDs. If not provided, the default `getEdgeId` function is used.
|
|
70
|
+
*/
|
|
71
|
+
getEdgeId?: GetEdgeId;
|
|
48
72
|
};
|
|
49
73
|
/**
|
|
50
74
|
* A handy utility to update an existing [`Edge`](/api-reference/types/edge) with new properties.
|
|
@@ -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,CAAC;
|
|
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,UAAU,EAAE,MAAM,OAAO,CAAC;AAIjH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,GACR,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAA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,QAAQ,EAgCV,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,SAAS,QAAQ,WAC5C,QAAQ,iBACF,UAAU,SAClB,QAAQ,EAAE,YACR,oBAAoB,KAC5B,QAAQ,EA8BV,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ZIndexMode } from '..';
|
|
1
2
|
import { NodeBase, CoordinateExtent, InternalNodeUpdate, NodeOrigin, PanZoomInstance, Transform, XYPosition, ConnectionLookup, EdgeBase, EdgeLookup, InternalNodeBase, NodeLookup, NodeDimensionChange, NodePositionChange, ParentLookup } from '../types';
|
|
2
3
|
import { ParentExpandChild } from './types';
|
|
3
4
|
export declare function updateAbsolutePositions<NodeType extends NodeBase>(nodeLookup: NodeLookup<InternalNodeBase<NodeType>>, parentLookup: ParentLookup<InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): void;
|
|
@@ -6,11 +7,13 @@ type UpdateNodesOptions<NodeType extends NodeBase> = {
|
|
|
6
7
|
nodeExtent?: CoordinateExtent;
|
|
7
8
|
elevateNodesOnSelect?: boolean;
|
|
8
9
|
defaults?: Partial<NodeType>;
|
|
10
|
+
zIndexMode?: ZIndexMode;
|
|
9
11
|
checkEquality?: boolean;
|
|
10
12
|
};
|
|
13
|
+
export declare function isManualZIndexMode(zIndexMode?: ZIndexMode): boolean;
|
|
11
14
|
export declare function adoptUserNodes<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: NodeLookup<InternalNodeBase<NodeType>>, parentLookup: ParentLookup<InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): boolean;
|
|
12
15
|
export declare function handleExpandParent(children: ParentExpandChild[], nodeLookup: NodeLookup, parentLookup: ParentLookup, nodeOrigin?: NodeOrigin): (NodeDimensionChange | NodePositionChange)[];
|
|
13
|
-
export declare function updateNodeInternals<NodeType extends InternalNodeBase>(updates: Map<string, InternalNodeUpdate>, nodeLookup: NodeLookup<NodeType>, parentLookup: ParentLookup<NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin, nodeExtent?: CoordinateExtent): {
|
|
16
|
+
export declare function updateNodeInternals<NodeType extends InternalNodeBase>(updates: Map<string, InternalNodeUpdate>, nodeLookup: NodeLookup<NodeType>, parentLookup: ParentLookup<NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin, nodeExtent?: CoordinateExtent, zIndexMode?: ZIndexMode): {
|
|
14
17
|
changes: (NodeDimensionChange | NodePositionChange)[];
|
|
15
18
|
updatedInternals: boolean;
|
|
16
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/utils/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/utils/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,UAAU,EAAE,MAAM,IAAI,CAAC;AAC5F,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,UAAU,EAEV,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAYlB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA8B5C,wBAAgB,uBAAuB,CAAC,QAAQ,SAAS,QAAQ,EAC/D,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAClD,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EACtD,OAAO,CAAC,EAAE,kBAAkB,CAA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,kBAAkB,CAAC,EAAE,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,CAgGtF;AAED,wBAAsB,KAAK,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,SAAS,EACT,eAAe,EACf,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,gBAAgB,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBnB;AAwCD,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,QAgBnH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XYHandle.d.ts","sourceRoot":"","sources":["../../src/xyhandle/XYHandle.ts"],"names":[],"mappings":"AAkBA,OAAO,EAA8C,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"XYHandle.d.ts","sourceRoot":"","sources":["../../src/xyhandle/XYHandle.ts"],"names":[],"mappings":"AAkBA,OAAO,EAA8C,gBAAgB,EAAE,MAAM,SAAS,CAAC;AA6SvF,eAAO,MAAM,QAAQ,EAAE,gBAGtB,CAAC"}
|