@uipath/apollo-react 4.18.0 → 4.18.1
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/canvas/components/AddNodePanel/AddNodeManager.helpers.cjs +58 -4
- package/dist/canvas/components/AddNodePanel/AddNodeManager.helpers.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodeManager.helpers.js +59 -5
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +19 -0
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +19 -0
- package/dist/canvas/components/LoopNode/LoopNode.cjs +13 -13
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.js +13 -13
- package/dist/canvas/components/LoopNode/LoopNodePreview.cjs +3 -1
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNodePreview.js +3 -1
- package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/mocks/nodes.d.ts +6 -6
- package/dist/canvas/storybook-utils/mocks/nodes.d.ts.map +1 -1
- package/dist/canvas/utils/NodeUtils.cjs +15 -3
- package/dist/canvas/utils/NodeUtils.d.ts +5 -1
- package/dist/canvas/utils/NodeUtils.d.ts.map +1 -1
- package/dist/canvas/utils/NodeUtils.js +15 -3
- package/dist/canvas/utils/container.cjs +68 -41
- package/dist/canvas/utils/container.d.ts +17 -4
- package/dist/canvas/utils/container.d.ts.map +1 -1
- package/dist/canvas/utils/container.js +64 -40
- package/dist/canvas/utils/createPreviewGraph.cjs +14 -2
- package/dist/canvas/utils/createPreviewGraph.d.ts +2 -0
- package/dist/canvas/utils/createPreviewGraph.d.ts.map +1 -1
- package/dist/canvas/utils/createPreviewGraph.js +14 -2
- package/dist/canvas/utils/createPreviewNode.cjs +8 -5
- package/dist/canvas/utils/createPreviewNode.d.ts +21 -7
- package/dist/canvas/utils/createPreviewNode.d.ts.map +1 -1
- package/dist/canvas/utils/createPreviewNode.js +8 -5
- package/package.json +1 -1
|
@@ -29,9 +29,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
alignNodeToPreview: ()=>alignNodeToPreview
|
|
30
30
|
});
|
|
31
31
|
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
32
|
+
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
32
33
|
const index_cjs_namespaceObject = require("../../utils/index.cjs");
|
|
33
34
|
const collapse_cjs_namespaceObject = require("../../utils/collapse.cjs");
|
|
34
35
|
const container_cjs_namespaceObject = require("../../utils/container.cjs");
|
|
36
|
+
const NodeUtils_cjs_namespaceObject = require("../../utils/NodeUtils.cjs");
|
|
37
|
+
const TOP_LEVEL_INSERTION_GAP_PX = 5 * external_constants_cjs_namespaceObject.GRID_SPACING;
|
|
35
38
|
function getOriginalEdge(previewNode) {
|
|
36
39
|
return previewNode?.data?.originalEdge ?? null;
|
|
37
40
|
}
|
|
@@ -106,11 +109,55 @@ function resolveScopedCollisions(nodes, insertedNode, options) {
|
|
|
106
109
|
insertedNode: resolvedSiblingById.get(insertedNode.id)
|
|
107
110
|
};
|
|
108
111
|
}
|
|
112
|
+
function shiftForEdgeInsertion({ nodes, edges, previewNode, insertedNode, getNodeSize }) {
|
|
113
|
+
const originalEdge = getOriginalEdge(previewNode);
|
|
114
|
+
if (!originalEdge) return null;
|
|
115
|
+
const targetNode = nodes.find((node)=>node.id === originalEdge.target);
|
|
116
|
+
if (!targetNode || targetNode.parentId !== insertedNode.parentId) return null;
|
|
117
|
+
const insertedSize = getNodeSize(insertedNode);
|
|
118
|
+
let insertedX = insertedNode.position.x;
|
|
119
|
+
const sourceNode = nodes.find((node)=>node.id === originalEdge.source);
|
|
120
|
+
if (sourceNode && sourceNode.parentId === insertedNode.parentId) {
|
|
121
|
+
const sourceSize = getNodeSize(sourceNode);
|
|
122
|
+
const requiredInsertedLeft = sourceNode.position.x + sourceSize.width + TOP_LEVEL_INSERTION_GAP_PX;
|
|
123
|
+
if (insertedX < requiredInsertedLeft) insertedX = (0, NodeUtils_cjs_namespaceObject.snapUpToGrid)(requiredInsertedLeft);
|
|
124
|
+
}
|
|
125
|
+
const requiredTargetLeft = insertedX + insertedSize.width + TOP_LEVEL_INSERTION_GAP_PX;
|
|
126
|
+
const downstreamShift = targetNode.position.x < requiredTargetLeft ? (0, NodeUtils_cjs_namespaceObject.snapUpToGrid)(requiredTargetLeft - targetNode.position.x) : 0;
|
|
127
|
+
const chainIds = downstreamShift > 0 ? new Set((0, container_cjs_namespaceObject.collectLinearDownstreamSiblings)({
|
|
128
|
+
startNodeId: targetNode.id,
|
|
129
|
+
parentId: insertedNode.parentId,
|
|
130
|
+
nodes,
|
|
131
|
+
edges
|
|
132
|
+
})) : new Set();
|
|
133
|
+
const insertedXChanged = insertedX !== insertedNode.position.x;
|
|
134
|
+
if (!insertedXChanged && 0 === downstreamShift) return null;
|
|
135
|
+
const updatedInsertedNode = insertedXChanged ? {
|
|
136
|
+
...insertedNode,
|
|
137
|
+
position: {
|
|
138
|
+
x: insertedX,
|
|
139
|
+
y: insertedNode.position.y
|
|
140
|
+
}
|
|
141
|
+
} : insertedNode;
|
|
142
|
+
const updatedNodes = nodes.map((node)=>{
|
|
143
|
+
if (node.id === insertedNode.id) return updatedInsertedNode;
|
|
144
|
+
if (chainIds.has(node.id)) return {
|
|
145
|
+
...node,
|
|
146
|
+
position: {
|
|
147
|
+
x: node.position.x + downstreamShift,
|
|
148
|
+
y: node.position.y
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
return node;
|
|
152
|
+
});
|
|
153
|
+
return {
|
|
154
|
+
nodes: updatedNodes,
|
|
155
|
+
insertedNode: updatedInsertedNode
|
|
156
|
+
};
|
|
157
|
+
}
|
|
109
158
|
function placeAddedNode({ nodes, edges, previewNode, insertedNode, registry, ignoredNodeTypes }) {
|
|
110
159
|
const getDimensions = (node)=>getManifestAwareNodeDimensions(registry, node);
|
|
111
|
-
const placement = (0, container_cjs_namespaceObject.getContainerPlacement)(
|
|
112
|
-
previewNode
|
|
113
|
-
});
|
|
160
|
+
const placement = (0, container_cjs_namespaceObject.getContainerPlacement)(previewNode);
|
|
114
161
|
if (placement) {
|
|
115
162
|
const containerNode = nodes.find((node)=>node.id === placement.containerId);
|
|
116
163
|
if (!containerNode) return resolveScopedCollisions(nodes, insertedNode, {
|
|
@@ -136,7 +183,14 @@ function placeAddedNode({ nodes, edges, previewNode, insertedNode, registry, ign
|
|
|
136
183
|
insertedNode: resolvedNodes.find((node)=>node.id === insertedNode.id)
|
|
137
184
|
};
|
|
138
185
|
}
|
|
139
|
-
|
|
186
|
+
const shifted = shiftForEdgeInsertion({
|
|
187
|
+
nodes,
|
|
188
|
+
edges,
|
|
189
|
+
previewNode,
|
|
190
|
+
insertedNode,
|
|
191
|
+
getNodeSize: getDimensions
|
|
192
|
+
});
|
|
193
|
+
return resolveScopedCollisions(shifted?.nodes ?? nodes, shifted?.insertedNode ?? insertedNode, {
|
|
140
194
|
ignoredNodeTypes,
|
|
141
195
|
getNodeSize: getDimensions
|
|
142
196
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddNodeManager.helpers.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/AddNodePanel/AddNodeManager.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"AddNodeManager.helpers.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/AddNodePanel/AddNodeManager.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAG3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAsBjD,UAAU,sBAAsB;IAC9B,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,YAAY,EAAE,IAAI,CAAC;CACpB;AAMD,wBAAgB,eAAe,CAAC,WAAW,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAEjF;AAmCD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,IAAI,EACjB,kBAAkB,EAAE,yBAAyB,EAAE,EAC/C,YAAY,EAAE,YAAY,GAAG,SAAS,GACrC,IAAI,CA2DN;AAoHD,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,KAAK,EACL,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,gBAAgB,GACjB,EAAE;IACD,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,WAAW,EAAE,IAAI,CAAC;IAClB,YAAY,EAAE,IAAI,CAAC;IACnB,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B,GAAG,sBAAsB,CAsDzB"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Position } from "../../xyflow/react.js";
|
|
2
|
+
import { GRID_SPACING } from "../../constants.js";
|
|
2
3
|
import { resolveCollisions } from "../../utils/index.js";
|
|
3
4
|
import { getExpandedSize } from "../../utils/collapse.js";
|
|
4
|
-
import { getContainerFitGeometry, getContainerPlacement, getContainerSafeArea, getNodeDimensions, isContainerNodeManifest, placeContainerNode } from "../../utils/container.js";
|
|
5
|
+
import { collectLinearDownstreamSiblings, getContainerFitGeometry, getContainerPlacement, getContainerSafeArea, getNodeDimensions, isContainerNodeManifest, placeContainerNode } from "../../utils/container.js";
|
|
6
|
+
import { snapUpToGrid } from "../../utils/NodeUtils.js";
|
|
7
|
+
const TOP_LEVEL_INSERTION_GAP_PX = 5 * GRID_SPACING;
|
|
5
8
|
function getOriginalEdge(previewNode) {
|
|
6
9
|
return previewNode?.data?.originalEdge ?? null;
|
|
7
10
|
}
|
|
@@ -76,11 +79,55 @@ function resolveScopedCollisions(nodes, insertedNode, options) {
|
|
|
76
79
|
insertedNode: resolvedSiblingById.get(insertedNode.id)
|
|
77
80
|
};
|
|
78
81
|
}
|
|
82
|
+
function shiftForEdgeInsertion({ nodes, edges, previewNode, insertedNode, getNodeSize }) {
|
|
83
|
+
const originalEdge = getOriginalEdge(previewNode);
|
|
84
|
+
if (!originalEdge) return null;
|
|
85
|
+
const targetNode = nodes.find((node)=>node.id === originalEdge.target);
|
|
86
|
+
if (!targetNode || targetNode.parentId !== insertedNode.parentId) return null;
|
|
87
|
+
const insertedSize = getNodeSize(insertedNode);
|
|
88
|
+
let insertedX = insertedNode.position.x;
|
|
89
|
+
const sourceNode = nodes.find((node)=>node.id === originalEdge.source);
|
|
90
|
+
if (sourceNode && sourceNode.parentId === insertedNode.parentId) {
|
|
91
|
+
const sourceSize = getNodeSize(sourceNode);
|
|
92
|
+
const requiredInsertedLeft = sourceNode.position.x + sourceSize.width + TOP_LEVEL_INSERTION_GAP_PX;
|
|
93
|
+
if (insertedX < requiredInsertedLeft) insertedX = snapUpToGrid(requiredInsertedLeft);
|
|
94
|
+
}
|
|
95
|
+
const requiredTargetLeft = insertedX + insertedSize.width + TOP_LEVEL_INSERTION_GAP_PX;
|
|
96
|
+
const downstreamShift = targetNode.position.x < requiredTargetLeft ? snapUpToGrid(requiredTargetLeft - targetNode.position.x) : 0;
|
|
97
|
+
const chainIds = downstreamShift > 0 ? new Set(collectLinearDownstreamSiblings({
|
|
98
|
+
startNodeId: targetNode.id,
|
|
99
|
+
parentId: insertedNode.parentId,
|
|
100
|
+
nodes,
|
|
101
|
+
edges
|
|
102
|
+
})) : new Set();
|
|
103
|
+
const insertedXChanged = insertedX !== insertedNode.position.x;
|
|
104
|
+
if (!insertedXChanged && 0 === downstreamShift) return null;
|
|
105
|
+
const updatedInsertedNode = insertedXChanged ? {
|
|
106
|
+
...insertedNode,
|
|
107
|
+
position: {
|
|
108
|
+
x: insertedX,
|
|
109
|
+
y: insertedNode.position.y
|
|
110
|
+
}
|
|
111
|
+
} : insertedNode;
|
|
112
|
+
const updatedNodes = nodes.map((node)=>{
|
|
113
|
+
if (node.id === insertedNode.id) return updatedInsertedNode;
|
|
114
|
+
if (chainIds.has(node.id)) return {
|
|
115
|
+
...node,
|
|
116
|
+
position: {
|
|
117
|
+
x: node.position.x + downstreamShift,
|
|
118
|
+
y: node.position.y
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
return node;
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
nodes: updatedNodes,
|
|
125
|
+
insertedNode: updatedInsertedNode
|
|
126
|
+
};
|
|
127
|
+
}
|
|
79
128
|
function placeAddedNode({ nodes, edges, previewNode, insertedNode, registry, ignoredNodeTypes }) {
|
|
80
129
|
const getDimensions = (node)=>getManifestAwareNodeDimensions(registry, node);
|
|
81
|
-
const placement = getContainerPlacement(
|
|
82
|
-
previewNode
|
|
83
|
-
});
|
|
130
|
+
const placement = getContainerPlacement(previewNode);
|
|
84
131
|
if (placement) {
|
|
85
132
|
const containerNode = nodes.find((node)=>node.id === placement.containerId);
|
|
86
133
|
if (!containerNode) return resolveScopedCollisions(nodes, insertedNode, {
|
|
@@ -106,7 +153,14 @@ function placeAddedNode({ nodes, edges, previewNode, insertedNode, registry, ign
|
|
|
106
153
|
insertedNode: resolvedNodes.find((node)=>node.id === insertedNode.id)
|
|
107
154
|
};
|
|
108
155
|
}
|
|
109
|
-
|
|
156
|
+
const shifted = shiftForEdgeInsertion({
|
|
157
|
+
nodes,
|
|
158
|
+
edges,
|
|
159
|
+
previewNode,
|
|
160
|
+
insertedNode,
|
|
161
|
+
getNodeSize: getDimensions
|
|
162
|
+
});
|
|
163
|
+
return resolveScopedCollisions(shifted?.nodes ?? nodes, shifted?.insertedNode ?? insertedNode, {
|
|
110
164
|
ignoredNodeTypes,
|
|
111
165
|
getNodeSize: getDimensions
|
|
112
166
|
});
|
|
@@ -28,7 +28,24 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
});
|
|
29
29
|
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
30
30
|
const createPreviewGraph_cjs_namespaceObject = require("../../utils/createPreviewGraph.cjs");
|
|
31
|
+
const manifest_resolver_cjs_namespaceObject = require("../../utils/manifest-resolver.cjs");
|
|
31
32
|
const LoopNode_helpers_cjs_namespaceObject = require("../LoopNode/LoopNode.helpers.cjs");
|
|
33
|
+
function buildSourceBoundaryResolver(sourceNodeId, reactFlowInstance, getManifestForNode) {
|
|
34
|
+
const sourceNode = reactFlowInstance.getNode(sourceNodeId);
|
|
35
|
+
if (!sourceNode) return;
|
|
36
|
+
const manifest = getManifestForNode(sourceNode);
|
|
37
|
+
if (!manifest?.handleConfiguration) return;
|
|
38
|
+
const resolvedGroups = (0, manifest_resolver_cjs_namespaceObject.resolveHandles)(manifest.handleConfiguration, {
|
|
39
|
+
...sourceNode.data,
|
|
40
|
+
nodeId: sourceNode.id
|
|
41
|
+
});
|
|
42
|
+
const handleToBoundary = new Map();
|
|
43
|
+
for (const group of resolvedGroups){
|
|
44
|
+
const boundary = group.boundary ?? 'outer';
|
|
45
|
+
for (const handle of group.handles)handleToBoundary.set(handle.id, boundary);
|
|
46
|
+
}
|
|
47
|
+
return (handleId)=>handleToBoundary.get(handleId);
|
|
48
|
+
}
|
|
32
49
|
function createAddNodePreview(sourceNodeId, sourceHandleId, reactFlowInstance, handlePosition = react_cjs_namespaceObject.Position.Right, sourceHandleType = 'source', ignoredNodeTypes = [], options = {}) {
|
|
33
50
|
const source = {
|
|
34
51
|
nodeId: sourceNodeId,
|
|
@@ -40,12 +57,14 @@ function createAddNodePreview(sourceNodeId, sourceHandleId, reactFlowInstance, h
|
|
|
40
57
|
reactFlowInstance,
|
|
41
58
|
getManifestForNode: options.getManifestForNode
|
|
42
59
|
}) : null;
|
|
60
|
+
const sourceBoundaryOf = options.getManifestForNode ? buildSourceBoundaryResolver(sourceNodeId, reactFlowInstance, options.getManifestForNode) : void 0;
|
|
43
61
|
(0, createPreviewGraph_cjs_namespaceObject.showPreviewGraph)({
|
|
44
62
|
source,
|
|
45
63
|
reactFlowInstance,
|
|
46
64
|
sourceHandleType,
|
|
47
65
|
handlePosition,
|
|
48
66
|
ignoredNodeTypes,
|
|
67
|
+
sourceBoundaryOf,
|
|
49
68
|
...overrides ?? {}
|
|
50
69
|
});
|
|
51
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAddNodePreview.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/AddNodePanel/createAddNodePreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"createAddNodePreview.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/AddNodePanel/createAddNodePreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAI5F,OAAO,EACL,KAAK,gCAAgC,EAEtC,MAAM,8BAA8B,CAAC;AAEtC,MAAM,WAAW,qBAAqB;IACpC,kBAAkB,CAAC,EAAE,gCAAgC,CAAC;CACvD;AAoDD,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,GAAE,QAAyB,EACzC,gBAAgB,GAAE,QAAQ,GAAG,QAAmB,EAChD,gBAAgB,GAAE,MAAM,EAAO,EAC/B,OAAO,GAAE,qBAA0B,GAClC,IAAI,CA0BN"}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
import { Position } from "../../xyflow/react.js";
|
|
2
2
|
import { showPreviewGraph } from "../../utils/createPreviewGraph.js";
|
|
3
|
+
import { resolveHandles } from "../../utils/manifest-resolver.js";
|
|
3
4
|
import { resolveContainerAddNodePreview } from "../LoopNode/LoopNode.helpers.js";
|
|
5
|
+
function buildSourceBoundaryResolver(sourceNodeId, reactFlowInstance, getManifestForNode) {
|
|
6
|
+
const sourceNode = reactFlowInstance.getNode(sourceNodeId);
|
|
7
|
+
if (!sourceNode) return;
|
|
8
|
+
const manifest = getManifestForNode(sourceNode);
|
|
9
|
+
if (!manifest?.handleConfiguration) return;
|
|
10
|
+
const resolvedGroups = resolveHandles(manifest.handleConfiguration, {
|
|
11
|
+
...sourceNode.data,
|
|
12
|
+
nodeId: sourceNode.id
|
|
13
|
+
});
|
|
14
|
+
const handleToBoundary = new Map();
|
|
15
|
+
for (const group of resolvedGroups){
|
|
16
|
+
const boundary = group.boundary ?? 'outer';
|
|
17
|
+
for (const handle of group.handles)handleToBoundary.set(handle.id, boundary);
|
|
18
|
+
}
|
|
19
|
+
return (handleId)=>handleToBoundary.get(handleId);
|
|
20
|
+
}
|
|
4
21
|
function createAddNodePreview(sourceNodeId, sourceHandleId, reactFlowInstance, handlePosition = Position.Right, sourceHandleType = 'source', ignoredNodeTypes = [], options = {}) {
|
|
5
22
|
const source = {
|
|
6
23
|
nodeId: sourceNodeId,
|
|
@@ -12,12 +29,14 @@ function createAddNodePreview(sourceNodeId, sourceHandleId, reactFlowInstance, h
|
|
|
12
29
|
reactFlowInstance,
|
|
13
30
|
getManifestForNode: options.getManifestForNode
|
|
14
31
|
}) : null;
|
|
32
|
+
const sourceBoundaryOf = options.getManifestForNode ? buildSourceBoundaryResolver(sourceNodeId, reactFlowInstance, options.getManifestForNode) : void 0;
|
|
15
33
|
showPreviewGraph({
|
|
16
34
|
source,
|
|
17
35
|
reactFlowInstance,
|
|
18
36
|
sourceHandleType,
|
|
19
37
|
handlePosition,
|
|
20
38
|
ignoredNodeTypes,
|
|
39
|
+
sourceBoundaryOf,
|
|
21
40
|
...overrides ?? {}
|
|
22
41
|
});
|
|
23
42
|
}
|
|
@@ -272,9 +272,14 @@ function LoopNodeComponent(props) {
|
|
|
272
272
|
}),
|
|
273
273
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(BodyFrame, {
|
|
274
274
|
isEmpty: showEmptyStateButton,
|
|
275
|
-
isLoading: isLoading
|
|
276
|
-
onAddFirstChild: handleEmptyClick
|
|
275
|
+
isLoading: isLoading
|
|
277
276
|
}),
|
|
277
|
+
showEmptyStateButton ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
278
|
+
className: (0, apollo_wind_namespaceObject.cn)('pointer-events-none absolute left-1/2 top-1/2', '-translate-x-1/2 -translate-y-1/2'),
|
|
279
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EmptyState, {
|
|
280
|
+
onAddFirstChild: handleEmptyClick
|
|
281
|
+
})
|
|
282
|
+
}) : null,
|
|
278
283
|
toolbarConfig && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbar_index_cjs_namespaceObject.NodeToolbar, {
|
|
279
284
|
nodeId: id,
|
|
280
285
|
config: toolbarConfig,
|
|
@@ -356,19 +361,14 @@ function EmptyState({ onAddFirstChild }) {
|
|
|
356
361
|
})
|
|
357
362
|
});
|
|
358
363
|
}
|
|
359
|
-
function BodyFrame({ isEmpty, isLoading
|
|
360
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
364
|
+
function BodyFrame({ isEmpty, isLoading }) {
|
|
365
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
361
366
|
"data-testid": "loop-body-frame",
|
|
362
367
|
"data-empty": isEmpty ? 'true' : 'false',
|
|
363
|
-
className: (0, apollo_wind_namespaceObject.cn)('relative m-2.5 flex flex-1 rounded-xl border-[1.5px] border-dashed border-border-subtle bg-transparent', 'pointer-events-none'
|
|
364
|
-
children:
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}) : null,
|
|
368
|
-
isEmpty ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(EmptyState, {
|
|
369
|
-
onAddFirstChild: onAddFirstChild
|
|
370
|
-
}) : null
|
|
371
|
-
]
|
|
368
|
+
className: (0, apollo_wind_namespaceObject.cn)('relative m-2.5 flex flex-1 rounded-xl border-[1.5px] border-dashed border-border-subtle bg-transparent', 'pointer-events-none'),
|
|
369
|
+
children: isLoading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
370
|
+
className: "m-6 h-14 w-full animate-pulse rounded-[18px] bg-(--canvas-background-overlay)"
|
|
371
|
+
}) : null
|
|
372
372
|
});
|
|
373
373
|
}
|
|
374
374
|
function ResizeControls({ onResize }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoopNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAyEtD,iBAAS,iBAAiB,CAAC,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"LoopNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAyEtD,iBAAS,iBAAiB,CAAC,KAAK,EAAE,aAAa,2CAgO9C;AAED,eAAO,MAAM,QAAQ,+DAA0B,CAAC"}
|
|
@@ -244,9 +244,14 @@ function LoopNodeComponent(props) {
|
|
|
244
244
|
}),
|
|
245
245
|
/*#__PURE__*/ jsx(BodyFrame, {
|
|
246
246
|
isEmpty: showEmptyStateButton,
|
|
247
|
-
isLoading: isLoading
|
|
248
|
-
onAddFirstChild: handleEmptyClick
|
|
247
|
+
isLoading: isLoading
|
|
249
248
|
}),
|
|
249
|
+
showEmptyStateButton ? /*#__PURE__*/ jsx("div", {
|
|
250
|
+
className: cn('pointer-events-none absolute left-1/2 top-1/2', '-translate-x-1/2 -translate-y-1/2'),
|
|
251
|
+
children: /*#__PURE__*/ jsx(EmptyState, {
|
|
252
|
+
onAddFirstChild: handleEmptyClick
|
|
253
|
+
})
|
|
254
|
+
}) : null,
|
|
250
255
|
toolbarConfig && /*#__PURE__*/ jsx(NodeToolbar, {
|
|
251
256
|
nodeId: id,
|
|
252
257
|
config: toolbarConfig,
|
|
@@ -328,19 +333,14 @@ function EmptyState({ onAddFirstChild }) {
|
|
|
328
333
|
})
|
|
329
334
|
});
|
|
330
335
|
}
|
|
331
|
-
function BodyFrame({ isEmpty, isLoading
|
|
332
|
-
return /*#__PURE__*/
|
|
336
|
+
function BodyFrame({ isEmpty, isLoading }) {
|
|
337
|
+
return /*#__PURE__*/ jsx("div", {
|
|
333
338
|
"data-testid": "loop-body-frame",
|
|
334
339
|
"data-empty": isEmpty ? 'true' : 'false',
|
|
335
|
-
className: cn('relative m-2.5 flex flex-1 rounded-xl border-[1.5px] border-dashed border-border-subtle bg-transparent', 'pointer-events-none'
|
|
336
|
-
children:
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}) : null,
|
|
340
|
-
isEmpty ? /*#__PURE__*/ jsx(EmptyState, {
|
|
341
|
-
onAddFirstChild: onAddFirstChild
|
|
342
|
-
}) : null
|
|
343
|
-
]
|
|
340
|
+
className: cn('relative m-2.5 flex flex-1 rounded-xl border-[1.5px] border-dashed border-border-subtle bg-transparent', 'pointer-events-none'),
|
|
341
|
+
children: isLoading ? /*#__PURE__*/ jsx("div", {
|
|
342
|
+
className: "m-6 h-14 w-full animate-pulse rounded-[18px] bg-(--canvas-background-overlay)"
|
|
343
|
+
}) : null
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
346
|
function ResizeControls({ onResize }) {
|
|
@@ -26,6 +26,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
showCenteredContainerPreview: ()=>showCenteredContainerPreview
|
|
28
28
|
});
|
|
29
|
+
const container_cjs_namespaceObject = require("../../utils/container.cjs");
|
|
29
30
|
const createPreviewGraph_cjs_namespaceObject = require("../../utils/createPreviewGraph.cjs");
|
|
30
31
|
const NodeUtils_cjs_namespaceObject = require("../../utils/NodeUtils.cjs");
|
|
31
32
|
const external_LoopNode_helpers_cjs_namespaceObject = require("./LoopNode.helpers.cjs");
|
|
@@ -35,9 +36,10 @@ function showCenteredContainerPreview({ containerId, reactFlowInstance, previewH
|
|
|
35
36
|
const allNodes = reactFlowInstance.getNodes();
|
|
36
37
|
const containerAbsolutePosition = (0, NodeUtils_cjs_namespaceObject.getAbsolutePosition)(containerNode, allNodes);
|
|
37
38
|
const relativeCenter = (0, external_LoopNode_helpers_cjs_namespaceObject.getContainerRelativeBodyCenter)(containerNode);
|
|
39
|
+
const containerSize = (0, container_cjs_namespaceObject.getNodeDimensions)(containerNode);
|
|
38
40
|
const previewCenter = {
|
|
39
41
|
x: (0, NodeUtils_cjs_namespaceObject.snapToGrid)(containerAbsolutePosition.x + relativeCenter.x),
|
|
40
|
-
y: (0, NodeUtils_cjs_namespaceObject.snapToGrid)(containerAbsolutePosition.y +
|
|
42
|
+
y: (0, NodeUtils_cjs_namespaceObject.snapToGrid)(containerAbsolutePosition.y + containerSize.height / 2)
|
|
41
43
|
};
|
|
42
44
|
const placement = {
|
|
43
45
|
containerId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoopNodePreview.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNodePreview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAIlF,OAAO,EACL,KAAK,iCAAiC,EAEvC,MAAM,oBAAoB,CAAC;AAE5B,wBAAgB,4BAA4B,CAAC,EAC3C,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,cAAc,GACf,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,cAAc,EAAE,iCAAiC,CAAC;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,
|
|
1
|
+
{"version":3,"file":"LoopNodePreview.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNodePreview.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAIlF,OAAO,EACL,KAAK,iCAAiC,EAEvC,MAAM,oBAAoB,CAAC;AAE5B,wBAAgB,4BAA4B,CAAC,EAC3C,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,cAAc,GACf,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,cAAc,EAAE,iCAAiC,CAAC;IAClD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,QAuCA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getNodeDimensions } from "../../utils/container.js";
|
|
1
2
|
import { showPreviewGraph } from "../../utils/createPreviewGraph.js";
|
|
2
3
|
import { getAbsolutePosition, snapToGrid } from "../../utils/NodeUtils.js";
|
|
3
4
|
import { getContainerRelativeBodyCenter } from "./LoopNode.helpers.js";
|
|
@@ -7,9 +8,10 @@ function showCenteredContainerPreview({ containerId, reactFlowInstance, previewH
|
|
|
7
8
|
const allNodes = reactFlowInstance.getNodes();
|
|
8
9
|
const containerAbsolutePosition = getAbsolutePosition(containerNode, allNodes);
|
|
9
10
|
const relativeCenter = getContainerRelativeBodyCenter(containerNode);
|
|
11
|
+
const containerSize = getNodeDimensions(containerNode);
|
|
10
12
|
const previewCenter = {
|
|
11
13
|
x: snapToGrid(containerAbsolutePosition.x + relativeCenter.x),
|
|
12
|
-
y: snapToGrid(containerAbsolutePosition.y +
|
|
14
|
+
y: snapToGrid(containerAbsolutePosition.y + containerSize.height / 2)
|
|
13
15
|
};
|
|
14
16
|
const placement = {
|
|
15
17
|
containerId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-definitions.d.ts","sourceRoot":"","sources":["../../../../src/canvas/storybook-utils/manifests/node-definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,eAAO,MAAM,gBAAgB,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"node-definitions.d.ts","sourceRoot":"","sources":["../../../../src/canvas/storybook-utils/manifests/node-definitions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEjE,eAAO,MAAM,gBAAgB,EAAE,YAAY,EAq4B1C,CAAC"}
|
|
@@ -17,27 +17,27 @@ export declare const NodePositions: {
|
|
|
17
17
|
};
|
|
18
18
|
readonly row2col1: {
|
|
19
19
|
readonly x: 96;
|
|
20
|
-
readonly y:
|
|
20
|
+
readonly y: 256;
|
|
21
21
|
};
|
|
22
22
|
readonly row2col2: {
|
|
23
23
|
readonly x: 288;
|
|
24
|
-
readonly y:
|
|
24
|
+
readonly y: 256;
|
|
25
25
|
};
|
|
26
26
|
readonly row2col3: {
|
|
27
27
|
readonly x: 480;
|
|
28
|
-
readonly y:
|
|
28
|
+
readonly y: 256;
|
|
29
29
|
};
|
|
30
30
|
readonly row3col1: {
|
|
31
31
|
readonly x: 96;
|
|
32
|
-
readonly y:
|
|
32
|
+
readonly y: 416;
|
|
33
33
|
};
|
|
34
34
|
readonly row3col2: {
|
|
35
35
|
readonly x: 288;
|
|
36
|
-
readonly y:
|
|
36
|
+
readonly y: 416;
|
|
37
37
|
};
|
|
38
38
|
readonly row3col3: {
|
|
39
39
|
readonly x: 480;
|
|
40
|
-
readonly y:
|
|
40
|
+
readonly y: 416;
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
export interface CreateNodeOptions<T = Record<string, unknown>> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../../src/canvas/storybook-utils/mocks/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../../../src/canvas/storybook-utils/mocks/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAWnF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBhB,CAAC;AAKX,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAE5D,EAAE,EAAE,MAAM,CAAC;IAEX,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,QAAQ,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEpC,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;IAEjC,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAA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CE,MAAM,EAAE;;;;;;;;;CAW1B,CAAC;AAkBX,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,GAAG,iBAAiB,CAAC,GAC5D,IAAI,CAAC,YAAY,CAAC,EAAE,CA6BtB"}
|
|
@@ -132,22 +132,34 @@ const resolveCollisions = (nodes, { maxIterations = 50, overlapThreshold = 0, ma
|
|
|
132
132
|
});
|
|
133
133
|
return nodes.map((n)=>resolvedMap.get(n.id) ?? n);
|
|
134
134
|
};
|
|
135
|
-
function resolveHandleContext(internalNode, handleId, handlePosition) {
|
|
135
|
+
function resolveHandleContext(internalNode, handleId, handlePosition, options) {
|
|
136
136
|
const allHandles = [
|
|
137
137
|
...internalNode.internals.handleBounds?.source ?? [],
|
|
138
138
|
...internalNode.internals.handleBounds?.target ?? []
|
|
139
139
|
];
|
|
140
140
|
const matchedHandle = allHandles.find((h)=>h.id === handleId);
|
|
141
141
|
if (!matchedHandle) return;
|
|
142
|
+
const peers = filterRailPeers(allHandles, handleId, handlePosition, options?.boundaryOf);
|
|
142
143
|
return {
|
|
143
144
|
anchor: {
|
|
144
145
|
x: internalNode.internals.positionAbsolute.x + matchedHandle.x + matchedHandle.width / 2,
|
|
145
146
|
y: internalNode.internals.positionAbsolute.y + matchedHandle.y + matchedHandle.height / 2
|
|
146
147
|
},
|
|
147
|
-
index: getHandleIndex(handleId, handlePosition,
|
|
148
|
-
count:
|
|
148
|
+
index: getHandleIndex(handleId, handlePosition, peers),
|
|
149
|
+
count: peers.length
|
|
149
150
|
};
|
|
150
151
|
}
|
|
152
|
+
function filterRailPeers(allHandles, handleId, handlePosition, boundaryOf) {
|
|
153
|
+
const samePosition = allHandles.filter((h)=>h.position === handlePosition);
|
|
154
|
+
if (!boundaryOf) return samePosition;
|
|
155
|
+
const targetBoundary = boundaryOf(handleId);
|
|
156
|
+
if (void 0 === targetBoundary) return samePosition;
|
|
157
|
+
return samePosition.filter((h)=>{
|
|
158
|
+
if (!h.id) return false;
|
|
159
|
+
const peerBoundary = boundaryOf(h.id);
|
|
160
|
+
return void 0 === peerBoundary || peerBoundary === targetBoundary;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
151
163
|
function getHandleIndex(handleId, position, allHandles) {
|
|
152
164
|
const peers = allHandles.filter((h)=>h.position === position).sort((a, b)=>position === react_cjs_namespaceObject.Position.Left || position === react_cjs_namespaceObject.Position.Right ? a.y - b.y : a.x - b.x);
|
|
153
165
|
const index = peers.findIndex((h)=>h.id === handleId);
|
|
@@ -35,6 +35,10 @@ export type HandleContext = {
|
|
|
35
35
|
index: number | null;
|
|
36
36
|
count: number;
|
|
37
37
|
};
|
|
38
|
-
export
|
|
38
|
+
export type HandleBoundaryResolver = (handleId: string) => 'outer' | 'inner' | undefined;
|
|
39
|
+
export interface ResolveHandleContextOptions {
|
|
40
|
+
boundaryOf?: HandleBoundaryResolver;
|
|
41
|
+
}
|
|
42
|
+
export declare function resolveHandleContext(internalNode: InternalNode, handleId: string, handlePosition: Position, options?: ResolveHandleContextOptions): HandleContext | undefined;
|
|
39
43
|
export declare function getHandleIndex(handleId: string, position: Position, allHandles: Handle[]): number | null;
|
|
40
44
|
//# sourceMappingURL=NodeUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeUtils.d.ts","sourceRoot":"","sources":["../../../src/canvas/utils/NodeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,IAAI,EACT,QAAQ,EACR,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,0CAA0C,CAAC;AAQlD,eAAO,MAAM,kBAAkB,GAAI,OAAO,cAAc,YAAkC,CAAC;AAS3F,eAAO,MAAM,mBAAmB,GAAI,MAAM,IAAI,EAAE,OAAO,IAAI,EAAE,KAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAWrF,CAAC;AAeF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|
@@ -95,22 +95,34 @@ const resolveCollisions = (nodes, { maxIterations = 50, overlapThreshold = 0, ma
|
|
|
95
95
|
});
|
|
96
96
|
return nodes.map((n)=>resolvedMap.get(n.id) ?? n);
|
|
97
97
|
};
|
|
98
|
-
function resolveHandleContext(internalNode, handleId, handlePosition) {
|
|
98
|
+
function resolveHandleContext(internalNode, handleId, handlePosition, options) {
|
|
99
99
|
const allHandles = [
|
|
100
100
|
...internalNode.internals.handleBounds?.source ?? [],
|
|
101
101
|
...internalNode.internals.handleBounds?.target ?? []
|
|
102
102
|
];
|
|
103
103
|
const matchedHandle = allHandles.find((h)=>h.id === handleId);
|
|
104
104
|
if (!matchedHandle) return;
|
|
105
|
+
const peers = filterRailPeers(allHandles, handleId, handlePosition, options?.boundaryOf);
|
|
105
106
|
return {
|
|
106
107
|
anchor: {
|
|
107
108
|
x: internalNode.internals.positionAbsolute.x + matchedHandle.x + matchedHandle.width / 2,
|
|
108
109
|
y: internalNode.internals.positionAbsolute.y + matchedHandle.y + matchedHandle.height / 2
|
|
109
110
|
},
|
|
110
|
-
index: getHandleIndex(handleId, handlePosition,
|
|
111
|
-
count:
|
|
111
|
+
index: getHandleIndex(handleId, handlePosition, peers),
|
|
112
|
+
count: peers.length
|
|
112
113
|
};
|
|
113
114
|
}
|
|
115
|
+
function filterRailPeers(allHandles, handleId, handlePosition, boundaryOf) {
|
|
116
|
+
const samePosition = allHandles.filter((h)=>h.position === handlePosition);
|
|
117
|
+
if (!boundaryOf) return samePosition;
|
|
118
|
+
const targetBoundary = boundaryOf(handleId);
|
|
119
|
+
if (void 0 === targetBoundary) return samePosition;
|
|
120
|
+
return samePosition.filter((h)=>{
|
|
121
|
+
if (!h.id) return false;
|
|
122
|
+
const peerBoundary = boundaryOf(h.id);
|
|
123
|
+
return void 0 === peerBoundary || peerBoundary === targetBoundary;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
114
126
|
function getHandleIndex(handleId, position, allHandles) {
|
|
115
127
|
const peers = allHandles.filter((h)=>h.position === position).sort((a, b)=>position === Position.Left || position === Position.Right ? a.y - b.y : a.x - b.x);
|
|
116
128
|
const index = peers.findIndex((h)=>h.id === handleId);
|
|
@@ -25,12 +25,13 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
CONTAINER_SEQUENCE_GAP_PX: ()=>CONTAINER_SEQUENCE_GAP_PX,
|
|
28
|
-
|
|
28
|
+
collectLinearDownstreamSiblings: ()=>collectLinearDownstreamSiblings,
|
|
29
29
|
DEFAULT_CONTAINER_HEIGHT: ()=>DEFAULT_CONTAINER_HEIGHT,
|
|
30
30
|
getContainerSafeArea: ()=>container_getContainerSafeArea,
|
|
31
|
+
DEFAULT_CONTAINER_WIDTH: ()=>DEFAULT_CONTAINER_WIDTH,
|
|
31
32
|
isContainerNodeManifest: ()=>isContainerNodeManifest,
|
|
32
|
-
placeContainerNode: ()=>placeContainerNode,
|
|
33
33
|
DEFAULT_CONTAINER_MIN_HEIGHT: ()=>DEFAULT_CONTAINER_MIN_HEIGHT,
|
|
34
|
+
placeContainerNode: ()=>placeContainerNode,
|
|
34
35
|
getContainerNodeForEdge: ()=>getContainerNodeForEdge,
|
|
35
36
|
resolveContainerPreview: ()=>resolveContainerPreview,
|
|
36
37
|
getContainerFitGeometry: ()=>container_getContainerFitGeometry,
|
|
@@ -204,10 +205,12 @@ function clampTopToSafeArea(top, safeArea, nodeSize) {
|
|
|
204
205
|
function rangesOverlap(startA, endA, startB, endB) {
|
|
205
206
|
return startA < endB && endA > startB;
|
|
206
207
|
}
|
|
207
|
-
function
|
|
208
|
+
function centerOnContainerRail(containerSize, safeArea, nodeSize) {
|
|
209
|
+
const railY = (0, external_NodeUtils_cjs_namespaceObject.snapToGrid)(containerSize.height / 2 - nodeSize.height / 2);
|
|
210
|
+
const maxY = safeArea.y + Math.max(0, safeArea.height - nodeSize.height);
|
|
208
211
|
return {
|
|
209
212
|
x: Math.max(safeArea.x, (0, external_NodeUtils_cjs_namespaceObject.snapToGrid)(safeArea.x + (safeArea.width - nodeSize.width) / 2)),
|
|
210
|
-
y:
|
|
213
|
+
y: (0, external_NodeUtils_cjs_namespaceObject.clamp)(railY, safeArea.y, maxY)
|
|
211
214
|
};
|
|
212
215
|
}
|
|
213
216
|
function getLocalNodePosition(node, containerNode, nodes) {
|
|
@@ -273,43 +276,54 @@ function getSingleOutgoingEdge(sourceNodeId, sourceHandleId, edges) {
|
|
|
273
276
|
function isPreviewGraphEdge(edge) {
|
|
274
277
|
return edge.source === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID || edge.target === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID;
|
|
275
278
|
}
|
|
276
|
-
function
|
|
277
|
-
const
|
|
278
|
-
|
|
279
|
-
if (
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
function bucketInScopeEdgesBySource({ edges, nodesById, parentId, isSequenceEdge }) {
|
|
280
|
+
const bySource = new Map();
|
|
281
|
+
for (const edge of edges){
|
|
282
|
+
if (isPreviewGraphEdge(edge)) continue;
|
|
283
|
+
if (isSequenceEdge && !isSequenceEdge(edge)) continue;
|
|
284
|
+
const targetIsParent = void 0 !== parentId && edge.target === parentId;
|
|
285
|
+
const targetIsSibling = nodesById.get(edge.target)?.parentId === parentId;
|
|
286
|
+
if (!targetIsParent && !targetIsSibling) continue;
|
|
287
|
+
const bucket = bySource.get(edge.source);
|
|
288
|
+
if (bucket) bucket.push(edge);
|
|
289
|
+
else bySource.set(edge.source, [
|
|
290
|
+
edge
|
|
291
|
+
]);
|
|
292
|
+
}
|
|
293
|
+
return bySource;
|
|
284
294
|
}
|
|
285
|
-
function
|
|
286
|
-
if (!
|
|
295
|
+
function collectLinearDownstreamSiblings({ startNodeId, parentId, nodes, edges, isSequenceEdge, getNextNodeId }) {
|
|
296
|
+
if (!startNodeId || startNodeId === parentId) return [];
|
|
287
297
|
const nodesById = new Map(nodes.map((node)=>[
|
|
288
298
|
node.id,
|
|
289
299
|
node
|
|
290
300
|
]));
|
|
301
|
+
const inScopeEdgesBySource = bucketInScopeEdgesBySource({
|
|
302
|
+
edges,
|
|
303
|
+
nodesById,
|
|
304
|
+
parentId,
|
|
305
|
+
isSequenceEdge
|
|
306
|
+
});
|
|
291
307
|
const collectedIds = [];
|
|
292
308
|
const visitedIds = new Set();
|
|
293
|
-
let currentNodeId =
|
|
309
|
+
let currentNodeId = startNodeId;
|
|
294
310
|
while(!visitedIds.has(currentNodeId)){
|
|
295
311
|
const currentNode = nodesById.get(currentNodeId);
|
|
296
|
-
if (!currentNode || currentNode.parentId !==
|
|
312
|
+
if (!currentNode || currentNode.parentId !== parentId) break;
|
|
297
313
|
collectedIds.push(currentNodeId);
|
|
298
314
|
visitedIds.add(currentNodeId);
|
|
299
|
-
|
|
315
|
+
let next = getNextNodeId ? getNextNodeId({
|
|
300
316
|
nodeId: currentNodeId,
|
|
301
317
|
edges,
|
|
302
318
|
nodesById,
|
|
303
|
-
|
|
304
|
-
})
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if (!nextNodeId || nextNodeId === containerId) break;
|
|
312
|
-
currentNodeId = nextNodeId;
|
|
319
|
+
parentId
|
|
320
|
+
}) : void 0;
|
|
321
|
+
if (void 0 === next) {
|
|
322
|
+
const outgoing = inScopeEdgesBySource.get(currentNodeId) ?? [];
|
|
323
|
+
next = 1 === outgoing.length ? outgoing[0].target : null;
|
|
324
|
+
}
|
|
325
|
+
if (!next || next === parentId) break;
|
|
326
|
+
currentNodeId = next;
|
|
313
327
|
}
|
|
314
328
|
return collectedIds;
|
|
315
329
|
}
|
|
@@ -491,26 +505,37 @@ function pushSiblingsAfterContainerGrowth({ nodes, changes, getNodeDimensions, g
|
|
|
491
505
|
let nextNodes = nodes;
|
|
492
506
|
for (const change of sortContainerSizeChanges(changes, nextNodes)){
|
|
493
507
|
const widthDelta = change.nextSize.width - change.previousSize.width;
|
|
494
|
-
|
|
508
|
+
const heightDelta = change.nextSize.height - change.previousSize.height;
|
|
509
|
+
if (widthDelta <= 0 && heightDelta <= 0) continue;
|
|
495
510
|
const containerNode = nextNodes.find((node)=>node.id === change.containerId);
|
|
496
511
|
const oldRight = containerNode.position.x + change.previousSize.width;
|
|
497
512
|
const newRight = containerNode.position.x + change.nextSize.width;
|
|
513
|
+
const oldBottom = containerNode.position.y + change.previousSize.height;
|
|
514
|
+
const newBottom = containerNode.position.y + change.nextSize.height;
|
|
515
|
+
const containerLeft = containerNode.position.x;
|
|
516
|
+
const containerRight = containerNode.position.x + Math.max(change.previousSize.width, change.nextSize.width);
|
|
498
517
|
const containerTop = containerNode.position.y;
|
|
499
518
|
const containerBottom = containerNode.position.y + Math.max(change.previousSize.height, change.nextSize.height);
|
|
500
519
|
nextNodes = nextNodes.map((node)=>{
|
|
501
520
|
if (node.id === containerNode.id || node.parentId !== containerNode.parentId) return node;
|
|
502
521
|
const nodeSize = getNodeDimensions(node);
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
if (
|
|
506
|
-
|
|
507
|
-
|
|
522
|
+
let nextX = node.position.x;
|
|
523
|
+
let nextY = node.position.y;
|
|
524
|
+
if (widthDelta > 0 && node.position.x >= oldRight) {
|
|
525
|
+
const verticallyOverlaps = rangesOverlap(node.position.y, node.position.y + nodeSize.height, containerTop, containerBottom);
|
|
526
|
+
if (verticallyOverlaps) nextX = Math.max(node.position.x + widthDelta, (0, external_NodeUtils_cjs_namespaceObject.snapUpToGrid)(newRight + gap));
|
|
527
|
+
}
|
|
528
|
+
if (heightDelta > 0 && node.position.y >= oldBottom) {
|
|
529
|
+
const horizontallyOverlaps = rangesOverlap(node.position.x, node.position.x + nodeSize.width, containerLeft, containerRight);
|
|
530
|
+
if (horizontallyOverlaps) nextY = Math.max(node.position.y + heightDelta, (0, external_NodeUtils_cjs_namespaceObject.snapUpToGrid)(newBottom + gap));
|
|
531
|
+
}
|
|
532
|
+
if (nextX === node.position.x && nextY === node.position.y) return node;
|
|
508
533
|
shifted = true;
|
|
509
534
|
return {
|
|
510
535
|
...node,
|
|
511
536
|
position: {
|
|
512
|
-
|
|
513
|
-
|
|
537
|
+
x: nextX,
|
|
538
|
+
y: nextY
|
|
514
539
|
}
|
|
515
540
|
};
|
|
516
541
|
});
|
|
@@ -542,11 +567,11 @@ function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeom
|
|
|
542
567
|
}
|
|
543
568
|
return nextNodes;
|
|
544
569
|
}
|
|
545
|
-
function getContainerPlacement(
|
|
570
|
+
function getContainerPlacement(previewNode) {
|
|
546
571
|
const placement = previewNode.data?.[PLACEMENT_DATA_KEY];
|
|
547
572
|
if (!placement) return null;
|
|
548
573
|
if (previewNode.parentId && placement.containerId !== previewNode.parentId) return null;
|
|
549
|
-
return
|
|
574
|
+
return placement;
|
|
550
575
|
}
|
|
551
576
|
function placeContainerNode({ nodes, insertedNode, placement, safeArea, getContainerFitGeometry: resolveContainerFitGeometry = container_getContainerFitGeometry, getNodeDimensions: resolveNodeDimensions = container_getNodeDimensions, gap = CONTAINER_SEQUENCE_GAP_PX, downstreamNodeIds, edges }) {
|
|
552
577
|
const containerNode = nodes.find((node)=>node.id === placement.containerId);
|
|
@@ -558,7 +583,7 @@ function placeContainerNode({ nodes, insertedNode, placement, safeArea, getConta
|
|
|
558
583
|
const resolvedSafeArea = getSafeArea(containerNode, safeArea);
|
|
559
584
|
const positionedNode = 'first-child' === placement.mode ? {
|
|
560
585
|
...insertedNode,
|
|
561
|
-
position:
|
|
586
|
+
position: centerOnContainerRail(resolveNodeDimensions(containerNode), resolvedSafeArea, insertedSize)
|
|
562
587
|
} : {
|
|
563
588
|
...insertedNode,
|
|
564
589
|
position: getInsertedPosition({
|
|
@@ -577,9 +602,9 @@ function placeContainerNode({ nodes, insertedNode, placement, safeArea, getConta
|
|
|
577
602
|
const fallbackTargetIds = placement.targetNodeId && placement.targetNodeId !== placement.containerId ? [
|
|
578
603
|
placement.targetNodeId
|
|
579
604
|
] : [];
|
|
580
|
-
const idsToShift = new Set(downstreamNodeIds ?? (edges ?
|
|
581
|
-
|
|
582
|
-
|
|
605
|
+
const idsToShift = new Set(downstreamNodeIds ?? (edges ? collectLinearDownstreamSiblings({
|
|
606
|
+
startNodeId: placement.targetNodeId,
|
|
607
|
+
parentId: placement.containerId,
|
|
583
608
|
nodes,
|
|
584
609
|
edges
|
|
585
610
|
}) : fallbackTargetIds));
|
|
@@ -612,6 +637,7 @@ exports.DEFAULT_CONTAINER_HEIGHT = __webpack_exports__.DEFAULT_CONTAINER_HEIGHT;
|
|
|
612
637
|
exports.DEFAULT_CONTAINER_MIN_HEIGHT = __webpack_exports__.DEFAULT_CONTAINER_MIN_HEIGHT;
|
|
613
638
|
exports.DEFAULT_CONTAINER_MIN_WIDTH = __webpack_exports__.DEFAULT_CONTAINER_MIN_WIDTH;
|
|
614
639
|
exports.DEFAULT_CONTAINER_WIDTH = __webpack_exports__.DEFAULT_CONTAINER_WIDTH;
|
|
640
|
+
exports.collectLinearDownstreamSiblings = __webpack_exports__.collectLinearDownstreamSiblings;
|
|
615
641
|
exports.ensureContainersFitChildren = __webpack_exports__.ensureContainersFitChildren;
|
|
616
642
|
exports.getContainerFitGeometry = __webpack_exports__.getContainerFitGeometry;
|
|
617
643
|
exports.getContainerNodeForEdge = __webpack_exports__.getContainerNodeForEdge;
|
|
@@ -628,6 +654,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
628
654
|
"DEFAULT_CONTAINER_MIN_HEIGHT",
|
|
629
655
|
"DEFAULT_CONTAINER_MIN_WIDTH",
|
|
630
656
|
"DEFAULT_CONTAINER_WIDTH",
|
|
657
|
+
"collectLinearDownstreamSiblings",
|
|
631
658
|
"ensureContainersFitChildren",
|
|
632
659
|
"getContainerFitGeometry",
|
|
633
660
|
"getContainerNodeForEdge",
|
|
@@ -59,6 +59,14 @@ interface ContainerPreviewOptions {
|
|
|
59
59
|
avoidSiblings?: boolean;
|
|
60
60
|
getNodeDimensions?: (node: Node) => NodeDimensions;
|
|
61
61
|
}
|
|
62
|
+
type SequenceEdgePredicate = (edge: Edge) => boolean;
|
|
63
|
+
interface NextNodeContext {
|
|
64
|
+
nodeId: string;
|
|
65
|
+
edges: Edge[];
|
|
66
|
+
nodesById: Map<string, Node>;
|
|
67
|
+
parentId: string | undefined;
|
|
68
|
+
}
|
|
69
|
+
type NextNodeResolver = (context: NextNodeContext) => string | null | undefined;
|
|
62
70
|
export declare const DEFAULT_CONTAINER_WIDTH: number;
|
|
63
71
|
export declare const DEFAULT_CONTAINER_HEIGHT: number;
|
|
64
72
|
export declare const DEFAULT_CONTAINER_MIN_WIDTH: number;
|
|
@@ -77,11 +85,16 @@ export declare function ensureContainersFitChildren(nodes: Node[], { containerId
|
|
|
77
85
|
includeAncestors?: boolean;
|
|
78
86
|
}): EnsureContainersFitChildrenResult;
|
|
79
87
|
export declare function getContainerNodeForEdge(sourceNode: Node, targetNode: Node, nodes: Node[]): Node | null;
|
|
88
|
+
export declare function collectLinearDownstreamSiblings({ startNodeId, parentId, nodes, edges, isSequenceEdge, getNextNodeId, }: {
|
|
89
|
+
startNodeId: string | undefined;
|
|
90
|
+
parentId: string | undefined;
|
|
91
|
+
nodes: Node[];
|
|
92
|
+
edges: Edge[];
|
|
93
|
+
isSequenceEdge?: SequenceEdgePredicate;
|
|
94
|
+
getNextNodeId?: NextNodeResolver;
|
|
95
|
+
}): string[];
|
|
80
96
|
export declare function resolveContainerPreview({ source, sourceHandleType, reactFlowInstance, ...options }: ContainerPreviewContext & ContainerPreviewOptions): PreviewGraphOverrides | null;
|
|
81
|
-
export declare function getContainerPlacement(
|
|
82
|
-
previewNode: Pick<Node, 'data' | 'parentId'>;
|
|
83
|
-
isContainerId?: (containerId: string) => boolean;
|
|
84
|
-
}): ContainerPlacement | null;
|
|
97
|
+
export declare function getContainerPlacement(previewNode: Pick<Node, 'data' | 'parentId'>): ContainerPlacement | null;
|
|
85
98
|
export declare function placeContainerNode({ nodes, insertedNode, placement, safeArea, getContainerFitGeometry: resolveContainerFitGeometry, getNodeDimensions: resolveNodeDimensions, gap, downstreamNodeIds, edges, }: {
|
|
86
99
|
nodes: Node[];
|
|
87
100
|
insertedNode: Node;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../../src/canvas/utils/container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,IAAI,EACJ,iBAAiB,EAElB,MAAM,0CAA0C,CAAC;AAOlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAanF,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAOD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAMD,MAAM,WAAW,iBAAiB;IAChC,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;CACH;AAGD,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,cAAc,CAAC;IAC7B,QAAQ,EAAE,c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
|
|
163
163
|
return startA < endB && endA > startB;
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function centerOnContainerRail(containerSize, safeArea, nodeSize) {
|
|
166
|
+
const railY = snapToGrid(containerSize.height / 2 - nodeSize.height / 2);
|
|
167
|
+
const maxY = safeArea.y + Math.max(0, safeArea.height - nodeSize.height);
|
|
166
168
|
return {
|
|
167
169
|
x: Math.max(safeArea.x, snapToGrid(safeArea.x + (safeArea.width - nodeSize.width) / 2)),
|
|
168
|
-
y:
|
|
170
|
+
y: clamp(railY, safeArea.y, maxY)
|
|
169
171
|
};
|
|
170
172
|
}
|
|
171
173
|
function getLocalNodePosition(node, containerNode, nodes) {
|
|
@@ -231,43 +233,54 @@ function getSingleOutgoingEdge(sourceNodeId, sourceHandleId, edges) {
|
|
|
231
233
|
function isPreviewGraphEdge(edge) {
|
|
232
234
|
return edge.source === PREVIEW_NODE_ID || edge.target === PREVIEW_NODE_ID;
|
|
233
235
|
}
|
|
234
|
-
function
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
if (
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
236
|
+
function bucketInScopeEdgesBySource({ edges, nodesById, parentId, isSequenceEdge }) {
|
|
237
|
+
const bySource = new Map();
|
|
238
|
+
for (const edge of edges){
|
|
239
|
+
if (isPreviewGraphEdge(edge)) continue;
|
|
240
|
+
if (isSequenceEdge && !isSequenceEdge(edge)) continue;
|
|
241
|
+
const targetIsParent = void 0 !== parentId && edge.target === parentId;
|
|
242
|
+
const targetIsSibling = nodesById.get(edge.target)?.parentId === parentId;
|
|
243
|
+
if (!targetIsParent && !targetIsSibling) continue;
|
|
244
|
+
const bucket = bySource.get(edge.source);
|
|
245
|
+
if (bucket) bucket.push(edge);
|
|
246
|
+
else bySource.set(edge.source, [
|
|
247
|
+
edge
|
|
248
|
+
]);
|
|
249
|
+
}
|
|
250
|
+
return bySource;
|
|
242
251
|
}
|
|
243
|
-
function
|
|
244
|
-
if (!
|
|
252
|
+
function collectLinearDownstreamSiblings({ startNodeId, parentId, nodes, edges, isSequenceEdge, getNextNodeId }) {
|
|
253
|
+
if (!startNodeId || startNodeId === parentId) return [];
|
|
245
254
|
const nodesById = new Map(nodes.map((node)=>[
|
|
246
255
|
node.id,
|
|
247
256
|
node
|
|
248
257
|
]));
|
|
258
|
+
const inScopeEdgesBySource = bucketInScopeEdgesBySource({
|
|
259
|
+
edges,
|
|
260
|
+
nodesById,
|
|
261
|
+
parentId,
|
|
262
|
+
isSequenceEdge
|
|
263
|
+
});
|
|
249
264
|
const collectedIds = [];
|
|
250
265
|
const visitedIds = new Set();
|
|
251
|
-
let currentNodeId =
|
|
266
|
+
let currentNodeId = startNodeId;
|
|
252
267
|
while(!visitedIds.has(currentNodeId)){
|
|
253
268
|
const currentNode = nodesById.get(currentNodeId);
|
|
254
|
-
if (!currentNode || currentNode.parentId !==
|
|
269
|
+
if (!currentNode || currentNode.parentId !== parentId) break;
|
|
255
270
|
collectedIds.push(currentNodeId);
|
|
256
271
|
visitedIds.add(currentNodeId);
|
|
257
|
-
|
|
272
|
+
let next = getNextNodeId ? getNextNodeId({
|
|
258
273
|
nodeId: currentNodeId,
|
|
259
274
|
edges,
|
|
260
275
|
nodesById,
|
|
261
|
-
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
if (!nextNodeId || nextNodeId === containerId) break;
|
|
270
|
-
currentNodeId = nextNodeId;
|
|
276
|
+
parentId
|
|
277
|
+
}) : void 0;
|
|
278
|
+
if (void 0 === next) {
|
|
279
|
+
const outgoing = inScopeEdgesBySource.get(currentNodeId) ?? [];
|
|
280
|
+
next = 1 === outgoing.length ? outgoing[0].target : null;
|
|
281
|
+
}
|
|
282
|
+
if (!next || next === parentId) break;
|
|
283
|
+
currentNodeId = next;
|
|
271
284
|
}
|
|
272
285
|
return collectedIds;
|
|
273
286
|
}
|
|
@@ -449,26 +462,37 @@ function pushSiblingsAfterContainerGrowth({ nodes, changes, getNodeDimensions, g
|
|
|
449
462
|
let nextNodes = nodes;
|
|
450
463
|
for (const change of sortContainerSizeChanges(changes, nextNodes)){
|
|
451
464
|
const widthDelta = change.nextSize.width - change.previousSize.width;
|
|
452
|
-
|
|
465
|
+
const heightDelta = change.nextSize.height - change.previousSize.height;
|
|
466
|
+
if (widthDelta <= 0 && heightDelta <= 0) continue;
|
|
453
467
|
const containerNode = nextNodes.find((node)=>node.id === change.containerId);
|
|
454
468
|
const oldRight = containerNode.position.x + change.previousSize.width;
|
|
455
469
|
const newRight = containerNode.position.x + change.nextSize.width;
|
|
470
|
+
const oldBottom = containerNode.position.y + change.previousSize.height;
|
|
471
|
+
const newBottom = containerNode.position.y + change.nextSize.height;
|
|
472
|
+
const containerLeft = containerNode.position.x;
|
|
473
|
+
const containerRight = containerNode.position.x + Math.max(change.previousSize.width, change.nextSize.width);
|
|
456
474
|
const containerTop = containerNode.position.y;
|
|
457
475
|
const containerBottom = containerNode.position.y + Math.max(change.previousSize.height, change.nextSize.height);
|
|
458
476
|
nextNodes = nextNodes.map((node)=>{
|
|
459
477
|
if (node.id === containerNode.id || node.parentId !== containerNode.parentId) return node;
|
|
460
478
|
const nodeSize = getNodeDimensions(node);
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
if (
|
|
464
|
-
|
|
465
|
-
|
|
479
|
+
let nextX = node.position.x;
|
|
480
|
+
let nextY = node.position.y;
|
|
481
|
+
if (widthDelta > 0 && node.position.x >= oldRight) {
|
|
482
|
+
const verticallyOverlaps = rangesOverlap(node.position.y, node.position.y + nodeSize.height, containerTop, containerBottom);
|
|
483
|
+
if (verticallyOverlaps) nextX = Math.max(node.position.x + widthDelta, snapUpToGrid(newRight + gap));
|
|
484
|
+
}
|
|
485
|
+
if (heightDelta > 0 && node.position.y >= oldBottom) {
|
|
486
|
+
const horizontallyOverlaps = rangesOverlap(node.position.x, node.position.x + nodeSize.width, containerLeft, containerRight);
|
|
487
|
+
if (horizontallyOverlaps) nextY = Math.max(node.position.y + heightDelta, snapUpToGrid(newBottom + gap));
|
|
488
|
+
}
|
|
489
|
+
if (nextX === node.position.x && nextY === node.position.y) return node;
|
|
466
490
|
shifted = true;
|
|
467
491
|
return {
|
|
468
492
|
...node,
|
|
469
493
|
position: {
|
|
470
|
-
|
|
471
|
-
|
|
494
|
+
x: nextX,
|
|
495
|
+
y: nextY
|
|
472
496
|
}
|
|
473
497
|
};
|
|
474
498
|
});
|
|
@@ -500,11 +524,11 @@ function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeom
|
|
|
500
524
|
}
|
|
501
525
|
return nextNodes;
|
|
502
526
|
}
|
|
503
|
-
function getContainerPlacement(
|
|
527
|
+
function getContainerPlacement(previewNode) {
|
|
504
528
|
const placement = previewNode.data?.[PLACEMENT_DATA_KEY];
|
|
505
529
|
if (!placement) return null;
|
|
506
530
|
if (previewNode.parentId && placement.containerId !== previewNode.parentId) return null;
|
|
507
|
-
return
|
|
531
|
+
return placement;
|
|
508
532
|
}
|
|
509
533
|
function placeContainerNode({ nodes, insertedNode, placement, safeArea, getContainerFitGeometry: resolveContainerFitGeometry = container_getContainerFitGeometry, getNodeDimensions: resolveNodeDimensions = container_getNodeDimensions, gap = CONTAINER_SEQUENCE_GAP_PX, downstreamNodeIds, edges }) {
|
|
510
534
|
const containerNode = nodes.find((node)=>node.id === placement.containerId);
|
|
@@ -516,7 +540,7 @@ function placeContainerNode({ nodes, insertedNode, placement, safeArea, getConta
|
|
|
516
540
|
const resolvedSafeArea = getSafeArea(containerNode, safeArea);
|
|
517
541
|
const positionedNode = 'first-child' === placement.mode ? {
|
|
518
542
|
...insertedNode,
|
|
519
|
-
position:
|
|
543
|
+
position: centerOnContainerRail(resolveNodeDimensions(containerNode), resolvedSafeArea, insertedSize)
|
|
520
544
|
} : {
|
|
521
545
|
...insertedNode,
|
|
522
546
|
position: getInsertedPosition({
|
|
@@ -535,9 +559,9 @@ function placeContainerNode({ nodes, insertedNode, placement, safeArea, getConta
|
|
|
535
559
|
const fallbackTargetIds = placement.targetNodeId && placement.targetNodeId !== placement.containerId ? [
|
|
536
560
|
placement.targetNodeId
|
|
537
561
|
] : [];
|
|
538
|
-
const idsToShift = new Set(downstreamNodeIds ?? (edges ?
|
|
539
|
-
|
|
540
|
-
|
|
562
|
+
const idsToShift = new Set(downstreamNodeIds ?? (edges ? collectLinearDownstreamSiblings({
|
|
563
|
+
startNodeId: placement.targetNodeId,
|
|
564
|
+
parentId: placement.containerId,
|
|
541
565
|
nodes,
|
|
542
566
|
edges
|
|
543
567
|
}) : fallbackTargetIds));
|
|
@@ -564,4 +588,4 @@ function placeContainerNode({ nodes, insertedNode, placement, safeArea, getConta
|
|
|
564
588
|
gap
|
|
565
589
|
});
|
|
566
590
|
}
|
|
567
|
-
export { CONTAINER_FRAME_INSET_PX, CONTAINER_SEQUENCE_GAP_PX, DEFAULT_CONTAINER_HEIGHT, DEFAULT_CONTAINER_MIN_HEIGHT, DEFAULT_CONTAINER_MIN_WIDTH, DEFAULT_CONTAINER_WIDTH, ensureContainersFitChildren, container_getContainerFitGeometry as getContainerFitGeometry, getContainerNodeForEdge, getContainerPlacement, container_getContainerSafeArea as getContainerSafeArea, container_getNodeDimensions as getNodeDimensions, isContainerNodeManifest, placeContainerNode, resolveContainerPreview };
|
|
591
|
+
export { CONTAINER_FRAME_INSET_PX, CONTAINER_SEQUENCE_GAP_PX, DEFAULT_CONTAINER_HEIGHT, DEFAULT_CONTAINER_MIN_HEIGHT, DEFAULT_CONTAINER_MIN_WIDTH, DEFAULT_CONTAINER_WIDTH, collectLinearDownstreamSiblings, ensureContainersFitChildren, container_getContainerFitGeometry as getContainerFitGeometry, getContainerNodeForEdge, getContainerPlacement, container_getContainerSafeArea as getContainerSafeArea, container_getNodeDimensions as getNodeDimensions, isContainerNodeManifest, placeContainerNode, resolveContainerPreview };
|
|
@@ -52,8 +52,20 @@ function reparentPreviewNodeToContainer(previewNode, containerId, reactFlowInsta
|
|
|
52
52
|
extent: 'parent'
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
|
-
function createPreviewNodeForGraph({ source, reactFlowInstance, position, data, sourceHandleType, previewNodeSize, handlePosition, ignoredNodeTypes, positionMode }) {
|
|
56
|
-
return (0, external_createPreviewNode_cjs_namespaceObject.createPreviewNode)(
|
|
55
|
+
function createPreviewNodeForGraph({ source, reactFlowInstance, position, data, sourceHandleType, previewNodeSize, handlePosition, ignoredNodeTypes, positionMode, sourceBoundaryOf }) {
|
|
56
|
+
return (0, external_createPreviewNode_cjs_namespaceObject.createPreviewNode)({
|
|
57
|
+
sourceNodeId: source.nodeId,
|
|
58
|
+
sourceHandleId: source.handleId ?? external_constants_cjs_namespaceObject.DEFAULT_SOURCE_HANDLE_ID,
|
|
59
|
+
reactFlowInstance,
|
|
60
|
+
position,
|
|
61
|
+
data,
|
|
62
|
+
sourceHandleType,
|
|
63
|
+
previewNodeSize,
|
|
64
|
+
handlePosition,
|
|
65
|
+
ignoredNodeTypes,
|
|
66
|
+
positionMode,
|
|
67
|
+
sourceBoundaryOf
|
|
68
|
+
});
|
|
57
69
|
}
|
|
58
70
|
function createTrailingPreviewEdge({ target, trailingEdgeId, trailingEdgeStyle = external_createPreviewNode_cjs_namespaceObject.PREVIEW_EDGE_STYLE }) {
|
|
59
71
|
if (!target) return null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Edge, Node, Position, ReactFlowInstance } from '../xyflow/react.ts';
|
|
2
2
|
import type { CSSProperties } from 'react';
|
|
3
3
|
import { type PreviewNodePositionMode } from './createPreviewNode';
|
|
4
|
+
import { type HandleBoundaryResolver } from './NodeUtils';
|
|
4
5
|
export interface PreviewGraph {
|
|
5
6
|
node: Node;
|
|
6
7
|
edges: Edge[];
|
|
@@ -29,6 +30,7 @@ export interface CreatePreviewGraphOptions {
|
|
|
29
30
|
containerId?: string;
|
|
30
31
|
trailingEdgeId?: string;
|
|
31
32
|
trailingEdgeStyle?: CSSProperties;
|
|
33
|
+
sourceBoundaryOf?: HandleBoundaryResolver;
|
|
32
34
|
}
|
|
33
35
|
export type PreviewGraphOverrides = Partial<Pick<CreatePreviewGraphOptions, 'containerId' | 'data' | 'position' | 'positionMode' | 'target' | 'trailingEdgeId' | 'trailingEdgeStyle'>>;
|
|
34
36
|
export declare function reparentPreviewNodeToContainer(previewNode: Node, containerId: string, reactFlowInstance: ReactFlowInstance): Node | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPreviewGraph.d.ts","sourceRoot":"","sources":["../../../src/canvas/utils/createPreviewGraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,iBAAiB,EAClB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"createPreviewGraph.d.ts","sourceRoot":"","sources":["../../../src/canvas/utils/createPreviewGraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,iBAAiB,EAClB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAuB,KAAK,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAG/E,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAGD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAMD,MAAM,WAAW,yBAAyB;IACxC,iBAAiB,EA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AgBN"}
|
|
@@ -21,8 +21,20 @@ function reparentPreviewNodeToContainer(previewNode, containerId, reactFlowInsta
|
|
|
21
21
|
extent: 'parent'
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
function createPreviewNodeForGraph({ source, reactFlowInstance, position, data, sourceHandleType, previewNodeSize, handlePosition, ignoredNodeTypes, positionMode }) {
|
|
25
|
-
return createPreviewNode(
|
|
24
|
+
function createPreviewNodeForGraph({ source, reactFlowInstance, position, data, sourceHandleType, previewNodeSize, handlePosition, ignoredNodeTypes, positionMode, sourceBoundaryOf }) {
|
|
25
|
+
return createPreviewNode({
|
|
26
|
+
sourceNodeId: source.nodeId,
|
|
27
|
+
sourceHandleId: source.handleId ?? DEFAULT_SOURCE_HANDLE_ID,
|
|
28
|
+
reactFlowInstance,
|
|
29
|
+
position,
|
|
30
|
+
data,
|
|
31
|
+
sourceHandleType,
|
|
32
|
+
previewNodeSize,
|
|
33
|
+
handlePosition,
|
|
34
|
+
ignoredNodeTypes,
|
|
35
|
+
positionMode,
|
|
36
|
+
sourceBoundaryOf
|
|
37
|
+
});
|
|
26
38
|
}
|
|
27
39
|
function createTrailingPreviewEdge({ target, trailingEdgeId, trailingEdgeStyle = PREVIEW_EDGE_STYLE }) {
|
|
28
40
|
if (!target) return null;
|
|
@@ -160,10 +160,11 @@ function calculateAutoPosition(sourceNode, handlePosition, previewNodeSize, exis
|
|
|
160
160
|
};
|
|
161
161
|
return (0, external_NodeUtils_cjs_namespaceObject.getNonOverlappingPositionForDirection)(nodesWithAbsolutePositions, initialPosition, previewNodeSize, direction, offset, ignoredNodeTypes, overflowDirection);
|
|
162
162
|
}
|
|
163
|
-
function createPreviewNode(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
function createPreviewNode(options) {
|
|
164
|
+
const { sourceNodeId, sourceHandleId, reactFlowInstance, position, data, sourceHandleType = 'source', previewNodeSize = {
|
|
165
|
+
width: external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE,
|
|
166
|
+
height: external_constants_cjs_namespaceObject.DEFAULT_NODE_SIZE
|
|
167
|
+
}, handlePosition = react_cjs_namespaceObject.Position.Right, ignoredNodeTypes = [], positionMode = 'drop', sourceBoundaryOf } = options;
|
|
167
168
|
const sourceNode = reactFlowInstance.getNode(sourceNodeId);
|
|
168
169
|
if (!sourceNode) {
|
|
169
170
|
console.warn(`Source node ${sourceNodeId} not found`);
|
|
@@ -172,7 +173,9 @@ function createPreviewNode(sourceNodeId, sourceHandleId, reactFlowInstance, posi
|
|
|
172
173
|
const treatPreviewAsSource = 'target' === sourceHandleType;
|
|
173
174
|
const existingNodes = reactFlowInstance.getNodes().filter((n)=>n.id !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID);
|
|
174
175
|
const internalNode = void 0 === position ? reactFlowInstance.getInternalNode(sourceNodeId) : void 0;
|
|
175
|
-
const handle = internalNode ? (0, external_NodeUtils_cjs_namespaceObject.resolveHandleContext)(internalNode, sourceHandleId, handlePosition
|
|
176
|
+
const handle = internalNode ? (0, external_NodeUtils_cjs_namespaceObject.resolveHandleContext)(internalNode, sourceHandleId, handlePosition, {
|
|
177
|
+
boundaryOf: sourceBoundaryOf
|
|
178
|
+
}) : void 0;
|
|
176
179
|
const nodePosition = position ? 'center' === positionMode ? calculateCenteredPosition(position, previewNodeSize) : calculatePositionFromDrop(position, handlePosition, previewNodeSize) : calculateAutoPosition(sourceNode, handlePosition, previewNodeSize, existingNodes, void 0, ignoredNodeTypes, handle);
|
|
177
180
|
const handleFacingSource = getOppositePosition(handlePosition);
|
|
178
181
|
const finalData = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Edge, type Node, Position, type ReactFlowInstance } from '../xyflow/react.ts';
|
|
2
|
+
import { type HandleBoundaryResolver } from './NodeUtils';
|
|
2
3
|
export type PreviewNodePositionMode = 'drop' | 'center';
|
|
3
4
|
export declare const PREVIEW_EDGE_STYLE: Edge['style'];
|
|
4
5
|
export declare function isPreviewEdge(edge: {
|
|
@@ -7,13 +8,26 @@ export declare function isPreviewEdge(edge: {
|
|
|
7
8
|
target?: string;
|
|
8
9
|
}): boolean;
|
|
9
10
|
export declare function getOppositePosition(position: Position): Position;
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
export interface CreatePreviewNodeOptions {
|
|
12
|
+
sourceNodeId: string;
|
|
13
|
+
sourceHandleId: string;
|
|
14
|
+
reactFlowInstance: ReactFlowInstance;
|
|
15
|
+
position?: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
};
|
|
19
|
+
data?: Record<string, unknown>;
|
|
20
|
+
sourceHandleType?: 'source' | 'target';
|
|
21
|
+
previewNodeSize?: {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
};
|
|
25
|
+
handlePosition?: Position;
|
|
26
|
+
ignoredNodeTypes?: string[];
|
|
27
|
+
positionMode?: PreviewNodePositionMode;
|
|
28
|
+
sourceBoundaryOf?: HandleBoundaryResolver;
|
|
29
|
+
}
|
|
30
|
+
export declare function createPreviewNode(options: CreatePreviewNodeOptions): {
|
|
17
31
|
node: Node;
|
|
18
32
|
edge: Edge;
|
|
19
33
|
} | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPreviewNode.d.ts","sourceRoot":"","sources":["../../../src/canvas/utils/createPreviewNode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EACT,KAAK,IAAI,EACT,QAAQ,EACR,KAAK,iBAAiB,EACvB,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"createPreviewNode.d.ts","sourceRoot":"","sources":["../../../src/canvas/utils/createPreviewNode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EACT,KAAK,IAAI,EACT,QAAQ,EACR,KAAK,iBAAiB,EACvB,MAAM,0CAA0C,CAAC;AAGlD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,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,EACnC,iBAAiB,EAAE,iBAAiB,GACnC,IAAI,CAcN;AAKD,wBAAgB,0BAA0B,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,IAAI,CAGrF"}
|
|
@@ -127,10 +127,11 @@ function calculateAutoPosition(sourceNode, handlePosition, previewNodeSize, exis
|
|
|
127
127
|
};
|
|
128
128
|
return getNonOverlappingPositionForDirection(nodesWithAbsolutePositions, initialPosition, previewNodeSize, direction, offset, ignoredNodeTypes, overflowDirection);
|
|
129
129
|
}
|
|
130
|
-
function createPreviewNode(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
function createPreviewNode(options) {
|
|
131
|
+
const { sourceNodeId, sourceHandleId, reactFlowInstance, position, data, sourceHandleType = 'source', previewNodeSize = {
|
|
132
|
+
width: DEFAULT_NODE_SIZE,
|
|
133
|
+
height: DEFAULT_NODE_SIZE
|
|
134
|
+
}, handlePosition = Position.Right, ignoredNodeTypes = [], positionMode = 'drop', sourceBoundaryOf } = options;
|
|
134
135
|
const sourceNode = reactFlowInstance.getNode(sourceNodeId);
|
|
135
136
|
if (!sourceNode) {
|
|
136
137
|
console.warn(`Source node ${sourceNodeId} not found`);
|
|
@@ -139,7 +140,9 @@ function createPreviewNode(sourceNodeId, sourceHandleId, reactFlowInstance, posi
|
|
|
139
140
|
const treatPreviewAsSource = 'target' === sourceHandleType;
|
|
140
141
|
const existingNodes = reactFlowInstance.getNodes().filter((n)=>n.id !== PREVIEW_NODE_ID);
|
|
141
142
|
const internalNode = void 0 === position ? reactFlowInstance.getInternalNode(sourceNodeId) : void 0;
|
|
142
|
-
const handle = internalNode ? resolveHandleContext(internalNode, sourceHandleId, handlePosition
|
|
143
|
+
const handle = internalNode ? resolveHandleContext(internalNode, sourceHandleId, handlePosition, {
|
|
144
|
+
boundaryOf: sourceBoundaryOf
|
|
145
|
+
}) : void 0;
|
|
143
146
|
const nodePosition = position ? 'center' === positionMode ? calculateCenteredPosition(position, previewNodeSize) : calculatePositionFromDrop(position, handlePosition, previewNodeSize) : calculateAutoPosition(sourceNode, handlePosition, previewNodeSize, existingNodes, void 0, ignoredNodeTypes, handle);
|
|
144
147
|
const handleFacingSource = getOppositePosition(handlePosition);
|
|
145
148
|
const finalData = {
|