@xyflow/system 0.0.14 → 0.0.15
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/esm/index.js +12 -11
- package/dist/esm/index.mjs +12 -11
- package/dist/esm/types/edges.d.ts +18 -0
- package/dist/esm/types/edges.d.ts.map +1 -1
- package/dist/esm/types/handles.d.ts +17 -0
- package/dist/esm/types/handles.d.ts.map +1 -1
- package/dist/esm/types/nodes.d.ts +36 -0
- package/dist/esm/types/nodes.d.ts.map +1 -1
- package/dist/esm/utils/edges/general.d.ts +2 -2
- package/dist/esm/utils/edges/general.d.ts.map +1 -1
- package/dist/esm/utils/graph.d.ts +3 -3
- package/dist/esm/utils/graph.d.ts.map +1 -1
- package/dist/esm/xyhandle/XYHandle.d.ts +2 -0
- package/dist/esm/xyhandle/XYHandle.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/types/edges.d.ts +18 -0
- package/dist/umd/types/edges.d.ts.map +1 -1
- package/dist/umd/types/handles.d.ts +17 -0
- package/dist/umd/types/handles.d.ts.map +1 -1
- package/dist/umd/types/nodes.d.ts +36 -0
- package/dist/umd/types/nodes.d.ts.map +1 -1
- package/dist/umd/utils/edges/general.d.ts +2 -2
- package/dist/umd/utils/edges/general.d.ts.map +1 -1
- package/dist/umd/utils/graph.d.ts +3 -3
- package/dist/umd/utils/graph.d.ts.map +1 -1
- package/dist/umd/xyhandle/XYHandle.d.ts +2 -0
- package/dist/umd/xyhandle/XYHandle.d.ts.map +1 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -128,7 +128,7 @@ const isNodeBase = (element) => 'id' in element && !('source' in element) && !('
|
|
|
128
128
|
* @param edges - The array of all edges
|
|
129
129
|
* @returns An array of nodes that are connected over eges where the source is the given node
|
|
130
130
|
*/
|
|
131
|
-
const
|
|
131
|
+
const getOutgoers = (node, nodes, edges) => {
|
|
132
132
|
if (!node.id) {
|
|
133
133
|
return [];
|
|
134
134
|
}
|
|
@@ -148,7 +148,7 @@ const getOutgoersBase = (node, nodes, edges) => {
|
|
|
148
148
|
* @param edges - The array of all edges
|
|
149
149
|
* @returns An array of nodes that are connected over eges where the target is the given node
|
|
150
150
|
*/
|
|
151
|
-
const
|
|
151
|
+
const getIncomers = (node, nodes, edges) => {
|
|
152
152
|
if (!node.id) {
|
|
153
153
|
return [];
|
|
154
154
|
}
|
|
@@ -200,7 +200,7 @@ const getNodesBounds = (nodes, nodeOrigin = [0, 0]) => {
|
|
|
200
200
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
201
201
|
}
|
|
202
202
|
const box = nodes.reduce((currBox, node) => {
|
|
203
|
-
const { x, y } = getNodePositionWithOrigin(node, node.origin || nodeOrigin)
|
|
203
|
+
const { x, y } = getNodePositionWithOrigin(node, node.origin || nodeOrigin);
|
|
204
204
|
return getBoundsOfBoxes(currBox, rectToBox({
|
|
205
205
|
x,
|
|
206
206
|
y,
|
|
@@ -243,7 +243,7 @@ excludeNonSelectableNodes = false, nodeOrigin = [0, 0]) => {
|
|
|
243
243
|
* @param edges - All edges
|
|
244
244
|
* @returns Array of edges that connect any of the given nodes with each other
|
|
245
245
|
*/
|
|
246
|
-
const
|
|
246
|
+
const getConnectedEdges = (nodes, edges) => {
|
|
247
247
|
const nodeIds = new Set();
|
|
248
248
|
nodes.forEach((node) => {
|
|
249
249
|
nodeIds.add(node.id);
|
|
@@ -346,7 +346,7 @@ async function getElementsToRemove({ nodesToRemove = [], edgesToRemove = [], nod
|
|
|
346
346
|
}
|
|
347
347
|
const edgeIds = edgesToRemove.map((edge) => edge.id);
|
|
348
348
|
const deletableEdges = edges.filter((edge) => edge.deletable !== false);
|
|
349
|
-
const connectedEdges =
|
|
349
|
+
const connectedEdges = getConnectedEdges(matchingNodes, deletableEdges);
|
|
350
350
|
const matchingEdges = connectedEdges;
|
|
351
351
|
for (const edge of deletableEdges) {
|
|
352
352
|
const isIncluded = edgeIds.includes(edge.id);
|
|
@@ -700,7 +700,7 @@ const connectionExists = (edge, edges) => {
|
|
|
700
700
|
* @param edges - The array of all current edges
|
|
701
701
|
* @returns A new array of edges with the new edge added
|
|
702
702
|
*/
|
|
703
|
-
const
|
|
703
|
+
const addEdge = (edgeParams, edges) => {
|
|
704
704
|
if (!edgeParams.source || !edgeParams.target) {
|
|
705
705
|
devWarn('006', errorMessages['error006']());
|
|
706
706
|
return edges;
|
|
@@ -734,7 +734,7 @@ const addEdgeBase = (edgeParams, edges) => {
|
|
|
734
734
|
* @param options.shouldReplaceId - should the id of the old edge be replaced with the new connection id
|
|
735
735
|
* @returns the updated edges array
|
|
736
736
|
*/
|
|
737
|
-
const
|
|
737
|
+
const updateEdge = (oldEdge, newConnection, edges, options = { shouldReplaceId: true }) => {
|
|
738
738
|
const { id: oldEdgeId, ...rest } = oldEdge;
|
|
739
739
|
if (!newConnection.source || !newConnection.target) {
|
|
740
740
|
devWarn('006', errorMessages['error006']());
|
|
@@ -1610,7 +1610,7 @@ function getConnectionStatus(isInsideConnectionRadius, isHandleValid) {
|
|
|
1610
1610
|
|
|
1611
1611
|
const alwaysValid = () => true;
|
|
1612
1612
|
let connectionStartHandle = null;
|
|
1613
|
-
function onPointerDown(event, { connectionMode, connectionRadius, handleId, nodeId, edgeUpdaterType, isTarget, domNode, nodes, lib, autoPanOnConnect, panBy, cancelConnection, onConnectStart, onConnect, onConnectEnd, isValidConnection = alwaysValid, onEdgeUpdateEnd, updateConnection, getTransform, }) {
|
|
1613
|
+
function onPointerDown(event, { connectionMode, connectionRadius, handleId, nodeId, edgeUpdaterType, isTarget, domNode, nodes, lib, autoPanOnConnect, flowId, panBy, cancelConnection, onConnectStart, onConnect, onConnectEnd, isValidConnection = alwaysValid, onEdgeUpdateEnd, updateConnection, getTransform, }) {
|
|
1614
1614
|
// when xyflow is used inside a shadow root we can't use document
|
|
1615
1615
|
const doc = getHostForElement(event.target);
|
|
1616
1616
|
let autoPanId = 0;
|
|
@@ -1674,6 +1674,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
1674
1674
|
isValidConnection,
|
|
1675
1675
|
doc,
|
|
1676
1676
|
lib,
|
|
1677
|
+
flowId,
|
|
1677
1678
|
});
|
|
1678
1679
|
handleDomNode = result.handleDomNode;
|
|
1679
1680
|
connection = result.connection;
|
|
@@ -1729,9 +1730,9 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
1729
1730
|
doc.addEventListener('touchend', onPointerUp);
|
|
1730
1731
|
}
|
|
1731
1732
|
// checks if and returns connection in fom of an object { source: 123, target: 312 }
|
|
1732
|
-
function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, isValidConnection = alwaysValid, }) {
|
|
1733
|
+
function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, flowId, isValidConnection = alwaysValid, }) {
|
|
1733
1734
|
const isTarget = fromType === 'target';
|
|
1734
|
-
const handleDomNode = doc.querySelector(`.${lib}-flow__handle[data-id="${handle?.nodeId}-${handle?.id}-${handle?.type}"]`);
|
|
1735
|
+
const handleDomNode = doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`);
|
|
1735
1736
|
const { x, y } = getEventPosition(event);
|
|
1736
1737
|
const handleBelow = doc.elementFromPoint(x, y);
|
|
1737
1738
|
// we always want to prioritize the handle below the mouse cursor over the closest distance handle,
|
|
@@ -2390,4 +2391,4 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange }) {
|
|
|
2390
2391
|
};
|
|
2391
2392
|
}
|
|
2392
2393
|
|
|
2393
|
-
export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS,
|
|
2394
|
+
export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserProvidedNodes, areConnectionMapsEqual, boxToRect, calcAutoPan, calcNextPosition, clamp, clampPosition, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, fitView, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHostForElement, getIncomers, getMarkerId, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getPositionWithOrigin, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, infiniteExtent, internalsSymbol, isEdgeBase, isEdgeVisible, isInputDOMNode, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeToBox, nodeToRect, panBy, pointToRendererPoint, rectToBox, rendererPointToPoint, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateEdge, updateNodeDimensions };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -128,7 +128,7 @@ const isNodeBase = (element) => 'id' in element && !('source' in element) && !('
|
|
|
128
128
|
* @param edges - The array of all edges
|
|
129
129
|
* @returns An array of nodes that are connected over eges where the source is the given node
|
|
130
130
|
*/
|
|
131
|
-
const
|
|
131
|
+
const getOutgoers = (node, nodes, edges) => {
|
|
132
132
|
if (!node.id) {
|
|
133
133
|
return [];
|
|
134
134
|
}
|
|
@@ -148,7 +148,7 @@ const getOutgoersBase = (node, nodes, edges) => {
|
|
|
148
148
|
* @param edges - The array of all edges
|
|
149
149
|
* @returns An array of nodes that are connected over eges where the target is the given node
|
|
150
150
|
*/
|
|
151
|
-
const
|
|
151
|
+
const getIncomers = (node, nodes, edges) => {
|
|
152
152
|
if (!node.id) {
|
|
153
153
|
return [];
|
|
154
154
|
}
|
|
@@ -200,7 +200,7 @@ const getNodesBounds = (nodes, nodeOrigin = [0, 0]) => {
|
|
|
200
200
|
return { x: 0, y: 0, width: 0, height: 0 };
|
|
201
201
|
}
|
|
202
202
|
const box = nodes.reduce((currBox, node) => {
|
|
203
|
-
const { x, y } = getNodePositionWithOrigin(node, node.origin || nodeOrigin)
|
|
203
|
+
const { x, y } = getNodePositionWithOrigin(node, node.origin || nodeOrigin);
|
|
204
204
|
return getBoundsOfBoxes(currBox, rectToBox({
|
|
205
205
|
x,
|
|
206
206
|
y,
|
|
@@ -243,7 +243,7 @@ excludeNonSelectableNodes = false, nodeOrigin = [0, 0]) => {
|
|
|
243
243
|
* @param edges - All edges
|
|
244
244
|
* @returns Array of edges that connect any of the given nodes with each other
|
|
245
245
|
*/
|
|
246
|
-
const
|
|
246
|
+
const getConnectedEdges = (nodes, edges) => {
|
|
247
247
|
const nodeIds = new Set();
|
|
248
248
|
nodes.forEach((node) => {
|
|
249
249
|
nodeIds.add(node.id);
|
|
@@ -346,7 +346,7 @@ async function getElementsToRemove({ nodesToRemove = [], edgesToRemove = [], nod
|
|
|
346
346
|
}
|
|
347
347
|
const edgeIds = edgesToRemove.map((edge) => edge.id);
|
|
348
348
|
const deletableEdges = edges.filter((edge) => edge.deletable !== false);
|
|
349
|
-
const connectedEdges =
|
|
349
|
+
const connectedEdges = getConnectedEdges(matchingNodes, deletableEdges);
|
|
350
350
|
const matchingEdges = connectedEdges;
|
|
351
351
|
for (const edge of deletableEdges) {
|
|
352
352
|
const isIncluded = edgeIds.includes(edge.id);
|
|
@@ -700,7 +700,7 @@ const connectionExists = (edge, edges) => {
|
|
|
700
700
|
* @param edges - The array of all current edges
|
|
701
701
|
* @returns A new array of edges with the new edge added
|
|
702
702
|
*/
|
|
703
|
-
const
|
|
703
|
+
const addEdge = (edgeParams, edges) => {
|
|
704
704
|
if (!edgeParams.source || !edgeParams.target) {
|
|
705
705
|
devWarn('006', errorMessages['error006']());
|
|
706
706
|
return edges;
|
|
@@ -734,7 +734,7 @@ const addEdgeBase = (edgeParams, edges) => {
|
|
|
734
734
|
* @param options.shouldReplaceId - should the id of the old edge be replaced with the new connection id
|
|
735
735
|
* @returns the updated edges array
|
|
736
736
|
*/
|
|
737
|
-
const
|
|
737
|
+
const updateEdge = (oldEdge, newConnection, edges, options = { shouldReplaceId: true }) => {
|
|
738
738
|
const { id: oldEdgeId, ...rest } = oldEdge;
|
|
739
739
|
if (!newConnection.source || !newConnection.target) {
|
|
740
740
|
devWarn('006', errorMessages['error006']());
|
|
@@ -1610,7 +1610,7 @@ function getConnectionStatus(isInsideConnectionRadius, isHandleValid) {
|
|
|
1610
1610
|
|
|
1611
1611
|
const alwaysValid = () => true;
|
|
1612
1612
|
let connectionStartHandle = null;
|
|
1613
|
-
function onPointerDown(event, { connectionMode, connectionRadius, handleId, nodeId, edgeUpdaterType, isTarget, domNode, nodes, lib, autoPanOnConnect, panBy, cancelConnection, onConnectStart, onConnect, onConnectEnd, isValidConnection = alwaysValid, onEdgeUpdateEnd, updateConnection, getTransform, }) {
|
|
1613
|
+
function onPointerDown(event, { connectionMode, connectionRadius, handleId, nodeId, edgeUpdaterType, isTarget, domNode, nodes, lib, autoPanOnConnect, flowId, panBy, cancelConnection, onConnectStart, onConnect, onConnectEnd, isValidConnection = alwaysValid, onEdgeUpdateEnd, updateConnection, getTransform, }) {
|
|
1614
1614
|
// when xyflow is used inside a shadow root we can't use document
|
|
1615
1615
|
const doc = getHostForElement(event.target);
|
|
1616
1616
|
let autoPanId = 0;
|
|
@@ -1674,6 +1674,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
1674
1674
|
isValidConnection,
|
|
1675
1675
|
doc,
|
|
1676
1676
|
lib,
|
|
1677
|
+
flowId,
|
|
1677
1678
|
});
|
|
1678
1679
|
handleDomNode = result.handleDomNode;
|
|
1679
1680
|
connection = result.connection;
|
|
@@ -1729,9 +1730,9 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
1729
1730
|
doc.addEventListener('touchend', onPointerUp);
|
|
1730
1731
|
}
|
|
1731
1732
|
// checks if and returns connection in fom of an object { source: 123, target: 312 }
|
|
1732
|
-
function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, isValidConnection = alwaysValid, }) {
|
|
1733
|
+
function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, flowId, isValidConnection = alwaysValid, }) {
|
|
1733
1734
|
const isTarget = fromType === 'target';
|
|
1734
|
-
const handleDomNode = doc.querySelector(`.${lib}-flow__handle[data-id="${handle?.nodeId}-${handle?.id}-${handle?.type}"]`);
|
|
1735
|
+
const handleDomNode = doc.querySelector(`.${lib}-flow__handle[data-id="${flowId}-${handle?.nodeId}-${handle?.id}-${handle?.type}"]`);
|
|
1735
1736
|
const { x, y } = getEventPosition(event);
|
|
1736
1737
|
const handleBelow = doc.elementFromPoint(x, y);
|
|
1737
1738
|
// we always want to prioritize the handle below the mouse cursor over the closest distance handle,
|
|
@@ -2390,4 +2391,4 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange }) {
|
|
|
2390
2391
|
};
|
|
2391
2392
|
}
|
|
2392
2393
|
|
|
2393
|
-
export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS,
|
|
2394
|
+
export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, XY_RESIZER_HANDLE_POSITIONS, XY_RESIZER_LINE_POSITIONS, addEdge, adoptUserProvidedNodes, areConnectionMapsEqual, boxToRect, calcAutoPan, calcNextPosition, clamp, clampPosition, createMarkerIds, devWarn, elementSelectionKeys, errorMessages, fitView, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getDimensions, getEdgeCenter, getEdgePosition, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHostForElement, getIncomers, getMarkerId, getNodePositionWithOrigin, getNodeToolbarTransform, getNodesBounds, getNodesInside, getOutgoers, getOverlappingArea, getPointerPosition, getPositionWithOrigin, getSmoothStepPath, getStraightPath, getViewportForBounds, handleConnectionChange, infiniteExtent, internalsSymbol, isEdgeBase, isEdgeVisible, isInputDOMNode, isMacOs, isMouseEvent, isNodeBase, isNumeric, isRectObject, nodeToBox, nodeToRect, panBy, pointToRendererPoint, rectToBox, rendererPointToPoint, snapPosition, updateAbsolutePositions, updateConnectionLookup, updateEdge, updateNodeDimensions };
|
|
@@ -1,21 +1,39 @@
|
|
|
1
1
|
import { Position } from './utils';
|
|
2
2
|
export type EdgeBase<EdgeData = any> = {
|
|
3
|
+
/** Unique id of an edge */
|
|
3
4
|
id: string;
|
|
5
|
+
/** Type of an edge defined in edgeTypes */
|
|
4
6
|
type?: string;
|
|
7
|
+
/** Id of source node */
|
|
5
8
|
source: string;
|
|
9
|
+
/** Id of target node */
|
|
6
10
|
target: string;
|
|
11
|
+
/** Id of source handle
|
|
12
|
+
* only needed if there are multiple handles per node
|
|
13
|
+
*/
|
|
7
14
|
sourceHandle?: string | null;
|
|
15
|
+
/** Id of target handle
|
|
16
|
+
* only needed if there are multiple handles per node
|
|
17
|
+
*/
|
|
8
18
|
targetHandle?: string | null;
|
|
9
19
|
animated?: boolean;
|
|
10
20
|
hidden?: boolean;
|
|
11
21
|
deletable?: boolean;
|
|
12
22
|
selectable?: boolean;
|
|
23
|
+
/** Arbitrary data passed to an edge */
|
|
13
24
|
data?: EdgeData;
|
|
14
25
|
selected?: boolean;
|
|
26
|
+
/** Set the marker on the beginning of an edge
|
|
27
|
+
* @example 'arrow', 'arrowclosed' or custom marker
|
|
28
|
+
*/
|
|
15
29
|
markerStart?: EdgeMarkerType;
|
|
30
|
+
/** Set the marker on the end of an edge
|
|
31
|
+
* @example 'arrow', 'arrowclosed' or custom marker
|
|
32
|
+
*/
|
|
16
33
|
markerEnd?: EdgeMarkerType;
|
|
17
34
|
zIndex?: number;
|
|
18
35
|
ariaLabel?: string;
|
|
36
|
+
/** Padding around the edge where interaction is still possible */
|
|
19
37
|
interactionWidth?: number;
|
|
20
38
|
};
|
|
21
39
|
export type SmoothStepPathOptions = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../src/types/edges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC,MAAM,MAAM,QAAQ,CAAC,QAAQ,GAAG,GAAG,IAAI;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,M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|
|
|
22
22
|
y: number;
|
|
23
23
|
};
|
|
24
24
|
export type HandleProps = {
|
|
25
|
+
/** Type of the handle
|
|
26
|
+
* @example HandleType.Source, HandleType.Target
|
|
27
|
+
*/
|
|
25
28
|
type: HandleType;
|
|
29
|
+
/** Position of the handle
|
|
30
|
+
* @example Position.TopLeft, Position.TopRight,
|
|
31
|
+
* Position.BottomLeft, Position.BottomRight
|
|
32
|
+
*/
|
|
26
33
|
position: Position;
|
|
34
|
+
/** Should you be able to connect to/from this handle */
|
|
27
35
|
isConnectable?: boolean;
|
|
36
|
+
/** Should you be able to connect from this handle */
|
|
28
37
|
isConnectableStart?: boolean;
|
|
38
|
+
/** Should you be able to connect to this handle */
|
|
29
39
|
isConnectableEnd?: boolean;
|
|
40
|
+
/** Callback called when connection is made */
|
|
30
41
|
onConnect?: OnConnect;
|
|
42
|
+
/** Callback if connection is valid
|
|
43
|
+
* @remarks connection becomes an edge if isValidConnection returns true
|
|
44
|
+
*/
|
|
31
45
|
isValidConnection?: IsValidConnection;
|
|
46
|
+
/** Id of the handle
|
|
47
|
+
* @remarks optional if there is only one handle of this type
|
|
48
|
+
*/
|
|
32
49
|
id?: string;
|
|
33
50
|
};
|
|
34
51
|
//# sourceMappingURL=handles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../src/types/handles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,GAAG,CAAC;AAEhE,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE7C,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EA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AU,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,IAAI,EAAE,UAAU,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,QAAQ,CAAC;IACnB,wDAAwD;IACxD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qDAAqD;IACrD,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mDAAmD;IACnD,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb,CAAC"}
|
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
import { internalsSymbol } from '../constants';
|
|
2
2
|
import type { XYPosition, Position, CoordinateExtent, HandleElement } from '.';
|
|
3
3
|
import { Optional } from '../utils/types';
|
|
4
|
+
/**
|
|
5
|
+
* Framework independent node data structure.
|
|
6
|
+
*
|
|
7
|
+
* @typeParam T - type of the node data
|
|
8
|
+
* @typeParam U - type of the node
|
|
9
|
+
*/
|
|
4
10
|
export type NodeBase<T = any, U extends string | undefined = string | undefined> = {
|
|
11
|
+
/** Unique id of a node */
|
|
5
12
|
id: string;
|
|
13
|
+
/** Position of a node on the pane
|
|
14
|
+
* @example { x: 0, y: 0 }
|
|
15
|
+
*/
|
|
6
16
|
position: XYPosition;
|
|
17
|
+
/** Arbitrary data passed to a node */
|
|
7
18
|
data: T;
|
|
19
|
+
/** Type of node defined in nodeTypes */
|
|
8
20
|
type?: U;
|
|
21
|
+
/** Only relevant for default, source, target nodeType. controls source position
|
|
22
|
+
* @example 'right', 'left', 'top', 'bottom'
|
|
23
|
+
*/
|
|
9
24
|
sourcePosition?: Position;
|
|
25
|
+
/** Only relevant for default, source, target nodeType. controls target position
|
|
26
|
+
* @example 'right', 'left', 'top', 'bottom'
|
|
27
|
+
*/
|
|
10
28
|
targetPosition?: Position;
|
|
11
29
|
hidden?: boolean;
|
|
12
30
|
selected?: boolean;
|
|
31
|
+
/** True, if node is being dragged */
|
|
13
32
|
dragging?: boolean;
|
|
14
33
|
draggable?: boolean;
|
|
15
34
|
selectable?: boolean;
|
|
@@ -18,11 +37,21 @@ export type NodeBase<T = any, U extends string | undefined = string | undefined>
|
|
|
18
37
|
dragHandle?: string;
|
|
19
38
|
width?: number | null;
|
|
20
39
|
height?: number | null;
|
|
40
|
+
/** Parent node id, used for creating sub-flows */
|
|
21
41
|
parentNode?: string;
|
|
22
42
|
zIndex?: number;
|
|
43
|
+
/** Boundary a node can be moved in
|
|
44
|
+
* @example 'parent' or [[0, 0], [100, 100]]
|
|
45
|
+
*/
|
|
23
46
|
extent?: 'parent' | CoordinateExtent;
|
|
24
47
|
expandParent?: boolean;
|
|
25
48
|
ariaLabel?: string;
|
|
49
|
+
/** Origin of the node relative to it's position
|
|
50
|
+
* @example
|
|
51
|
+
* [0.5, 0.5] // centers the node
|
|
52
|
+
* [0, 0] // top left
|
|
53
|
+
* [1, 1] // bottom right
|
|
54
|
+
*/
|
|
26
55
|
origin?: NodeOrigin;
|
|
27
56
|
handles?: NodeHandle[];
|
|
28
57
|
computed?: {
|
|
@@ -40,7 +69,14 @@ export type NodeBase<T = any, U extends string | undefined = string | undefined>
|
|
|
40
69
|
userProvidedNode: NodeBase<T, U>;
|
|
41
70
|
};
|
|
42
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* The node data structure that gets used for the nodes prop.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
* @param id - The id of the node.
|
|
77
|
+
*/
|
|
43
78
|
export type NodeProps<T = any> = {
|
|
79
|
+
/** Id of the node */
|
|
44
80
|
id: NodeBase['id'];
|
|
45
81
|
data: T;
|
|
46
82
|
dragHandle: NodeBase['dragHandle'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/types/nodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/types/nodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAAI;IACjF,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX;;OAEG;IACH,QAAQ,EAAE,UAAU,CAAC;IACrB,sCAAsC;IACtC,IAAI,EAAE,CAAC,CAAC;IACR,wCAAwC;IACxC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT;;OAEG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B;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G,IAAI,CAAC;QACtB,gBAAgB,EAAE,UAAU,CAAC;KAC9B,CAAC;IACF,MAAM,CAAC,EAAE,QAAQ,GAAG,gBAAgB,CAAC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1C,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;AAExF,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;AAE7E,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC;AAErE,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/C,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -30,7 +30,7 @@ export declare function isEdgeVisible({ sourceNode, targetNode, width, height, t
|
|
|
30
30
|
* @param edges - The array of all current edges
|
|
31
31
|
* @returns A new array of edges with the new edge added
|
|
32
32
|
*/
|
|
33
|
-
export declare const
|
|
33
|
+
export declare const addEdge: <EdgeType extends EdgeBase<any>>(edgeParams: Connection | EdgeType, edges: EdgeType[]) => EdgeType[];
|
|
34
34
|
export type UpdateEdgeOptions = {
|
|
35
35
|
shouldReplaceId?: boolean;
|
|
36
36
|
};
|
|
@@ -42,6 +42,6 @@ export type UpdateEdgeOptions = {
|
|
|
42
42
|
* @param options.shouldReplaceId - should the id of the old edge be replaced with the new connection id
|
|
43
43
|
* @returns the updated edges array
|
|
44
44
|
*/
|
|
45
|
-
export declare const
|
|
45
|
+
export declare const updateEdge: <EdgeType extends EdgeBase<any>>(oldEdge: EdgeType, newConnection: Connection, edges: EdgeType[], options?: UpdateEdgeOptions) => EdgeType[];
|
|
46
46
|
export {};
|
|
47
47
|
//# sourceMappingURL=general.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/general.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAA8C,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAIjD,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,EAAE,MAAM,CAAC;CACjB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAQnC;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,QAAQ,CAAC;IACrB,UAAU,EAAE,QAAQ,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,EACV,UAAU,EACV,QAAgB,EAChB,MAAU,EACV,eAAuB,GACxB,EAAE,mBAAmB,GAAG,MAAM,CAS9B;AAED,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,QAAQ,CAAC;IACrB,UAAU,EAAE,QAAQ,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,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,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAmBhH;AAeD;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,sGAiCnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,qEAEN,UAAU,+BAEhB,iBAAiB,eA6B3B,CAAC"}
|
|
@@ -23,7 +23,7 @@ export declare const isNodeBase: <NodeType extends NodeBase<any, string | undefi
|
|
|
23
23
|
* @param edges - The array of all edges
|
|
24
24
|
* @returns An array of nodes that are connected over eges where the source is the given node
|
|
25
25
|
*/
|
|
26
|
-
export declare const
|
|
26
|
+
export declare const getOutgoers: <NodeType extends NodeBase<any, string | undefined> = NodeBase<any, string | undefined>, EdgeType extends EdgeBase<any> = EdgeBase<any>>(node: NodeType | {
|
|
27
27
|
id: string;
|
|
28
28
|
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[];
|
|
29
29
|
/**
|
|
@@ -34,7 +34,7 @@ export declare const getOutgoersBase: <NodeType extends NodeBase<any, string | u
|
|
|
34
34
|
* @param edges - The array of all edges
|
|
35
35
|
* @returns An array of nodes that are connected over eges where the target is the given node
|
|
36
36
|
*/
|
|
37
|
-
export declare const
|
|
37
|
+
export declare const getIncomers: <NodeType extends NodeBase<any, string | undefined> = NodeBase<any, string | undefined>, EdgeType extends EdgeBase<any> = EdgeBase<any>>(node: NodeType | {
|
|
38
38
|
id: string;
|
|
39
39
|
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[];
|
|
40
40
|
export declare const getNodePositionWithOrigin: (node: NodeBase | undefined, nodeOrigin?: NodeOrigin) => XYPosition & {
|
|
@@ -56,7 +56,7 @@ export declare const getNodesInside: <NodeType extends NodeBase<any, string | un
|
|
|
56
56
|
* @param edges - All edges
|
|
57
57
|
* @returns Array of edges that connect any of the given nodes with each other
|
|
58
58
|
*/
|
|
59
|
-
export declare const
|
|
59
|
+
export declare const getConnectedEdges: <NodeType extends NodeBase<any, string | undefined> = NodeBase<any, string | undefined>, EdgeType extends EdgeBase<any> = EdgeBase<any>>(nodes: NodeType[], edges: EdgeType[]) => EdgeType[];
|
|
60
60
|
export declare function fitView<Params extends FitViewParamsBase<NodeBase>, Options extends FitViewOptionsBase<NodeBase>>({ nodes, width, height, panZoom, minZoom, maxZoom, nodeOrigin }: Params, options?: Options): boolean;
|
|
61
61
|
export declare function calcNextPosition<NodeType extends NodeBase>(node: NodeDragItem | NodeType, nextPosition: XYPosition, nodes: NodeType[], nodeExtent?: CoordinateExtent, nodeOrigin?: NodeOrigin, onError?: OnError): {
|
|
62
62
|
position: XYPosition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/utils/graph.ts"],"names":[],"mappings":"AAYA,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,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,cAAc,EACf,MAAM,UAAU,CAAC;AAGlB;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,4DAAmD,GAAG,wBACd,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,oGAAmD,GAAG,wBACR,CAAC;AAEtE;;;;;;;GAOG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/utils/graph.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK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gB,EAAE,UAAU,CAAA;CAAE,CAoDxD;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,EAAE,QAAQ,SAAS,QAAQ,GAAG,QAAQ,EAAE,EACpH,aAAkB,EAClB,aAAkB,EAClB,KAAK,EACL,KAAK,EACL,cAAc,GACf,EAAE;IACD,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC,GAAG,OAAO,CAAC;IACV,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC,CA+CD"}
|
|
@@ -9,6 +9,7 @@ export type OnPointerDownParams = {
|
|
|
9
9
|
isTarget: boolean;
|
|
10
10
|
nodes: NodeBase[];
|
|
11
11
|
lib: string;
|
|
12
|
+
flowId: string | null;
|
|
12
13
|
edgeUpdaterType?: HandleType;
|
|
13
14
|
updateConnection: UpdateConnection;
|
|
14
15
|
panBy: PanBy;
|
|
@@ -29,6 +30,7 @@ export type IsValidParams = {
|
|
|
29
30
|
isValidConnection?: IsValidConnection;
|
|
30
31
|
doc: Document | ShadowRoot;
|
|
31
32
|
lib: string;
|
|
33
|
+
flowId: string | null;
|
|
32
34
|
};
|
|
33
35
|
export type XYHandleInstance = {
|
|
34
36
|
onPointerDown: (event: MouseEvent | TouchEvent, params: OnPointerDownParams) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XYHandle.d.ts","sourceRoot":"","sources":["../../src/xyhandle/XYHandle.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,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