@uipath/apollo-react 4.23.0-pr654.b595ac5 → 4.23.0-pr658.2fe8368
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 +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodeManager.helpers.js +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.cjs +5 -27
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +1 -3
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +1 -3
- package/dist/canvas/components/LoopNode/LoopNode.js +6 -28
- package/dist/canvas/styles/reactflow-reset.css +1 -1
- package/dist/canvas/utils/container.cjs +4 -104
- package/dist/canvas/utils/container.d.ts +2 -36
- package/dist/canvas/utils/container.d.ts.map +1 -1
- package/dist/canvas/utils/container.js +5 -99
- package/package.json +1 -1
|
@@ -196,7 +196,7 @@ function placeAddedNode({ nodes, edges, previewNode, insertedNode, layout, ignor
|
|
|
196
196
|
getNodeDimensions,
|
|
197
197
|
ignoredNodeTypes,
|
|
198
198
|
gap: container_cjs_namespaceObject.CONTAINER_SEQUENCE_GAP_PX
|
|
199
|
-
})
|
|
199
|
+
});
|
|
200
200
|
return {
|
|
201
201
|
nodes: fittedNodes,
|
|
202
202
|
insertedNode: fittedNodes.find((node)=>node.id === placementResult.insertedNode.id) ?? placementResult.insertedNode
|
|
@@ -166,7 +166,7 @@ function placeAddedNode({ nodes, edges, previewNode, insertedNode, layout, ignor
|
|
|
166
166
|
getNodeDimensions,
|
|
167
167
|
ignoredNodeTypes,
|
|
168
168
|
gap: CONTAINER_SEQUENCE_GAP_PX
|
|
169
|
-
})
|
|
169
|
+
});
|
|
170
170
|
return {
|
|
171
171
|
nodes: fittedNodes,
|
|
172
172
|
insertedNode: fittedNodes.find((node)=>node.id === placementResult.insertedNode.id) ?? placementResult.insertedNode
|
|
@@ -101,23 +101,6 @@ function useHasChildNodes(id, enabled) {
|
|
|
101
101
|
enabled
|
|
102
102
|
]));
|
|
103
103
|
}
|
|
104
|
-
function areContainerResizeMinimumsEqual(left, right) {
|
|
105
|
-
return left.leftWidth === right.leftWidth && left.rightWidth === right.rightWidth && left.topHeight === right.topHeight && left.bottomHeight === right.bottomHeight;
|
|
106
|
-
}
|
|
107
|
-
function useContainerResizeMinimums(id) {
|
|
108
|
-
return (0, react_cjs_namespaceObject.useStore)((0, external_react_namespaceObject.useCallback)((state)=>(0, container_cjs_namespaceObject.getContainerResizeMinimums)({
|
|
109
|
-
nodes: state.nodes,
|
|
110
|
-
containerId: id
|
|
111
|
-
}), [
|
|
112
|
-
id
|
|
113
|
-
]), areContainerResizeMinimumsEqual);
|
|
114
|
-
}
|
|
115
|
-
function getResizeControlMinimumSize(minimums, position) {
|
|
116
|
-
return {
|
|
117
|
-
width: position.includes('left') ? minimums.leftWidth : minimums.rightWidth,
|
|
118
|
-
height: position.includes('top') ? minimums.topHeight : minimums.bottomHeight
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
104
|
function useContainerNodeInternalsRefresh(id, handleGroups, width, height) {
|
|
122
105
|
const updateNodeInternals = (0, react_cjs_namespaceObject.useUpdateNodeInternals)();
|
|
123
106
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
@@ -187,7 +170,6 @@ function LoopNodeComponent(props) {
|
|
|
187
170
|
const isDropTarget = true === resolvedData.isDropTarget;
|
|
188
171
|
const containerWidth = width || container_cjs_namespaceObject.DEFAULT_CONTAINER_WIDTH;
|
|
189
172
|
const containerHeight = height || container_cjs_namespaceObject.DEFAULT_CONTAINER_HEIGHT;
|
|
190
|
-
const resizeMinimums = useContainerResizeMinimums(id);
|
|
191
173
|
const nodeSizeStyle = {
|
|
192
174
|
width: containerWidth,
|
|
193
175
|
height: containerHeight,
|
|
@@ -280,7 +262,6 @@ function LoopNodeComponent(props) {
|
|
|
280
262
|
visible: showResizeControls
|
|
281
263
|
}),
|
|
282
264
|
showResizeControls ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ResizeControls, {
|
|
283
|
-
minimums: resizeMinimums,
|
|
284
265
|
onResize: handleResize
|
|
285
266
|
}) : null,
|
|
286
267
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Header, {
|
|
@@ -390,15 +371,13 @@ function BodyFrame({ isEmpty, isLoading }) {
|
|
|
390
371
|
}) : null
|
|
391
372
|
});
|
|
392
373
|
}
|
|
393
|
-
function ResizeControls({
|
|
374
|
+
function ResizeControls({ onResize }) {
|
|
394
375
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
395
|
-
children: RESIZE_CONTROLS.map(({ position, cursor })
|
|
396
|
-
const minimumSize = getResizeControlMinimumSize(minimums, position);
|
|
397
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.NodeResizeControl, {
|
|
376
|
+
children: RESIZE_CONTROLS.map(({ position, cursor })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.NodeResizeControl, {
|
|
398
377
|
style: RESIZE_CONTROL_STYLE,
|
|
399
378
|
position: position,
|
|
400
|
-
minWidth:
|
|
401
|
-
minHeight:
|
|
379
|
+
minWidth: container_cjs_namespaceObject.DEFAULT_CONTAINER_MIN_WIDTH,
|
|
380
|
+
minHeight: container_cjs_namespaceObject.DEFAULT_CONTAINER_MIN_HEIGHT,
|
|
402
381
|
onResize: onResize,
|
|
403
382
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
404
383
|
className: "absolute bottom-0 right-0 h-5 w-5 pointer-events-auto",
|
|
@@ -406,8 +385,7 @@ function ResizeControls({ minimums, onResize }) {
|
|
|
406
385
|
cursor
|
|
407
386
|
}
|
|
408
387
|
})
|
|
409
|
-
}, position)
|
|
410
|
-
})
|
|
388
|
+
}, position))
|
|
411
389
|
});
|
|
412
390
|
}
|
|
413
391
|
function ResizeCornerIndicators({ visible }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoopNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.tsx"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -132,14 +132,12 @@ function resolveContainerAddNodePreview({ source, sourceHandleType, reactFlowIns
|
|
|
132
132
|
if (clickedHandle?.handleType !== 'output') return null;
|
|
133
133
|
const sourceNode = reactFlowInstance.getNode(source.nodeId);
|
|
134
134
|
const sourceIsContainer = void 0 !== sourceNode && (0, container_cjs_namespaceObject.isContainerNodeManifest)(getManifestForNode(sourceNode));
|
|
135
|
-
|
|
136
|
-
if (sourceIsContainer && 'inner' !== clickedHandle.boundary && !allowedContainerId) return null;
|
|
135
|
+
if (sourceIsContainer && 'inner' !== clickedHandle.boundary) return null;
|
|
137
136
|
return (0, container_cjs_namespaceObject.resolveContainerPreview)({
|
|
138
137
|
source,
|
|
139
138
|
sourceHandleType,
|
|
140
139
|
reactFlowInstance,
|
|
141
140
|
replacedEdge,
|
|
142
|
-
allowedContainerId,
|
|
143
141
|
isContainerNode: (node)=>(0, container_cjs_namespaceObject.isContainerNodeManifest)(getManifestForNode(node)),
|
|
144
142
|
getContainerSafeArea: container_cjs_namespaceObject.getContainerSafeArea,
|
|
145
143
|
getContainerContinuationTarget: ({ containerNode })=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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AoB,EAAE,CAaxB;AAMD,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;;;EAQrE;AAwBD,wBAAgB,wCAAwC,CACtD,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,qBAAqB,CAAC,GAAG,SAAS,EAC/D,OAAO,EAAE,iBAAiB,GACzB,iCAAiC,GAAG,IAAI,CAgB1C;AA4DD,wBAAgB,8BAA8B,CAAC,EAC7C,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,GACb,EAAE;IACD,MAAM,EAAE,eAAe,CAAC;IACxB,gBAAgB,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACtC,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,kBAAkB,EAAE,gCAAgC,CAAC;IACrD,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB,GAAG,qBAAqB,GAAG,IAAI,CA+C/B;AAMD,wBAAgB,yBAAyB,CAAC,EACxC,MAAM,EACN,iBAAiB,EACjB,kBAAkB,GACnB,EAAE;IACD,MAAM,EAAE,eAAe,CAAC;IACxB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,kBAAkB,EAAE,gCAAgC,CAAC;CACtD,GAAG,MAAM,GAAG,SAAS,CAarB"}
|
|
@@ -100,14 +100,12 @@ function resolveContainerAddNodePreview({ source, sourceHandleType, reactFlowIns
|
|
|
100
100
|
if (clickedHandle?.handleType !== 'output') return null;
|
|
101
101
|
const sourceNode = reactFlowInstance.getNode(source.nodeId);
|
|
102
102
|
const sourceIsContainer = void 0 !== sourceNode && isContainerNodeManifest(getManifestForNode(sourceNode));
|
|
103
|
-
|
|
104
|
-
if (sourceIsContainer && 'inner' !== clickedHandle.boundary && !allowedContainerId) return null;
|
|
103
|
+
if (sourceIsContainer && 'inner' !== clickedHandle.boundary) return null;
|
|
105
104
|
return resolveContainerPreview({
|
|
106
105
|
source,
|
|
107
106
|
sourceHandleType,
|
|
108
107
|
reactFlowInstance,
|
|
109
108
|
replacedEdge,
|
|
110
|
-
allowedContainerId,
|
|
111
109
|
isContainerNode: (node)=>isContainerNodeManifest(getManifestForNode(node)),
|
|
112
110
|
getContainerSafeArea: getContainerSafeArea,
|
|
113
111
|
getContainerContinuationTarget: ({ containerNode })=>{
|
|
@@ -5,7 +5,7 @@ import { memo, useCallback, useEffect, useMemo, useState } from "react";
|
|
|
5
5
|
import { useOptionalNodeTypeRegistry } from "../../core/index.js";
|
|
6
6
|
import { useElementValidationStatus, useNodeExecutionState } from "../../hooks/index.js";
|
|
7
7
|
import { resolveAdornments } from "../../utils/adornment-resolver.js";
|
|
8
|
-
import { DEFAULT_CONTAINER_HEIGHT, DEFAULT_CONTAINER_MIN_HEIGHT, DEFAULT_CONTAINER_MIN_WIDTH, DEFAULT_CONTAINER_WIDTH
|
|
8
|
+
import { DEFAULT_CONTAINER_HEIGHT, DEFAULT_CONTAINER_MIN_HEIGHT, DEFAULT_CONTAINER_MIN_WIDTH, DEFAULT_CONTAINER_WIDTH } from "../../utils/container.js";
|
|
9
9
|
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
10
10
|
import { resolveDisplay, resolveHandles } from "../../utils/manifest-resolver.js";
|
|
11
11
|
import { selectIsConnecting, snapToGrid } from "../../utils/NodeUtils.js";
|
|
@@ -73,23 +73,6 @@ function useHasChildNodes(id, enabled) {
|
|
|
73
73
|
enabled
|
|
74
74
|
]));
|
|
75
75
|
}
|
|
76
|
-
function areContainerResizeMinimumsEqual(left, right) {
|
|
77
|
-
return left.leftWidth === right.leftWidth && left.rightWidth === right.rightWidth && left.topHeight === right.topHeight && left.bottomHeight === right.bottomHeight;
|
|
78
|
-
}
|
|
79
|
-
function useContainerResizeMinimums(id) {
|
|
80
|
-
return useStore(useCallback((state)=>getContainerResizeMinimums({
|
|
81
|
-
nodes: state.nodes,
|
|
82
|
-
containerId: id
|
|
83
|
-
}), [
|
|
84
|
-
id
|
|
85
|
-
]), areContainerResizeMinimumsEqual);
|
|
86
|
-
}
|
|
87
|
-
function getResizeControlMinimumSize(minimums, position) {
|
|
88
|
-
return {
|
|
89
|
-
width: position.includes('left') ? minimums.leftWidth : minimums.rightWidth,
|
|
90
|
-
height: position.includes('top') ? minimums.topHeight : minimums.bottomHeight
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
76
|
function useContainerNodeInternalsRefresh(id, handleGroups, width, height) {
|
|
94
77
|
const updateNodeInternals = useUpdateNodeInternals();
|
|
95
78
|
useEffect(()=>{
|
|
@@ -159,7 +142,6 @@ function LoopNodeComponent(props) {
|
|
|
159
142
|
const isDropTarget = true === resolvedData.isDropTarget;
|
|
160
143
|
const containerWidth = width || DEFAULT_CONTAINER_WIDTH;
|
|
161
144
|
const containerHeight = height || DEFAULT_CONTAINER_HEIGHT;
|
|
162
|
-
const resizeMinimums = useContainerResizeMinimums(id);
|
|
163
145
|
const nodeSizeStyle = {
|
|
164
146
|
width: containerWidth,
|
|
165
147
|
height: containerHeight,
|
|
@@ -252,7 +234,6 @@ function LoopNodeComponent(props) {
|
|
|
252
234
|
visible: showResizeControls
|
|
253
235
|
}),
|
|
254
236
|
showResizeControls ? /*#__PURE__*/ jsx(ResizeControls, {
|
|
255
|
-
minimums: resizeMinimums,
|
|
256
237
|
onResize: handleResize
|
|
257
238
|
}) : null,
|
|
258
239
|
/*#__PURE__*/ jsx(Header, {
|
|
@@ -362,15 +343,13 @@ function BodyFrame({ isEmpty, isLoading }) {
|
|
|
362
343
|
}) : null
|
|
363
344
|
});
|
|
364
345
|
}
|
|
365
|
-
function ResizeControls({
|
|
346
|
+
function ResizeControls({ onResize }) {
|
|
366
347
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
367
|
-
children: RESIZE_CONTROLS.map(({ position, cursor })
|
|
368
|
-
const minimumSize = getResizeControlMinimumSize(minimums, position);
|
|
369
|
-
return /*#__PURE__*/ jsx(NodeResizeControl, {
|
|
348
|
+
children: RESIZE_CONTROLS.map(({ position, cursor })=>/*#__PURE__*/ jsx(NodeResizeControl, {
|
|
370
349
|
style: RESIZE_CONTROL_STYLE,
|
|
371
350
|
position: position,
|
|
372
|
-
minWidth:
|
|
373
|
-
minHeight:
|
|
351
|
+
minWidth: DEFAULT_CONTAINER_MIN_WIDTH,
|
|
352
|
+
minHeight: DEFAULT_CONTAINER_MIN_HEIGHT,
|
|
374
353
|
onResize: onResize,
|
|
375
354
|
children: /*#__PURE__*/ jsx("div", {
|
|
376
355
|
className: "absolute bottom-0 right-0 h-5 w-5 pointer-events-auto",
|
|
@@ -378,8 +357,7 @@ function ResizeControls({ minimums, onResize }) {
|
|
|
378
357
|
cursor
|
|
379
358
|
}
|
|
380
359
|
})
|
|
381
|
-
}, position)
|
|
382
|
-
})
|
|
360
|
+
}, position))
|
|
383
361
|
});
|
|
384
362
|
}
|
|
385
363
|
function ResizeCornerIndicators({ visible }) {
|
|
@@ -29,13 +29,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
DEFAULT_CONTAINER_HEIGHT: ()=>DEFAULT_CONTAINER_HEIGHT,
|
|
30
30
|
getContainerSafeArea: ()=>container_getContainerSafeArea,
|
|
31
31
|
DEFAULT_CONTAINER_WIDTH: ()=>DEFAULT_CONTAINER_WIDTH,
|
|
32
|
-
getContainerResizeMinimums: ()=>getContainerResizeMinimums,
|
|
33
32
|
isContainerNodeManifest: ()=>isContainerNodeManifest,
|
|
34
33
|
fitContainersAndPushSiblings: ()=>fitContainersAndPushSiblings,
|
|
35
34
|
DEFAULT_CONTAINER_MIN_HEIGHT: ()=>DEFAULT_CONTAINER_MIN_HEIGHT,
|
|
36
35
|
placeContainerNode: ()=>placeContainerNode,
|
|
37
36
|
getContainerNodeForEdge: ()=>getContainerNodeForEdge,
|
|
38
|
-
pushSiblingsAfterContainerResize: ()=>pushSiblingsAfterContainerResize,
|
|
39
37
|
resolveContainerPreview: ()=>resolveContainerPreview,
|
|
40
38
|
getContainerFitGeometry: ()=>container_getContainerFitGeometry,
|
|
41
39
|
CONTAINER_FRAME_INSET_PX: ()=>CONTAINER_FRAME_INSET_PX,
|
|
@@ -110,39 +108,6 @@ function container_getContainerFitGeometry() {
|
|
|
110
108
|
function isContainerNodeManifest(manifest) {
|
|
111
109
|
return manifest?.display.shape === 'container';
|
|
112
110
|
}
|
|
113
|
-
function getContainerResizeMinimums({ nodes, containerId, getContainerFitGeometry: resolveContainerFitGeometry = container_getContainerFitGeometry, getNodeDimensions: resolveNodeDimensions = container_getNodeDimensions, ignoredNodeTypes = [] }) {
|
|
114
|
-
const containerNode = nodes.find((node)=>node.id === containerId);
|
|
115
|
-
const geometry = containerNode ? resolveContainerFitGeometry(containerNode) : null;
|
|
116
|
-
if (!containerNode || !geometry) return {
|
|
117
|
-
leftWidth: DEFAULT_CONTAINER_MIN_WIDTH,
|
|
118
|
-
rightWidth: DEFAULT_CONTAINER_MIN_WIDTH,
|
|
119
|
-
topHeight: DEFAULT_CONTAINER_MIN_HEIGHT,
|
|
120
|
-
bottomHeight: DEFAULT_CONTAINER_MIN_HEIGHT
|
|
121
|
-
};
|
|
122
|
-
const currentSize = resolveNodeDimensions(containerNode);
|
|
123
|
-
const ignoredTypes = new Set(ignoredNodeTypes);
|
|
124
|
-
const padding = geometry.padding ?? {};
|
|
125
|
-
let minimumChildX = 1 / 0;
|
|
126
|
-
let minimumChildY = 1 / 0;
|
|
127
|
-
let rightRequiredWidth = geometry.minWidth;
|
|
128
|
-
let bottomRequiredHeight = geometry.minHeight;
|
|
129
|
-
for (const childNode of nodes){
|
|
130
|
-
if (childNode.id === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID || childNode.hidden || childNode.parentId !== containerId || ignoredTypes.has(childNode.type ?? '')) continue;
|
|
131
|
-
const childSize = resolveNodeDimensions(childNode);
|
|
132
|
-
minimumChildX = Math.min(minimumChildX, childNode.position.x);
|
|
133
|
-
minimumChildY = Math.min(minimumChildY, childNode.position.y);
|
|
134
|
-
rightRequiredWidth = Math.max(rightRequiredWidth, childNode.position.x + childSize.width + (padding.right ?? 0));
|
|
135
|
-
bottomRequiredHeight = Math.max(bottomRequiredHeight, childNode.position.y + childSize.height + (padding.bottom ?? 0));
|
|
136
|
-
}
|
|
137
|
-
const leftRequiredWidth = Number.isFinite(minimumChildX) ? currentSize.width - minimumChildX + (padding.left ?? 0) : geometry.minWidth;
|
|
138
|
-
const topRequiredHeight = Number.isFinite(minimumChildY) ? currentSize.height - minimumChildY + (padding.top ?? 0) : geometry.minHeight;
|
|
139
|
-
return {
|
|
140
|
-
leftWidth: (0, external_NodeUtils_cjs_namespaceObject.snapUpToGrid)(Math.max(geometry.minWidth, leftRequiredWidth)),
|
|
141
|
-
rightWidth: (0, external_NodeUtils_cjs_namespaceObject.snapUpToGrid)(rightRequiredWidth),
|
|
142
|
-
topHeight: (0, external_NodeUtils_cjs_namespaceObject.snapUpToGrid)(Math.max(geometry.minHeight, topRequiredHeight)),
|
|
143
|
-
bottomHeight: (0, external_NodeUtils_cjs_namespaceObject.snapUpToGrid)(bottomRequiredHeight)
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
111
|
function getAncestorContainerIds(containerId, nodesById) {
|
|
147
112
|
const ancestors = [];
|
|
148
113
|
let parentId = nodesById.get(containerId)?.parentId;
|
|
@@ -387,7 +352,7 @@ function collectLinearDownstreamSiblings({ startNodeId, parentId, nodes, edges,
|
|
|
387
352
|
}
|
|
388
353
|
return collectedIds;
|
|
389
354
|
}
|
|
390
|
-
function resolveInsertPreview({ source, sourceHandleType, reactFlowInstance, isContainerNode,
|
|
355
|
+
function resolveInsertPreview({ source, sourceHandleType, reactFlowInstance, isContainerNode, replacedEdge: exactReplacedEdge, getContainerSafeArea, previewNodeSize, gap, getNodeDimensions }) {
|
|
391
356
|
if ('source' !== sourceHandleType || !source.handleId) return null;
|
|
392
357
|
const replacedEdge = exactReplacedEdge ?? getSingleOutgoingEdge(source.nodeId, source.handleId, reactFlowInstance.getEdges());
|
|
393
358
|
if (!replacedEdge) return null;
|
|
@@ -397,7 +362,6 @@ function resolveInsertPreview({ source, sourceHandleType, reactFlowInstance, isC
|
|
|
397
362
|
const nodes = reactFlowInstance.getNodes();
|
|
398
363
|
const containerNode = getContainerNodeForEdge(sourceNode, targetNode, nodes);
|
|
399
364
|
if (!containerNode) return null;
|
|
400
|
-
if (allowedContainerId && containerNode.id !== allowedContainerId) return null;
|
|
401
365
|
if (isContainerNode && !isContainerNode(containerNode)) return null;
|
|
402
366
|
const containerPlacement = getPreviewPlacement({
|
|
403
367
|
sourceNode,
|
|
@@ -437,7 +401,6 @@ function resolveAppendPreview({ source, sourceHandleType, reactFlowInstance, ...
|
|
|
437
401
|
if (outgoingEdges.length > 0) return null;
|
|
438
402
|
const nodes = reactFlowInstance.getNodes();
|
|
439
403
|
const containerNode = nodes.find((node)=>node.id === sourceNode.parentId);
|
|
440
|
-
if (options.allowedContainerId && containerNode.id !== options.allowedContainerId) return null;
|
|
441
404
|
if (options.isContainerNode && !options.isContainerNode(containerNode)) return null;
|
|
442
405
|
const continuationTarget = options.getContainerContinuationTarget?.({
|
|
443
406
|
containerNode,
|
|
@@ -608,21 +571,8 @@ function pushSiblingsAfterContainerGrowth({ nodes, changes, getNodeDimensions, g
|
|
|
608
571
|
shifted
|
|
609
572
|
};
|
|
610
573
|
}
|
|
611
|
-
function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeometry, getNodeDimensions, ignoredNodeTypes, gap
|
|
612
|
-
let changed = false;
|
|
613
|
-
let shifted = false;
|
|
574
|
+
function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeometry, getNodeDimensions, ignoredNodeTypes, gap }) {
|
|
614
575
|
let nextNodes = nodes;
|
|
615
|
-
if (initialChanges.length > 0) {
|
|
616
|
-
const pushResult = pushSiblingsAfterContainerGrowth({
|
|
617
|
-
nodes: nextNodes,
|
|
618
|
-
changes: initialChanges,
|
|
619
|
-
getNodeDimensions,
|
|
620
|
-
gap
|
|
621
|
-
});
|
|
622
|
-
nextNodes = pushResult.nodes;
|
|
623
|
-
shifted = pushResult.shifted;
|
|
624
|
-
changed = pushResult.shifted;
|
|
625
|
-
}
|
|
626
576
|
for(let iteration = 0; iteration < 10; iteration += 1){
|
|
627
577
|
const fitResult = ensureContainersFitChildren(nextNodes, {
|
|
628
578
|
containerIds,
|
|
@@ -633,7 +583,6 @@ function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeom
|
|
|
633
583
|
});
|
|
634
584
|
nextNodes = fitResult.nodes;
|
|
635
585
|
if (0 === fitResult.changes.length) break;
|
|
636
|
-
changed = true;
|
|
637
586
|
const pushResult = pushSiblingsAfterContainerGrowth({
|
|
638
587
|
nodes: nextNodes,
|
|
639
588
|
changes: fitResult.changes,
|
|
@@ -641,54 +590,9 @@ function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeom
|
|
|
641
590
|
gap
|
|
642
591
|
});
|
|
643
592
|
nextNodes = pushResult.nodes;
|
|
644
|
-
shifted ||= pushResult.shifted;
|
|
645
|
-
changed ||= pushResult.shifted;
|
|
646
593
|
if (!pushResult.shifted) break;
|
|
647
594
|
}
|
|
648
|
-
return
|
|
649
|
-
nodes: nextNodes,
|
|
650
|
-
changed,
|
|
651
|
-
shifted
|
|
652
|
-
};
|
|
653
|
-
}
|
|
654
|
-
function pushSiblingsAfterContainerResize({ nodes, containerId, previousSize, nextSize, getContainerFitGeometry: resolveContainerFitGeometry = container_getContainerFitGeometry, getNodeDimensions: resolveNodeDimensions = container_getNodeDimensions, ignoredNodeTypes, gap = CONTAINER_SEQUENCE_GAP_PX }) {
|
|
655
|
-
const containerNode = nodes.find((node)=>node.id === containerId);
|
|
656
|
-
if (!containerNode) return {
|
|
657
|
-
nodes,
|
|
658
|
-
changed: false,
|
|
659
|
-
shifted: false
|
|
660
|
-
};
|
|
661
|
-
const currentSize = resolveNodeDimensions(containerNode);
|
|
662
|
-
let changed = currentSize.width !== nextSize.width || currentSize.height !== nextSize.height;
|
|
663
|
-
let shifted = false;
|
|
664
|
-
let nextNodes = changed ? nodes.map((node)=>node.id === containerId ? withNodeDimensions(node, nextSize) : node) : nodes;
|
|
665
|
-
const resizedWidthDelta = nextSize.width - previousSize.width;
|
|
666
|
-
const resizedHeightDelta = nextSize.height - previousSize.height;
|
|
667
|
-
const result = fitContainersAndPushSiblings({
|
|
668
|
-
nodes: nextNodes,
|
|
669
|
-
containerIds: [
|
|
670
|
-
containerId
|
|
671
|
-
],
|
|
672
|
-
getContainerFitGeometry: resolveContainerFitGeometry,
|
|
673
|
-
getNodeDimensions: resolveNodeDimensions,
|
|
674
|
-
ignoredNodeTypes,
|
|
675
|
-
gap,
|
|
676
|
-
initialChanges: resizedWidthDelta > 0 || resizedHeightDelta > 0 ? [
|
|
677
|
-
{
|
|
678
|
-
containerId,
|
|
679
|
-
previousSize,
|
|
680
|
-
nextSize
|
|
681
|
-
}
|
|
682
|
-
] : []
|
|
683
|
-
});
|
|
684
|
-
nextNodes = result.nodes;
|
|
685
|
-
shifted = result.shifted;
|
|
686
|
-
changed ||= result.changed;
|
|
687
|
-
return {
|
|
688
|
-
nodes: nextNodes,
|
|
689
|
-
changed,
|
|
690
|
-
shifted
|
|
691
|
-
};
|
|
595
|
+
return nextNodes;
|
|
692
596
|
}
|
|
693
597
|
function getContainerPlacement(previewNode) {
|
|
694
598
|
const placement = previewNode.data?.[PLACEMENT_DATA_KEY];
|
|
@@ -757,7 +661,7 @@ function placeContainerNode({ nodes, insertedNode, placement, safeArea, getConta
|
|
|
757
661
|
getNodeDimensions: resolveNodeDimensions,
|
|
758
662
|
ignoredNodeTypes,
|
|
759
663
|
gap
|
|
760
|
-
})
|
|
664
|
+
});
|
|
761
665
|
}
|
|
762
666
|
exports.CONTAINER_FRAME_INSET_PX = __webpack_exports__.CONTAINER_FRAME_INSET_PX;
|
|
763
667
|
exports.CONTAINER_SEQUENCE_GAP_PX = __webpack_exports__.CONTAINER_SEQUENCE_GAP_PX;
|
|
@@ -771,12 +675,10 @@ exports.fitContainersAndPushSiblings = __webpack_exports__.fitContainersAndPushS
|
|
|
771
675
|
exports.getContainerFitGeometry = __webpack_exports__.getContainerFitGeometry;
|
|
772
676
|
exports.getContainerNodeForEdge = __webpack_exports__.getContainerNodeForEdge;
|
|
773
677
|
exports.getContainerPlacement = __webpack_exports__.getContainerPlacement;
|
|
774
|
-
exports.getContainerResizeMinimums = __webpack_exports__.getContainerResizeMinimums;
|
|
775
678
|
exports.getContainerSafeArea = __webpack_exports__.getContainerSafeArea;
|
|
776
679
|
exports.getNodeDimensions = __webpack_exports__.getNodeDimensions;
|
|
777
680
|
exports.isContainerNodeManifest = __webpack_exports__.isContainerNodeManifest;
|
|
778
681
|
exports.placeContainerNode = __webpack_exports__.placeContainerNode;
|
|
779
|
-
exports.pushSiblingsAfterContainerResize = __webpack_exports__.pushSiblingsAfterContainerResize;
|
|
780
682
|
exports.resolveContainerPreview = __webpack_exports__.resolveContainerPreview;
|
|
781
683
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
782
684
|
"CONTAINER_FRAME_INSET_PX",
|
|
@@ -791,12 +693,10 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
791
693
|
"getContainerFitGeometry",
|
|
792
694
|
"getContainerNodeForEdge",
|
|
793
695
|
"getContainerPlacement",
|
|
794
|
-
"getContainerResizeMinimums",
|
|
795
696
|
"getContainerSafeArea",
|
|
796
697
|
"getNodeDimensions",
|
|
797
698
|
"isContainerNodeManifest",
|
|
798
699
|
"placeContainerNode",
|
|
799
|
-
"pushSiblingsAfterContainerResize",
|
|
800
700
|
"resolveContainerPreview"
|
|
801
701
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
802
702
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -5,12 +5,6 @@ export interface NodeDimensions {
|
|
|
5
5
|
width: number;
|
|
6
6
|
height: number;
|
|
7
7
|
}
|
|
8
|
-
export interface ContainerResizeMinimums {
|
|
9
|
-
leftWidth: number;
|
|
10
|
-
rightWidth: number;
|
|
11
|
-
topHeight: number;
|
|
12
|
-
bottomHeight: number;
|
|
13
|
-
}
|
|
14
8
|
export interface ContainerFitGeometry {
|
|
15
9
|
minWidth: number;
|
|
16
10
|
minHeight: number;
|
|
@@ -42,11 +36,6 @@ export interface EnsureContainersFitChildrenResult {
|
|
|
42
36
|
nodes: Node[];
|
|
43
37
|
changes: ContainerSizeChange[];
|
|
44
38
|
}
|
|
45
|
-
export interface PushSiblingsAfterContainerResizeResult {
|
|
46
|
-
nodes: Node[];
|
|
47
|
-
changed: boolean;
|
|
48
|
-
shifted: boolean;
|
|
49
|
-
}
|
|
50
39
|
export interface ContainerPlacement {
|
|
51
40
|
containerId: string;
|
|
52
41
|
sourceNodeId?: string;
|
|
@@ -60,7 +49,6 @@ interface ContainerPreviewContext {
|
|
|
60
49
|
}
|
|
61
50
|
interface ContainerPreviewOptions {
|
|
62
51
|
isContainerNode?: (node: Node) => boolean;
|
|
63
|
-
allowedContainerId?: string;
|
|
64
52
|
replacedEdge?: Edge;
|
|
65
53
|
getContainerSafeArea?: (containerNode: Node) => ContainerSafeArea | undefined;
|
|
66
54
|
getContainerContinuationTarget?: (context: {
|
|
@@ -92,13 +80,6 @@ export declare function getNodeDimensions(node: Pick<Node, 'width' | 'height' |
|
|
|
92
80
|
export declare function getContainerSafeArea(containerNode: Pick<Node, 'width' | 'height' | 'measured' | 'style'>, fallback?: NodeDimensions): ContainerSafeArea;
|
|
93
81
|
export declare function getContainerFitGeometry(): ContainerFitGeometry;
|
|
94
82
|
export declare function isContainerNodeManifest(manifest: Pick<NodeManifest, 'display'> | undefined): boolean;
|
|
95
|
-
export declare function getContainerResizeMinimums({ nodes, containerId, getContainerFitGeometry: resolveContainerFitGeometry, getNodeDimensions: resolveNodeDimensions, ignoredNodeTypes, }: {
|
|
96
|
-
nodes: Node[];
|
|
97
|
-
containerId: string;
|
|
98
|
-
getContainerFitGeometry?: (containerNode: Node) => ContainerFitGeometry | null | undefined;
|
|
99
|
-
getNodeDimensions?: (node: Node) => NodeDimensions;
|
|
100
|
-
ignoredNodeTypes?: string[];
|
|
101
|
-
}): ContainerResizeMinimums;
|
|
102
83
|
export declare function ensureContainersFitChildren(nodes: Node[], { containerIds, getContainerFitGeometry: resolveContainerFitGeometry, getNodeDimensions: resolveNodeDimensions, ignoredNodeTypes, includeAncestors, }?: {
|
|
103
84
|
containerIds?: Iterable<string>;
|
|
104
85
|
getContainerFitGeometry?: (containerNode: Node) => ContainerFitGeometry | null | undefined;
|
|
@@ -116,29 +97,14 @@ export declare function collectLinearDownstreamSiblings({ startNodeId, parentId,
|
|
|
116
97
|
getNextNodeId?: NextNodeResolver;
|
|
117
98
|
}): string[];
|
|
118
99
|
export declare function resolveContainerPreview({ source, sourceHandleType, reactFlowInstance, ...options }: ContainerPreviewContext & ContainerPreviewOptions): PreviewGraphOverrides | null;
|
|
119
|
-
export declare function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeometry, getNodeDimensions, ignoredNodeTypes, gap,
|
|
100
|
+
export declare function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeometry, getNodeDimensions, ignoredNodeTypes, gap, }: {
|
|
120
101
|
nodes: Node[];
|
|
121
102
|
containerIds: Iterable<string>;
|
|
122
103
|
getContainerFitGeometry: (containerNode: Node) => ContainerFitGeometry | null | undefined;
|
|
123
104
|
getNodeDimensions: (node: Node) => NodeDimensions;
|
|
124
105
|
ignoredNodeTypes?: string[];
|
|
125
106
|
gap: number;
|
|
126
|
-
|
|
127
|
-
}): {
|
|
128
|
-
nodes: Node[];
|
|
129
|
-
changed: boolean;
|
|
130
|
-
shifted: boolean;
|
|
131
|
-
};
|
|
132
|
-
export declare function pushSiblingsAfterContainerResize({ nodes, containerId, previousSize, nextSize, getContainerFitGeometry: resolveContainerFitGeometry, getNodeDimensions: resolveNodeDimensions, ignoredNodeTypes, gap, }: {
|
|
133
|
-
nodes: Node[];
|
|
134
|
-
containerId: string;
|
|
135
|
-
previousSize: NodeDimensions;
|
|
136
|
-
nextSize: NodeDimensions;
|
|
137
|
-
getContainerFitGeometry?: (containerNode: Node) => ContainerFitGeometry | null | undefined;
|
|
138
|
-
getNodeDimensions?: (node: Node) => NodeDimensions;
|
|
139
|
-
ignoredNodeTypes?: string[];
|
|
140
|
-
gap?: number;
|
|
141
|
-
}): PushSiblingsAfterContainerResizeResult;
|
|
107
|
+
}): Node[];
|
|
142
108
|
export declare function getContainerPlacement(previewNode: Pick<Node, 'data' | 'parentId'>): ContainerPlacement | null;
|
|
143
109
|
export declare function placeContainerNode({ nodes, insertedNode, placement, safeArea, getContainerFitGeometry: resolveContainerFitGeometry, getNodeDimensions: resolveNodeDimensions, gap, downstreamNodeIds, ignoredNodeTypes, edges, }: {
|
|
144
110
|
nodes: 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;
|
|
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;I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B,CAAC;IAC9B,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,uBAAuB,CAAC,EAAE,CAAC,aAAa,EAAE,IAAI,KAAK,oBAAoB,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3F,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,cAAc,CAAC;IACnD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iBAAiB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;CAChB,GAAG,IAAI,EAAE,CA+FT"}
|
|
@@ -64,39 +64,6 @@ function container_getContainerFitGeometry() {
|
|
|
64
64
|
function isContainerNodeManifest(manifest) {
|
|
65
65
|
return manifest?.display.shape === 'container';
|
|
66
66
|
}
|
|
67
|
-
function getContainerResizeMinimums({ nodes, containerId, getContainerFitGeometry: resolveContainerFitGeometry = container_getContainerFitGeometry, getNodeDimensions: resolveNodeDimensions = container_getNodeDimensions, ignoredNodeTypes = [] }) {
|
|
68
|
-
const containerNode = nodes.find((node)=>node.id === containerId);
|
|
69
|
-
const geometry = containerNode ? resolveContainerFitGeometry(containerNode) : null;
|
|
70
|
-
if (!containerNode || !geometry) return {
|
|
71
|
-
leftWidth: DEFAULT_CONTAINER_MIN_WIDTH,
|
|
72
|
-
rightWidth: DEFAULT_CONTAINER_MIN_WIDTH,
|
|
73
|
-
topHeight: DEFAULT_CONTAINER_MIN_HEIGHT,
|
|
74
|
-
bottomHeight: DEFAULT_CONTAINER_MIN_HEIGHT
|
|
75
|
-
};
|
|
76
|
-
const currentSize = resolveNodeDimensions(containerNode);
|
|
77
|
-
const ignoredTypes = new Set(ignoredNodeTypes);
|
|
78
|
-
const padding = geometry.padding ?? {};
|
|
79
|
-
let minimumChildX = 1 / 0;
|
|
80
|
-
let minimumChildY = 1 / 0;
|
|
81
|
-
let rightRequiredWidth = geometry.minWidth;
|
|
82
|
-
let bottomRequiredHeight = geometry.minHeight;
|
|
83
|
-
for (const childNode of nodes){
|
|
84
|
-
if (childNode.id === PREVIEW_NODE_ID || childNode.hidden || childNode.parentId !== containerId || ignoredTypes.has(childNode.type ?? '')) continue;
|
|
85
|
-
const childSize = resolveNodeDimensions(childNode);
|
|
86
|
-
minimumChildX = Math.min(minimumChildX, childNode.position.x);
|
|
87
|
-
minimumChildY = Math.min(minimumChildY, childNode.position.y);
|
|
88
|
-
rightRequiredWidth = Math.max(rightRequiredWidth, childNode.position.x + childSize.width + (padding.right ?? 0));
|
|
89
|
-
bottomRequiredHeight = Math.max(bottomRequiredHeight, childNode.position.y + childSize.height + (padding.bottom ?? 0));
|
|
90
|
-
}
|
|
91
|
-
const leftRequiredWidth = Number.isFinite(minimumChildX) ? currentSize.width - minimumChildX + (padding.left ?? 0) : geometry.minWidth;
|
|
92
|
-
const topRequiredHeight = Number.isFinite(minimumChildY) ? currentSize.height - minimumChildY + (padding.top ?? 0) : geometry.minHeight;
|
|
93
|
-
return {
|
|
94
|
-
leftWidth: snapUpToGrid(Math.max(geometry.minWidth, leftRequiredWidth)),
|
|
95
|
-
rightWidth: snapUpToGrid(rightRequiredWidth),
|
|
96
|
-
topHeight: snapUpToGrid(Math.max(geometry.minHeight, topRequiredHeight)),
|
|
97
|
-
bottomHeight: snapUpToGrid(bottomRequiredHeight)
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
67
|
function getAncestorContainerIds(containerId, nodesById) {
|
|
101
68
|
const ancestors = [];
|
|
102
69
|
let parentId = nodesById.get(containerId)?.parentId;
|
|
@@ -341,7 +308,7 @@ function collectLinearDownstreamSiblings({ startNodeId, parentId, nodes, edges,
|
|
|
341
308
|
}
|
|
342
309
|
return collectedIds;
|
|
343
310
|
}
|
|
344
|
-
function resolveInsertPreview({ source, sourceHandleType, reactFlowInstance, isContainerNode,
|
|
311
|
+
function resolveInsertPreview({ source, sourceHandleType, reactFlowInstance, isContainerNode, replacedEdge: exactReplacedEdge, getContainerSafeArea, previewNodeSize, gap, getNodeDimensions }) {
|
|
345
312
|
if ('source' !== sourceHandleType || !source.handleId) return null;
|
|
346
313
|
const replacedEdge = exactReplacedEdge ?? getSingleOutgoingEdge(source.nodeId, source.handleId, reactFlowInstance.getEdges());
|
|
347
314
|
if (!replacedEdge) return null;
|
|
@@ -351,7 +318,6 @@ function resolveInsertPreview({ source, sourceHandleType, reactFlowInstance, isC
|
|
|
351
318
|
const nodes = reactFlowInstance.getNodes();
|
|
352
319
|
const containerNode = getContainerNodeForEdge(sourceNode, targetNode, nodes);
|
|
353
320
|
if (!containerNode) return null;
|
|
354
|
-
if (allowedContainerId && containerNode.id !== allowedContainerId) return null;
|
|
355
321
|
if (isContainerNode && !isContainerNode(containerNode)) return null;
|
|
356
322
|
const containerPlacement = getPreviewPlacement({
|
|
357
323
|
sourceNode,
|
|
@@ -391,7 +357,6 @@ function resolveAppendPreview({ source, sourceHandleType, reactFlowInstance, ...
|
|
|
391
357
|
if (outgoingEdges.length > 0) return null;
|
|
392
358
|
const nodes = reactFlowInstance.getNodes();
|
|
393
359
|
const containerNode = nodes.find((node)=>node.id === sourceNode.parentId);
|
|
394
|
-
if (options.allowedContainerId && containerNode.id !== options.allowedContainerId) return null;
|
|
395
360
|
if (options.isContainerNode && !options.isContainerNode(containerNode)) return null;
|
|
396
361
|
const continuationTarget = options.getContainerContinuationTarget?.({
|
|
397
362
|
containerNode,
|
|
@@ -562,21 +527,8 @@ function pushSiblingsAfterContainerGrowth({ nodes, changes, getNodeDimensions, g
|
|
|
562
527
|
shifted
|
|
563
528
|
};
|
|
564
529
|
}
|
|
565
|
-
function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeometry, getNodeDimensions, ignoredNodeTypes, gap
|
|
566
|
-
let changed = false;
|
|
567
|
-
let shifted = false;
|
|
530
|
+
function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeometry, getNodeDimensions, ignoredNodeTypes, gap }) {
|
|
568
531
|
let nextNodes = nodes;
|
|
569
|
-
if (initialChanges.length > 0) {
|
|
570
|
-
const pushResult = pushSiblingsAfterContainerGrowth({
|
|
571
|
-
nodes: nextNodes,
|
|
572
|
-
changes: initialChanges,
|
|
573
|
-
getNodeDimensions,
|
|
574
|
-
gap
|
|
575
|
-
});
|
|
576
|
-
nextNodes = pushResult.nodes;
|
|
577
|
-
shifted = pushResult.shifted;
|
|
578
|
-
changed = pushResult.shifted;
|
|
579
|
-
}
|
|
580
532
|
for(let iteration = 0; iteration < 10; iteration += 1){
|
|
581
533
|
const fitResult = ensureContainersFitChildren(nextNodes, {
|
|
582
534
|
containerIds,
|
|
@@ -587,7 +539,6 @@ function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeom
|
|
|
587
539
|
});
|
|
588
540
|
nextNodes = fitResult.nodes;
|
|
589
541
|
if (0 === fitResult.changes.length) break;
|
|
590
|
-
changed = true;
|
|
591
542
|
const pushResult = pushSiblingsAfterContainerGrowth({
|
|
592
543
|
nodes: nextNodes,
|
|
593
544
|
changes: fitResult.changes,
|
|
@@ -595,54 +546,9 @@ function fitContainersAndPushSiblings({ nodes, containerIds, getContainerFitGeom
|
|
|
595
546
|
gap
|
|
596
547
|
});
|
|
597
548
|
nextNodes = pushResult.nodes;
|
|
598
|
-
shifted ||= pushResult.shifted;
|
|
599
|
-
changed ||= pushResult.shifted;
|
|
600
549
|
if (!pushResult.shifted) break;
|
|
601
550
|
}
|
|
602
|
-
return
|
|
603
|
-
nodes: nextNodes,
|
|
604
|
-
changed,
|
|
605
|
-
shifted
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
function pushSiblingsAfterContainerResize({ nodes, containerId, previousSize, nextSize, getContainerFitGeometry: resolveContainerFitGeometry = container_getContainerFitGeometry, getNodeDimensions: resolveNodeDimensions = container_getNodeDimensions, ignoredNodeTypes, gap = CONTAINER_SEQUENCE_GAP_PX }) {
|
|
609
|
-
const containerNode = nodes.find((node)=>node.id === containerId);
|
|
610
|
-
if (!containerNode) return {
|
|
611
|
-
nodes,
|
|
612
|
-
changed: false,
|
|
613
|
-
shifted: false
|
|
614
|
-
};
|
|
615
|
-
const currentSize = resolveNodeDimensions(containerNode);
|
|
616
|
-
let changed = currentSize.width !== nextSize.width || currentSize.height !== nextSize.height;
|
|
617
|
-
let shifted = false;
|
|
618
|
-
let nextNodes = changed ? nodes.map((node)=>node.id === containerId ? withNodeDimensions(node, nextSize) : node) : nodes;
|
|
619
|
-
const resizedWidthDelta = nextSize.width - previousSize.width;
|
|
620
|
-
const resizedHeightDelta = nextSize.height - previousSize.height;
|
|
621
|
-
const result = fitContainersAndPushSiblings({
|
|
622
|
-
nodes: nextNodes,
|
|
623
|
-
containerIds: [
|
|
624
|
-
containerId
|
|
625
|
-
],
|
|
626
|
-
getContainerFitGeometry: resolveContainerFitGeometry,
|
|
627
|
-
getNodeDimensions: resolveNodeDimensions,
|
|
628
|
-
ignoredNodeTypes,
|
|
629
|
-
gap,
|
|
630
|
-
initialChanges: resizedWidthDelta > 0 || resizedHeightDelta > 0 ? [
|
|
631
|
-
{
|
|
632
|
-
containerId,
|
|
633
|
-
previousSize,
|
|
634
|
-
nextSize
|
|
635
|
-
}
|
|
636
|
-
] : []
|
|
637
|
-
});
|
|
638
|
-
nextNodes = result.nodes;
|
|
639
|
-
shifted = result.shifted;
|
|
640
|
-
changed ||= result.changed;
|
|
641
|
-
return {
|
|
642
|
-
nodes: nextNodes,
|
|
643
|
-
changed,
|
|
644
|
-
shifted
|
|
645
|
-
};
|
|
551
|
+
return nextNodes;
|
|
646
552
|
}
|
|
647
553
|
function getContainerPlacement(previewNode) {
|
|
648
554
|
const placement = previewNode.data?.[PLACEMENT_DATA_KEY];
|
|
@@ -711,6 +617,6 @@ function placeContainerNode({ nodes, insertedNode, placement, safeArea, getConta
|
|
|
711
617
|
getNodeDimensions: resolveNodeDimensions,
|
|
712
618
|
ignoredNodeTypes,
|
|
713
619
|
gap
|
|
714
|
-
})
|
|
620
|
+
});
|
|
715
621
|
}
|
|
716
|
-
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, fitContainersAndPushSiblings, container_getContainerFitGeometry as getContainerFitGeometry, getContainerNodeForEdge, getContainerPlacement,
|
|
622
|
+
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, fitContainersAndPushSiblings, container_getContainerFitGeometry as getContainerFitGeometry, getContainerNodeForEdge, getContainerPlacement, container_getContainerSafeArea as getContainerSafeArea, container_getNodeDimensions as getNodeDimensions, isContainerNodeManifest, placeContainerNode, resolveContainerPreview };
|