@uipath/apollo-react 4.13.0-pr556.ddd6fa1 → 4.13.0
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.cjs +7 -26
- package/dist/canvas/components/AddNodePanel/AddNodeManager.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodeManager.js +7 -26
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +41 -0
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +3 -0
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +1 -0
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +7 -0
- package/dist/canvas/components/AddNodePanel/index.cjs +6 -2
- package/dist/canvas/components/AddNodePanel/index.d.ts +1 -0
- package/dist/canvas/components/AddNodePanel/index.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/index.js +2 -1
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +0 -1
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.cjs +3 -8
- package/dist/canvas/components/BaseNode/BaseNode.d.ts +1 -2
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +3 -5
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +34 -115
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +2 -4
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +36 -117
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +1 -48
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +0 -4
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +1 -36
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.cjs +2 -3
- package/dist/canvas/components/Edges/SequenceEdge.d.ts +2 -11
- package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.js +3 -4
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +15 -23
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts +0 -2
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +16 -24
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +8 -11
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +8 -11
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +25 -34
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts +1 -2
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +26 -35
- package/dist/canvas/components/index.cjs +20 -27
- package/dist/canvas/components/index.d.ts +0 -1
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +0 -1
- package/dist/canvas/constants.cjs +0 -8
- package/dist/canvas/constants.d.ts +0 -2
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +1 -3
- package/dist/canvas/core/NodeTypeRegistry.cjs +23 -39
- package/dist/canvas/core/NodeTypeRegistry.d.ts +4 -8
- package/dist/canvas/core/NodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/NodeTypeRegistry.js +23 -39
- package/dist/canvas/core/useNodeTypeRegistry.cjs +3 -4
- package/dist/canvas/core/useNodeTypeRegistry.d.ts +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.js +3 -4
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.cjs +3 -10
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.d.ts.map +1 -1
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +3 -10
- package/dist/canvas/hooks/usePreviewNode.cjs +2 -4
- package/dist/canvas/hooks/usePreviewNode.d.ts.map +1 -1
- package/dist/canvas/hooks/usePreviewNode.js +2 -4
- package/dist/canvas/schema/node-definition/handle.cjs +2 -10
- package/dist/canvas/schema/node-definition/handle.d.ts +0 -9
- package/dist/canvas/schema/node-definition/handle.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/handle.js +1 -6
- package/dist/canvas/schema/node-definition/index.cjs +1 -4
- package/dist/canvas/schema/node-definition/index.d.ts +3 -3
- package/dist/canvas/schema/node-definition/index.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/index.js +2 -2
- package/dist/canvas/schema/node-definition/node-manifest.d.ts +0 -4
- package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts +0 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/utils/{createPreviewGraph.cjs → createPreviewNode.cjs} +41 -115
- package/dist/canvas/utils/createPreviewNode.d.ts +17 -0
- package/dist/canvas/utils/createPreviewNode.d.ts.map +1 -0
- package/dist/canvas/utils/{createPreviewGraph.js → createPreviewNode.js} +36 -95
- package/dist/canvas/utils/index.cjs +10 -10
- package/dist/canvas/utils/index.d.ts +2 -2
- package/dist/canvas/utils/index.d.ts.map +1 -1
- package/dist/canvas/utils/index.js +2 -2
- package/package.json +3 -3
- package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +0 -112
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts +0 -6
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopCanvasNode.js +0 -78
- package/dist/canvas/components/LoopNode/LoopNode.cjs +0 -430
- package/dist/canvas/components/LoopNode/LoopNode.constants.cjs +0 -77
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts +0 -12
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.constants.js +0 -13
- package/dist/canvas/components/LoopNode/LoopNode.d.ts +0 -5
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +0 -137
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +0 -26
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +0 -94
- package/dist/canvas/components/LoopNode/LoopNode.js +0 -396
- package/dist/canvas/components/LoopNode/LoopNode.types.cjs +0 -18
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +0 -11
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.types.js +0 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.cjs +0 -61
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts +0 -9
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNodePreview.js +0 -27
- package/dist/canvas/components/LoopNode/index.cjs +0 -72
- package/dist/canvas/components/LoopNode/index.d.ts +0 -4
- package/dist/canvas/components/LoopNode/index.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/index.js +0 -3
- package/dist/canvas/utils/createPreviewGraph.d.ts +0 -43
- package/dist/canvas/utils/createPreviewGraph.d.ts.map +0 -1
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Row } from "../../layouts/index.js";
|
|
3
2
|
import { Handle, Position } from "../../xyflow/react.js";
|
|
4
|
-
import {
|
|
3
|
+
import { memo, useCallback, useMemo, useRef, useState } from "react";
|
|
5
4
|
import { canvasEventBus } from "../../utils/CanvasEventBus.js";
|
|
6
5
|
import { cx } from "../../utils/CssUtil.js";
|
|
7
|
-
import {
|
|
6
|
+
import { calculateGridAlignedHandlePositions, pixelToPercent } from "./ButtonHandleStyleUtils.js";
|
|
8
7
|
import { HandleButton, HandleHoverBridge } from "./HandleButton.js";
|
|
9
8
|
import { HandleLabel } from "./HandleLabel.js";
|
|
10
9
|
import { HandleNotch } from "./HandleNotch.js";
|
|
11
10
|
import { useButtonHandleSizeAndPosition } from "./useButtonHandleSizeAndPosition.js";
|
|
12
|
-
const ButtonHandleBase = ({ id, nodeId, type, position,
|
|
11
|
+
const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor = 'var(--canvas-background-secondary)', visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
|
|
13
12
|
const handleRef = useRef(null);
|
|
14
13
|
const [isHovered, setIsHovered] = useState(false);
|
|
15
14
|
const isVertical = position === Position.Top || position === Position.Bottom;
|
|
@@ -34,7 +33,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
34
33
|
handleId: id,
|
|
35
34
|
nodeId,
|
|
36
35
|
handleType,
|
|
37
|
-
position
|
|
36
|
+
position,
|
|
38
37
|
originalEvent: event
|
|
39
38
|
};
|
|
40
39
|
onAction?.(actionEvent);
|
|
@@ -42,13 +41,13 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
42
41
|
handleId: id,
|
|
43
42
|
nodeId,
|
|
44
43
|
handleType,
|
|
45
|
-
position
|
|
44
|
+
position
|
|
46
45
|
});
|
|
47
46
|
}, [
|
|
48
|
-
connectionPosition,
|
|
49
47
|
id,
|
|
50
48
|
nodeId,
|
|
51
49
|
handleType,
|
|
50
|
+
position,
|
|
52
51
|
onAction
|
|
53
52
|
]);
|
|
54
53
|
const markAsHovered = useCallback(()=>setIsHovered(true), []);
|
|
@@ -59,91 +58,52 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
59
58
|
numHandles: total,
|
|
60
59
|
customPositionAndOffsets
|
|
61
60
|
});
|
|
62
|
-
|
|
63
|
-
const { inwardLabelRef, rootWidth, rootHeight, rootTransform } = useInwardLabelLayout({
|
|
64
|
-
hasInwardLabel,
|
|
65
|
-
isVertical,
|
|
66
|
-
position,
|
|
67
|
-
handleType,
|
|
68
|
-
handleWidth,
|
|
69
|
-
handleHeight,
|
|
70
|
-
transform
|
|
71
|
-
});
|
|
72
|
-
return /*#__PURE__*/ jsx(Handle, {
|
|
61
|
+
return /*#__PURE__*/ jsxs(Handle, {
|
|
73
62
|
ref: handleRef,
|
|
74
63
|
type: type,
|
|
75
|
-
position:
|
|
64
|
+
position: position,
|
|
76
65
|
id: id,
|
|
77
66
|
onMouseEnter: markAsHovered,
|
|
78
67
|
onMouseLeave: unmarkAsHovered,
|
|
79
68
|
onMouseDown: unmarkAsHovered,
|
|
80
69
|
className: cx('flex! items-center! justify-center! border-0! rounded-none! bg-transparent!', visible ? 'cursor-crosshair! pointer-events-auto! opacity-100' : 'cursor-default! pointer-events-none! opacity-0'),
|
|
81
70
|
style: {
|
|
82
|
-
width:
|
|
83
|
-
height:
|
|
71
|
+
width: handleWidth,
|
|
72
|
+
height: handleHeight,
|
|
84
73
|
top,
|
|
85
74
|
bottom,
|
|
86
75
|
left,
|
|
87
76
|
right,
|
|
88
|
-
transform
|
|
77
|
+
transform
|
|
89
78
|
},
|
|
90
|
-
children:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
handleRef: handleRef
|
|
115
|
-
}) : null
|
|
116
|
-
]
|
|
117
|
-
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
118
|
-
children: [
|
|
119
|
-
/*#__PURE__*/ jsx(HandleNotch, {
|
|
120
|
-
handleType: handleType,
|
|
121
|
-
isVertical: isVertical,
|
|
122
|
-
selected: selected,
|
|
123
|
-
hovered: isHovered,
|
|
124
|
-
showNotch: showNotches
|
|
125
|
-
}),
|
|
126
|
-
onAction && 'source' === type && showButton ? /*#__PURE__*/ jsx(HandleButton, {
|
|
127
|
-
visible: showButton,
|
|
128
|
-
labelVisible: visible,
|
|
129
|
-
position: position,
|
|
130
|
-
onAction: handleButtonClick,
|
|
131
|
-
handleRef: handleRef,
|
|
132
|
-
label: label,
|
|
133
|
-
labelIcon: labelIcon,
|
|
134
|
-
labelBackgroundColor: labelBackgroundColor
|
|
135
|
-
}) : label && /*#__PURE__*/ jsx(HandleLabel, {
|
|
136
|
-
position: position,
|
|
137
|
-
backgroundColor: labelBackgroundColor,
|
|
138
|
-
label: label,
|
|
139
|
-
labelIcon: labelIcon
|
|
140
|
-
})
|
|
141
|
-
]
|
|
142
|
-
})
|
|
79
|
+
children: [
|
|
80
|
+
/*#__PURE__*/ jsx(HandleNotch, {
|
|
81
|
+
handleType: handleType,
|
|
82
|
+
isVertical: isVertical,
|
|
83
|
+
selected: selected,
|
|
84
|
+
hovered: isHovered,
|
|
85
|
+
showNotch: showNotches
|
|
86
|
+
}),
|
|
87
|
+
onAction && 'source' === type ? /*#__PURE__*/ jsx(HandleButton, {
|
|
88
|
+
visible: showButton,
|
|
89
|
+
labelVisible: visible,
|
|
90
|
+
position: position,
|
|
91
|
+
onAction: handleButtonClick,
|
|
92
|
+
handleRef: handleRef,
|
|
93
|
+
label: label,
|
|
94
|
+
labelIcon: labelIcon,
|
|
95
|
+
labelBackgroundColor: labelBackgroundColor
|
|
96
|
+
}) : label && /*#__PURE__*/ jsx(HandleLabel, {
|
|
97
|
+
position: position,
|
|
98
|
+
backgroundColor: labelBackgroundColor,
|
|
99
|
+
label: label,
|
|
100
|
+
labelIcon: labelIcon
|
|
101
|
+
})
|
|
102
|
+
]
|
|
143
103
|
});
|
|
144
104
|
};
|
|
145
105
|
const ButtonHandle = /*#__PURE__*/ memo(ButtonHandleBase);
|
|
146
|
-
const ButtonHandlesBase = ({ nodeId, handles, position,
|
|
106
|
+
const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
|
|
147
107
|
const finalSelected = shouldShowAddButtonFn({
|
|
148
108
|
showAddButton,
|
|
149
109
|
selected,
|
|
@@ -162,7 +122,6 @@ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = pos
|
|
|
162
122
|
nodeId: nodeId,
|
|
163
123
|
type: handle.type,
|
|
164
124
|
position: position,
|
|
165
|
-
connectionPosition: connectionPosition,
|
|
166
125
|
handleType: handle.handleType,
|
|
167
126
|
label: handle.label,
|
|
168
127
|
labelIcon: handle.labelIcon,
|
|
@@ -182,44 +141,4 @@ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = pos
|
|
|
182
141
|
});
|
|
183
142
|
};
|
|
184
143
|
const ButtonHandles = /*#__PURE__*/ memo(ButtonHandlesBase);
|
|
185
|
-
function useInwardLabelLayout({ hasInwardLabel, isVertical, position, handleType, handleWidth, handleHeight, transform }) {
|
|
186
|
-
const inwardLabelRef = useRef(null);
|
|
187
|
-
const [inwardLabelInset, setInwardLabelInset] = useState(0);
|
|
188
|
-
useLayoutEffect(()=>{
|
|
189
|
-
if (!hasInwardLabel) return void setInwardLabelInset((current)=>0 === current ? current : 0);
|
|
190
|
-
const rect = inwardLabelRef.current?.getBoundingClientRect();
|
|
191
|
-
const nextInset = isVertical ? rect?.height ?? 0 : rect?.width ?? 0;
|
|
192
|
-
setInwardLabelInset((current)=>current === nextInset ? current : nextInset);
|
|
193
|
-
}, [
|
|
194
|
-
hasInwardLabel,
|
|
195
|
-
isVertical
|
|
196
|
-
]);
|
|
197
|
-
const inwardHandleSize = getInwardHandleSize(handleType);
|
|
198
|
-
return {
|
|
199
|
-
inwardLabelRef,
|
|
200
|
-
rootWidth: hasInwardLabel && !isVertical ? inwardHandleSize : handleWidth,
|
|
201
|
-
rootHeight: hasInwardLabel && isVertical ? inwardHandleSize : handleHeight,
|
|
202
|
-
rootTransform: hasInwardLabel ? getInwardHandleTransform(position, inwardLabelInset) : transform
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
const ButtonHandle_InwardHandleLabel = /*#__PURE__*/ forwardRef(function({ connectionPosition, label, labelIcon, backgroundColor }, ref) {
|
|
206
|
-
return /*#__PURE__*/ jsx("div", {
|
|
207
|
-
ref: ref,
|
|
208
|
-
className: cx('pointer-events-none absolute flex h-6 items-center whitespace-nowrap rounded-full border border-border-subtle px-2.5', INWARD_LABEL_POSITION[connectionPosition]),
|
|
209
|
-
style: {
|
|
210
|
-
backgroundColor
|
|
211
|
-
},
|
|
212
|
-
children: /*#__PURE__*/ jsxs(Row, {
|
|
213
|
-
align: "center",
|
|
214
|
-
gap: 3,
|
|
215
|
-
children: [
|
|
216
|
-
labelIcon,
|
|
217
|
-
/*#__PURE__*/ jsx("span", {
|
|
218
|
-
className: "text-xs font-medium text-foreground",
|
|
219
|
-
children: label
|
|
220
|
-
})
|
|
221
|
-
]
|
|
222
|
-
})
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
144
|
export { ButtonHandle, ButtonHandles };
|
|
@@ -25,18 +25,14 @@ var __webpack_exports__ = {};
|
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
leftPositionForHandle: ()=>leftPositionForHandle,
|
|
28
|
-
getInwardHandleSize: ()=>getInwardHandleSize,
|
|
29
28
|
topPositionForHandle: ()=>topPositionForHandle,
|
|
30
29
|
transformForHandle: ()=>transformForHandle,
|
|
31
|
-
getInwardNotchLayout: ()=>getInwardNotchLayout,
|
|
32
|
-
heightForHandleWithPosition: ()=>heightForHandleWithPosition,
|
|
33
30
|
snapToGrid: ()=>snapToGrid,
|
|
34
|
-
|
|
31
|
+
heightForHandleWithPosition: ()=>heightForHandleWithPosition,
|
|
35
32
|
bottomPositionForHandle: ()=>bottomPositionForHandle,
|
|
36
33
|
calculateGridAlignedHandlePositions: ()=>calculateGridAlignedHandlePositions,
|
|
37
34
|
pixelToPercent: ()=>pixelToPercent,
|
|
38
35
|
rightPositionForHandle: ()=>rightPositionForHandle,
|
|
39
|
-
getInwardHandleTransform: ()=>getInwardHandleTransform,
|
|
40
36
|
widthForHandleWithPosition: ()=>widthForHandleWithPosition
|
|
41
37
|
});
|
|
42
38
|
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
@@ -125,47 +121,8 @@ const transformForHandle = ({ position, customPositionAndOffsets })=>{
|
|
|
125
121
|
const horizontalPercent = hasCustomHorizontal ? '0%' : position === react_cjs_namespaceObject.Position.Right ? '50%' : '-50%';
|
|
126
122
|
return `translate(${horizontalPercent}, ${verticalPercent})`;
|
|
127
123
|
};
|
|
128
|
-
const getInwardHandleSize = (handleType)=>{
|
|
129
|
-
if ('input' === handleType) return '14px';
|
|
130
|
-
if ('artifact' === handleType) return '16px';
|
|
131
|
-
return '18px';
|
|
132
|
-
};
|
|
133
|
-
const getInwardHandleTransform = (position, inset)=>{
|
|
134
|
-
switch(position){
|
|
135
|
-
case react_cjs_namespaceObject.Position.Left:
|
|
136
|
-
return `translate(${inset}px, -50%)`;
|
|
137
|
-
case react_cjs_namespaceObject.Position.Right:
|
|
138
|
-
return `translate(${-inset}px, -50%)`;
|
|
139
|
-
case react_cjs_namespaceObject.Position.Top:
|
|
140
|
-
return `translate(-50%, ${inset}px)`;
|
|
141
|
-
case react_cjs_namespaceObject.Position.Bottom:
|
|
142
|
-
return `translate(-50%, ${-inset}px)`;
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
const getInwardNotchLayout = (position)=>{
|
|
146
|
-
switch(position){
|
|
147
|
-
case react_cjs_namespaceObject.Position.Top:
|
|
148
|
-
return 'flex-col justify-start';
|
|
149
|
-
case react_cjs_namespaceObject.Position.Bottom:
|
|
150
|
-
return 'flex-col justify-end';
|
|
151
|
-
case react_cjs_namespaceObject.Position.Left:
|
|
152
|
-
return 'justify-start';
|
|
153
|
-
case react_cjs_namespaceObject.Position.Right:
|
|
154
|
-
return 'justify-end';
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
const INWARD_LABEL_POSITION = {
|
|
158
|
-
[react_cjs_namespaceObject.Position.Top]: 'top-full left-1/2 -translate-x-1/2',
|
|
159
|
-
[react_cjs_namespaceObject.Position.Bottom]: 'bottom-full left-1/2 -translate-x-1/2',
|
|
160
|
-
[react_cjs_namespaceObject.Position.Left]: 'left-full top-1/2 -translate-y-1/2',
|
|
161
|
-
[react_cjs_namespaceObject.Position.Right]: 'right-full top-1/2 -translate-y-1/2'
|
|
162
|
-
};
|
|
163
|
-
exports.INWARD_LABEL_POSITION = __webpack_exports__.INWARD_LABEL_POSITION;
|
|
164
124
|
exports.bottomPositionForHandle = __webpack_exports__.bottomPositionForHandle;
|
|
165
125
|
exports.calculateGridAlignedHandlePositions = __webpack_exports__.calculateGridAlignedHandlePositions;
|
|
166
|
-
exports.getInwardHandleSize = __webpack_exports__.getInwardHandleSize;
|
|
167
|
-
exports.getInwardHandleTransform = __webpack_exports__.getInwardHandleTransform;
|
|
168
|
-
exports.getInwardNotchLayout = __webpack_exports__.getInwardNotchLayout;
|
|
169
126
|
exports.heightForHandleWithPosition = __webpack_exports__.heightForHandleWithPosition;
|
|
170
127
|
exports.leftPositionForHandle = __webpack_exports__.leftPositionForHandle;
|
|
171
128
|
exports.pixelToPercent = __webpack_exports__.pixelToPercent;
|
|
@@ -175,12 +132,8 @@ exports.topPositionForHandle = __webpack_exports__.topPositionForHandle;
|
|
|
175
132
|
exports.transformForHandle = __webpack_exports__.transformForHandle;
|
|
176
133
|
exports.widthForHandleWithPosition = __webpack_exports__.widthForHandleWithPosition;
|
|
177
134
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
178
|
-
"INWARD_LABEL_POSITION",
|
|
179
135
|
"bottomPositionForHandle",
|
|
180
136
|
"calculateGridAlignedHandlePositions",
|
|
181
|
-
"getInwardHandleSize",
|
|
182
|
-
"getInwardHandleTransform",
|
|
183
|
-
"getInwardNotchLayout",
|
|
184
137
|
"heightForHandleWithPosition",
|
|
185
138
|
"leftPositionForHandle",
|
|
186
139
|
"pixelToPercent",
|
|
@@ -45,8 +45,4 @@ export declare const transformForHandle: ({ position, customPositionAndOffsets,
|
|
|
45
45
|
position: Position;
|
|
46
46
|
customPositionAndOffsets?: HandleConfigurationSpecificPosition;
|
|
47
47
|
}) => string;
|
|
48
|
-
export declare const getInwardHandleSize: (handleType: "artifact" | "input" | "output") => string;
|
|
49
|
-
export declare const getInwardHandleTransform: (position: Position, inset: number) => string;
|
|
50
|
-
export declare const getInwardNotchLayout: (position: Position) => string;
|
|
51
|
-
export declare const INWARD_LABEL_POSITION: Record<Position, string>;
|
|
52
48
|
//# sourceMappingURL=ButtonHandleStyleUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonHandleStyleUtils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonH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AAE,mCAAmC,CAAC;CAChE,KAAG,MAgBH,CAAC"}
|
|
@@ -84,39 +84,4 @@ const transformForHandle = ({ position, customPositionAndOffsets })=>{
|
|
|
84
84
|
const horizontalPercent = hasCustomHorizontal ? '0%' : position === Position.Right ? '50%' : '-50%';
|
|
85
85
|
return `translate(${horizontalPercent}, ${verticalPercent})`;
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
if ('input' === handleType) return '14px';
|
|
89
|
-
if ('artifact' === handleType) return '16px';
|
|
90
|
-
return '18px';
|
|
91
|
-
};
|
|
92
|
-
const getInwardHandleTransform = (position, inset)=>{
|
|
93
|
-
switch(position){
|
|
94
|
-
case Position.Left:
|
|
95
|
-
return `translate(${inset}px, -50%)`;
|
|
96
|
-
case Position.Right:
|
|
97
|
-
return `translate(${-inset}px, -50%)`;
|
|
98
|
-
case Position.Top:
|
|
99
|
-
return `translate(-50%, ${inset}px)`;
|
|
100
|
-
case Position.Bottom:
|
|
101
|
-
return `translate(-50%, ${-inset}px)`;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
const getInwardNotchLayout = (position)=>{
|
|
105
|
-
switch(position){
|
|
106
|
-
case Position.Top:
|
|
107
|
-
return 'flex-col justify-start';
|
|
108
|
-
case Position.Bottom:
|
|
109
|
-
return 'flex-col justify-end';
|
|
110
|
-
case Position.Left:
|
|
111
|
-
return 'justify-start';
|
|
112
|
-
case Position.Right:
|
|
113
|
-
return 'justify-end';
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
const INWARD_LABEL_POSITION = {
|
|
117
|
-
[Position.Top]: 'top-full left-1/2 -translate-x-1/2',
|
|
118
|
-
[Position.Bottom]: 'bottom-full left-1/2 -translate-x-1/2',
|
|
119
|
-
[Position.Left]: 'left-full top-1/2 -translate-y-1/2',
|
|
120
|
-
[Position.Right]: 'right-full top-1/2 -translate-y-1/2'
|
|
121
|
-
};
|
|
122
|
-
export { INWARD_LABEL_POSITION, bottomPositionForHandle, calculateGridAlignedHandlePositions, getInwardHandleSize, getInwardHandleTransform, getInwardNotchLayout, heightForHandleWithPosition, leftPositionForHandle, pixelToPercent, rightPositionForHandle, snapToGrid, topPositionForHandle, transformForHandle, widthForHandleWithPosition };
|
|
87
|
+
export { bottomPositionForHandle, calculateGridAlignedHandlePositions, heightForHandleWithPosition, leftPositionForHandle, pixelToPercent, rightPositionForHandle, snapToGrid, topPositionForHandle, transformForHandle, widthForHandleWithPosition };
|
|
@@ -384,7 +384,7 @@ function SmartHandle({ type, id, defaultPosition = 'source' === type ? react_nam
|
|
|
384
384
|
...rest,
|
|
385
385
|
children: visible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
386
386
|
children: [
|
|
387
|
-
onAction && 'source' === type
|
|
387
|
+
onAction && 'source' === type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
|
|
388
388
|
visible: showButton,
|
|
389
389
|
labelVisible: visible,
|
|
390
390
|
position: computedPosition,
|
|
@@ -353,7 +353,7 @@ function SmartHandle({ type, id, defaultPosition = 'source' === type ? Position.
|
|
|
353
353
|
...rest,
|
|
354
354
|
children: visible && /*#__PURE__*/ jsxs(Fragment, {
|
|
355
355
|
children: [
|
|
356
|
-
onAction && 'source' === type
|
|
356
|
+
onAction && 'source' === type ? /*#__PURE__*/ jsx(HandleButton, {
|
|
357
357
|
visible: showButton,
|
|
358
358
|
labelVisible: visible,
|
|
359
359
|
position: computedPosition,
|
|
@@ -80,7 +80,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
|
|
|
80
80
|
const pathElementRef = (0, external_react_namespaceObject.useRef)(null);
|
|
81
81
|
const { mode } = (0, BaseCanvasModeProvider_cjs_namespaceObject.useBaseCanvasMode)();
|
|
82
82
|
const isReadOnly = 'readonly' === mode;
|
|
83
|
-
const isPreviewEdge = id === external_constants_cjs_namespaceObject.PREVIEW_EDGE_ID
|
|
83
|
+
const isPreviewEdge = id === external_constants_cjs_namespaceObject.PREVIEW_EDGE_ID;
|
|
84
84
|
const executionStatus = (0, index_cjs_namespaceObject.useEdgeExecutionState)(id, target);
|
|
85
85
|
const { validationStatus } = (0, index_cjs_namespaceObject.useElementValidationStatus)(id) ?? {
|
|
86
86
|
validationStatus: void 0
|
|
@@ -111,8 +111,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
|
|
|
111
111
|
sourcePosition,
|
|
112
112
|
targetPosition,
|
|
113
113
|
source,
|
|
114
|
-
target
|
|
115
|
-
parentId: data?.parentId
|
|
114
|
+
target
|
|
116
115
|
});
|
|
117
116
|
const getEdgeColor = ()=>{
|
|
118
117
|
if (isDiffAdded) return 'var(--canvas-success-icon)';
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
3
|
-
isDiffAdded?: boolean;
|
|
4
|
-
isDiffRemoved?: boolean;
|
|
5
|
-
label?: string;
|
|
6
|
-
parentId?: string;
|
|
7
|
-
}
|
|
8
|
-
type SequenceEdgeType = Edge<SequenceEdgeData>;
|
|
9
|
-
type SequenceEdgeProps = EdgeProps<SequenceEdgeType>;
|
|
10
|
-
export declare const SequenceEdge: import("react").NamedExoticComponent<SequenceEdgeProps>;
|
|
11
|
-
export {};
|
|
1
|
+
import { type EdgeProps } from '../../xyflow/react.ts';
|
|
2
|
+
export declare const SequenceEdge: import("react").NamedExoticComponent<EdgeProps>;
|
|
12
3
|
//# sourceMappingURL=SequenceEdge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SequenceEdge.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Edges/SequenceEdge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"SequenceEdge.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Edges/SequenceEdge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,0CAA0C,CAAC;AAoDpF,eAAO,MAAM,YAAY,iDAuMJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Position } from "../../xyflow/react.js";
|
|
3
3
|
import { memo, useRef, useState } from "react";
|
|
4
|
-
import { PREVIEW_EDGE_ID
|
|
4
|
+
import { PREVIEW_EDGE_ID } from "../../constants.js";
|
|
5
5
|
import { useEdgeExecutionState, useEdgePath, useElementValidationStatus } from "../../hooks/index.js";
|
|
6
6
|
import { useBaseCanvasMode } from "../BaseCanvas/BaseCanvasModeProvider.js";
|
|
7
7
|
import { EdgeToolbar, useEdgeToolbarState } from "../Toolbar/index.js";
|
|
@@ -52,7 +52,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
|
|
|
52
52
|
const pathElementRef = useRef(null);
|
|
53
53
|
const { mode } = useBaseCanvasMode();
|
|
54
54
|
const isReadOnly = 'readonly' === mode;
|
|
55
|
-
const isPreviewEdge = id === PREVIEW_EDGE_ID
|
|
55
|
+
const isPreviewEdge = id === PREVIEW_EDGE_ID;
|
|
56
56
|
const executionStatus = useEdgeExecutionState(id, target);
|
|
57
57
|
const { validationStatus } = useElementValidationStatus(id) ?? {
|
|
58
58
|
validationStatus: void 0
|
|
@@ -83,8 +83,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
|
|
|
83
83
|
sourcePosition,
|
|
84
84
|
targetPosition,
|
|
85
85
|
source,
|
|
86
|
-
target
|
|
87
|
-
parentId: data?.parentId
|
|
86
|
+
target
|
|
88
87
|
});
|
|
89
88
|
const getEdgeColor = ()=>{
|
|
90
89
|
if (isDiffAdded) return 'var(--canvas-success-icon)';
|
|
@@ -38,7 +38,6 @@ const animatedViewportManager_cjs_namespaceObject = require("../../stores/animat
|
|
|
38
38
|
const canvasStore_cjs_namespaceObject = require("../../stores/canvasStore.cjs");
|
|
39
39
|
const viewportManager_cjs_namespaceObject = require("../../stores/viewportManager.cjs");
|
|
40
40
|
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
41
|
-
const createPreviewGraph_cjs_namespaceObject = require("../../utils/createPreviewGraph.cjs");
|
|
42
41
|
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
43
42
|
const transitions_cjs_namespaceObject = require("../../utils/transitions.cjs");
|
|
44
43
|
const AddNodeManager_cjs_namespaceObject = require("../AddNodePanel/AddNodeManager.cjs");
|
|
@@ -53,7 +52,7 @@ const DEFAULT_NODE_TYPES = {
|
|
|
53
52
|
'blank-canvas-node': external_BlankCanvasNode_index_cjs_namespaceObject.BlankCanvasNode,
|
|
54
53
|
preview: AddNodePreview_cjs_namespaceObject.AddNodePreview
|
|
55
54
|
};
|
|
56
|
-
const HierarchicalCanvas = ({
|
|
55
|
+
const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
57
56
|
const canvasRef = (0, external_react_namespaceObject.useRef)(null);
|
|
58
57
|
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
59
58
|
const [reactFlowInstance, setReactFlowInstance] = (0, external_react_namespaceObject.useState)(null);
|
|
@@ -66,17 +65,14 @@ const HierarchicalCanvas = ({ additionalNodeTypes, mode = 'design', initialCanva
|
|
|
66
65
|
const shouldAnimate = 'design' === mode && !(0, transitions_cjs_namespaceObject.prefersReducedMotion)();
|
|
67
66
|
const nodeManifests = (0, external_core_index_cjs_namespaceObject.useNodeManifests)();
|
|
68
67
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
...additionalNodeTypes
|
|
77
|
-
};
|
|
68
|
+
const types = nodeManifests.reduce((acc, manifest)=>{
|
|
69
|
+
if (!acc[manifest.nodeType]) acc[manifest.nodeType] = external_BaseNode_index_cjs_namespaceObject.BaseNode;
|
|
70
|
+
return acc;
|
|
71
|
+
}, {
|
|
72
|
+
...DEFAULT_NODE_TYPES
|
|
73
|
+
});
|
|
74
|
+
return types;
|
|
78
75
|
}, [
|
|
79
|
-
additionalNodeTypes,
|
|
80
76
|
nodeManifests
|
|
81
77
|
]);
|
|
82
78
|
const currentCanvas = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectCurrentCanvas);
|
|
@@ -210,26 +206,22 @@ const HierarchicalCanvas = ({ additionalNodeTypes, mode = 'design', initialCanva
|
|
|
210
206
|
const canvas = currentCanvasRef.current;
|
|
211
207
|
if (!connection.source || !connection.target || !canvas) return;
|
|
212
208
|
if (connection.target === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID || connection.source === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID) return;
|
|
213
|
-
const parentId = (0, createPreviewGraph_cjs_namespaceObject.inferParentId)(connection.source, connection.target, canvas.nodes);
|
|
214
209
|
const newEdge = {
|
|
215
210
|
id: `${connection.source}-${connection.target}-${Date.now()}`,
|
|
216
211
|
source: connection.source,
|
|
217
212
|
target: connection.target,
|
|
218
213
|
sourceHandle: connection.sourceHandle || void 0,
|
|
219
|
-
targetHandle: connection.targetHandle || void 0
|
|
220
|
-
...parentId ? {
|
|
221
|
-
data: {
|
|
222
|
-
parentId
|
|
223
|
-
}
|
|
224
|
-
} : {}
|
|
214
|
+
targetHandle: connection.targetHandle || void 0
|
|
225
215
|
};
|
|
226
|
-
const hasPreview = canvas.nodes.some((n)=>n.id === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID);
|
|
227
|
-
const baseEdges = hasPreview ? canvas.edges.filter((edge)=>edge.source !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID && edge.target !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID) : canvas.edges;
|
|
228
216
|
updateEdges([
|
|
229
|
-
...
|
|
217
|
+
...canvas.edges,
|
|
230
218
|
newEdge
|
|
231
219
|
]);
|
|
232
|
-
|
|
220
|
+
const hasPreview = canvas.nodes.some((n)=>n.id === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID);
|
|
221
|
+
if (hasPreview) {
|
|
222
|
+
updateNodes(canvas.nodes.filter((n)=>n.id !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID));
|
|
223
|
+
updateEdges(canvas.edges.filter((e)=>e.id !== external_constants_cjs_namespaceObject.PREVIEW_EDGE_ID));
|
|
224
|
+
}
|
|
233
225
|
}, [
|
|
234
226
|
updateNodes,
|
|
235
227
|
updateEdges
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { type NodeTypes } from '../../xyflow/react.ts';
|
|
2
1
|
import type React from 'react';
|
|
3
2
|
import type { CanvasLevel } from '../../types/canvas.types';
|
|
4
3
|
interface HierarchicalCanvasProps {
|
|
5
|
-
additionalNodeTypes?: NodeTypes;
|
|
6
4
|
mode?: 'view' | 'design' | 'readonly';
|
|
7
5
|
initialCanvases?: Record<string, CanvasLevel>;
|
|
8
6
|
initialPath?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchicalCanvas.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/HierarchicalCanvas.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HierarchicalCanvas.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/HierarchicalCanvas.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4B/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAW5D,UAAU,uBAAuB;IAC/B,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;IAKtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAK9C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAMvB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC;IAInE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACzC;AASD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA2YhE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Panel, applyEdgeChanges, applyNodeChanges } from "../../xyflow/react.js";
|
|
3
3
|
import { Spinner } from "@uipath/apollo-wind";
|
|
4
4
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
-
import { PREVIEW_NODE_ID } from "../../constants.js";
|
|
5
|
+
import { PREVIEW_EDGE_ID, PREVIEW_NODE_ID } from "../../constants.js";
|
|
6
6
|
import { Breadcrumb } from "../../controls/index.js";
|
|
7
7
|
import { useNodeManifests } from "../../core/index.js";
|
|
8
8
|
import { useAddNodeOnConnectEnd } from "../../hooks/useAddNodeOnConnectEnd.js";
|
|
@@ -10,7 +10,6 @@ import { animatedViewportManager } from "../../stores/animatedViewportManager.js
|
|
|
10
10
|
import { selectBreadcrumbs, selectCanvasStack, selectCurrentCanvas, selectCurrentPath, selectDrillIntoNode, selectInitializeCanvas, selectInitializeWithData, selectNavigateToDepth, selectNavigateToSiblingCanvas, selectPreviousCanvas, selectTransitionState, selectUpdateEdges, selectUpdateNodes, selectUpdateSelection, selectUpdateViewport, useCanvasStore } from "../../stores/canvasStore.js";
|
|
11
11
|
import { viewportManager } from "../../stores/viewportManager.js";
|
|
12
12
|
import { DefaultCanvasTranslations } from "../../types.js";
|
|
13
|
-
import { inferParentId } from "../../utils/createPreviewGraph.js";
|
|
14
13
|
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
15
14
|
import { prefersReducedMotion } from "../../utils/transitions.js";
|
|
16
15
|
import { AddNodeManager } from "../AddNodePanel/AddNodeManager.js";
|
|
@@ -25,7 +24,7 @@ const DEFAULT_NODE_TYPES = {
|
|
|
25
24
|
'blank-canvas-node': BlankCanvasNode,
|
|
26
25
|
preview: AddNodePreview
|
|
27
26
|
};
|
|
28
|
-
const HierarchicalCanvas = ({
|
|
27
|
+
const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
29
28
|
const canvasRef = useRef(null);
|
|
30
29
|
const containerRef = useRef(null);
|
|
31
30
|
const [reactFlowInstance, setReactFlowInstance] = useState(null);
|
|
@@ -38,17 +37,14 @@ const HierarchicalCanvas = ({ additionalNodeTypes, mode = 'design', initialCanva
|
|
|
38
37
|
const shouldAnimate = 'design' === mode && !prefersReducedMotion();
|
|
39
38
|
const nodeManifests = useNodeManifests();
|
|
40
39
|
const nodeTypes = useMemo(()=>{
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
...additionalNodeTypes
|
|
49
|
-
};
|
|
40
|
+
const types = nodeManifests.reduce((acc, manifest)=>{
|
|
41
|
+
if (!acc[manifest.nodeType]) acc[manifest.nodeType] = BaseNode;
|
|
42
|
+
return acc;
|
|
43
|
+
}, {
|
|
44
|
+
...DEFAULT_NODE_TYPES
|
|
45
|
+
});
|
|
46
|
+
return types;
|
|
50
47
|
}, [
|
|
51
|
-
additionalNodeTypes,
|
|
52
48
|
nodeManifests
|
|
53
49
|
]);
|
|
54
50
|
const currentCanvas = useCanvasStore(selectCurrentCanvas);
|
|
@@ -182,26 +178,22 @@ const HierarchicalCanvas = ({ additionalNodeTypes, mode = 'design', initialCanva
|
|
|
182
178
|
const canvas = currentCanvasRef.current;
|
|
183
179
|
if (!connection.source || !connection.target || !canvas) return;
|
|
184
180
|
if (connection.target === PREVIEW_NODE_ID || connection.source === PREVIEW_NODE_ID) return;
|
|
185
|
-
const parentId = inferParentId(connection.source, connection.target, canvas.nodes);
|
|
186
181
|
const newEdge = {
|
|
187
182
|
id: `${connection.source}-${connection.target}-${Date.now()}`,
|
|
188
183
|
source: connection.source,
|
|
189
184
|
target: connection.target,
|
|
190
185
|
sourceHandle: connection.sourceHandle || void 0,
|
|
191
|
-
targetHandle: connection.targetHandle || void 0
|
|
192
|
-
...parentId ? {
|
|
193
|
-
data: {
|
|
194
|
-
parentId
|
|
195
|
-
}
|
|
196
|
-
} : {}
|
|
186
|
+
targetHandle: connection.targetHandle || void 0
|
|
197
187
|
};
|
|
198
|
-
const hasPreview = canvas.nodes.some((n)=>n.id === PREVIEW_NODE_ID);
|
|
199
|
-
const baseEdges = hasPreview ? canvas.edges.filter((edge)=>edge.source !== PREVIEW_NODE_ID && edge.target !== PREVIEW_NODE_ID) : canvas.edges;
|
|
200
188
|
updateEdges([
|
|
201
|
-
...
|
|
189
|
+
...canvas.edges,
|
|
202
190
|
newEdge
|
|
203
191
|
]);
|
|
204
|
-
|
|
192
|
+
const hasPreview = canvas.nodes.some((n)=>n.id === PREVIEW_NODE_ID);
|
|
193
|
+
if (hasPreview) {
|
|
194
|
+
updateNodes(canvas.nodes.filter((n)=>n.id !== PREVIEW_NODE_ID));
|
|
195
|
+
updateEdges(canvas.edges.filter((e)=>e.id !== PREVIEW_EDGE_ID));
|
|
196
|
+
}
|
|
205
197
|
}, [
|
|
206
198
|
updateNodes,
|
|
207
199
|
updateEdges
|