@uipath/apollo-react 4.15.0-pr605.6f11404 → 4.15.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.cjs +11 -116
- package/dist/canvas/components/AddNodePanel/AddNodeManager.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodeManager.js +12 -117
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +4 -28
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +1 -2
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +4 -28
- 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 +5 -11
- 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 +6 -9
- package/dist/canvas/components/BaseNode/BaseNode.types.d.ts +0 -3
- package/dist/canvas/components/BaseNode/BaseNode.types.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +13 -222
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +5 -10
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +14 -223
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +2 -10
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +0 -2
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +3 -5
- package/dist/canvas/components/ButtonHandle/HandleButton.cjs +2 -17
- package/dist/canvas/components/ButtonHandle/HandleButton.d.ts +1 -10
- package/dist/canvas/components/ButtonHandle/HandleButton.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/HandleButton.js +2 -17
- package/dist/canvas/components/ButtonHandle/useButtonHandles.cjs +2 -4
- package/dist/canvas/components/ButtonHandle/useButtonHandles.d.ts +1 -2
- package/dist/canvas/components/ButtonHandle/useButtonHandles.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/useButtonHandles.js +2 -4
- package/dist/canvas/components/Edges/SequenceEdge.cjs +4 -8
- package/dist/canvas/components/Edges/SequenceEdge.js +4 -8
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +25 -34
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts +2 -8
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +27 -36
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +2 -9
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +3 -10
- package/dist/canvas/components/HierarchicalCanvas/index.d.ts +1 -1
- package/dist/canvas/components/HierarchicalCanvas/index.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNodeHeader.cjs +3 -1
- package/dist/canvas/components/StageNode/StageNodeHeader.d.ts.map +1 -1
- package/dist/canvas/components/StageNode/StageNodeHeader.js +3 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/EdgeToolbar.cjs +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/EdgeToolbar.js +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +24 -41
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +26 -43
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.cjs +3 -10
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.d.ts +1 -1
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.js +3 -10
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.types.d.ts +0 -1
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.types.d.ts.map +1 -1
- 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 -4
- package/dist/canvas/constants.d.ts +0 -1
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +1 -2
- package/dist/canvas/core/NodeTypeRegistry.cjs +27 -56
- package/dist/canvas/core/NodeTypeRegistry.d.ts +5 -10
- package/dist/canvas/core/NodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/NodeTypeRegistry.js +28 -57
- package/dist/canvas/core/useNodeTypeRegistry.cjs +3 -13
- package/dist/canvas/core/useNodeTypeRegistry.d.ts +1 -2
- package/dist/canvas/core/useNodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.js +4 -11
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.cjs +23 -22
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.d.ts.map +1 -1
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +24 -23
- package/dist/canvas/hooks/usePreviewNode.cjs +3 -7
- package/dist/canvas/hooks/usePreviewNode.d.ts.map +1 -1
- package/dist/canvas/hooks/usePreviewNode.js +3 -7
- 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/hooks/useCanvasStory.d.ts +0 -6
- package/dist/canvas/storybook-utils/hooks/useCanvasStory.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/storybook-utils/mocks/nodes.d.ts +1 -1
- package/dist/canvas/storybook-utils/mocks/nodes.d.ts.map +1 -1
- package/dist/canvas/styles/reactflow-reset.css +2 -2
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/utils/NodeUtils.cjs +9 -25
- package/dist/canvas/utils/NodeUtils.d.ts +0 -7
- package/dist/canvas/utils/NodeUtils.d.ts.map +1 -1
- package/dist/canvas/utils/NodeUtils.js +6 -13
- package/dist/canvas/utils/collapse.cjs +6 -13
- package/dist/canvas/utils/collapse.d.ts +2 -2
- package/dist/canvas/utils/collapse.d.ts.map +1 -1
- package/dist/canvas/utils/collapse.js +2 -9
- package/dist/canvas/utils/createPreviewNode.cjs +12 -59
- package/dist/canvas/utils/createPreviewNode.d.ts +2 -10
- package/dist/canvas/utils/createPreviewNode.d.ts.map +1 -1
- package/dist/canvas/utils/createPreviewNode.js +12 -50
- package/dist/canvas/utils/index.cjs +26 -47
- package/dist/canvas/utils/index.d.ts +1 -4
- package/dist/canvas/utils/index.d.ts.map +1 -1
- package/dist/canvas/utils/index.js +1 -4
- package/dist/canvas/utils/manifest-resolver.cjs +0 -8
- package/dist/canvas/utils/manifest-resolver.d.ts +0 -1
- package/dist/canvas/utils/manifest-resolver.d.ts.map +1 -1
- package/dist/canvas/utils/manifest-resolver.js +1 -6
- package/package.json +1 -1
- package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +0 -86
- 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 -52
- package/dist/canvas/components/LoopNode/LoopNode.cjs +0 -434
- package/dist/canvas/components/LoopNode/LoopNode.constants.cjs +0 -93
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts +0 -16
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.constants.js +0 -17
- 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 -185
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +0 -58
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +0 -124
- package/dist/canvas/components/LoopNode/LoopNode.js +0 -400
- package/dist/canvas/components/LoopNode/LoopNode.sequence.cjs +0 -433
- package/dist/canvas/components/LoopNode/LoopNode.sequence.d.ts +0 -57
- package/dist/canvas/components/LoopNode/LoopNode.sequence.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.sequence.js +0 -387
- package/dist/canvas/components/LoopNode/LoopNode.types.cjs +0 -18
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +0 -22
- 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 -60
- 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 -26
- package/dist/canvas/components/LoopNode/index.cjs +0 -79
- package/dist/canvas/components/LoopNode/index.d.ts +0 -5
- package/dist/canvas/components/LoopNode/index.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/index.js +0 -4
- package/dist/canvas/components/NodeViewportOverlay.cjs +0 -63
- package/dist/canvas/components/NodeViewportOverlay.d.ts +0 -22
- package/dist/canvas/components/NodeViewportOverlay.d.ts.map +0 -1
- package/dist/canvas/components/NodeViewportOverlay.js +0 -29
- package/dist/canvas/utils/container-sizing.cjs +0 -169
- package/dist/canvas/utils/container-sizing.d.ts +0 -23
- package/dist/canvas/utils/container-sizing.d.ts.map +0 -1
- package/dist/canvas/utils/container-sizing.js +0 -132
- package/dist/canvas/utils/createPreviewGraph.cjs +0 -126
- package/dist/canvas/utils/createPreviewGraph.d.ts +0 -37
- package/dist/canvas/utils/createPreviewGraph.d.ts.map +0 -1
- package/dist/canvas/utils/createPreviewGraph.js +0 -83
- package/dist/canvas/utils/preview-connection-handles.cjs +0 -55
- package/dist/canvas/utils/preview-connection-handles.d.ts +0 -14
- package/dist/canvas/utils/preview-connection-handles.d.ts.map +0 -1
- package/dist/canvas/utils/preview-connection-handles.js +0 -15
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Handle, Position } from "../../xyflow/react.js";
|
|
3
3
|
import { memo, useCallback, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { GRID_SPACING } from "../../constants.js";
|
|
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
|
|
13
|
-
const INWARD_HANDLE_ANCHOR_RADIUS_PX = INWARD_HANDLE_ANCHOR_SIZE_PX / 2;
|
|
14
|
-
const INWARD_NOTCH_OVERLAP_PX = {
|
|
15
|
-
artifact: 5,
|
|
16
|
-
input: 4,
|
|
17
|
-
output: 6
|
|
18
|
-
};
|
|
19
|
-
const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = position, handleType, label, labelIcon, labelBackgroundColor, visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight, portalAction = false })=>{
|
|
11
|
+
const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor, visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
|
|
20
12
|
const handleRef = useRef(null);
|
|
21
13
|
const [isHovered, setIsHovered] = useState(false);
|
|
22
14
|
const isVertical = position === Position.Top || position === Position.Bottom;
|
|
@@ -41,7 +33,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
41
33
|
handleId: id,
|
|
42
34
|
nodeId,
|
|
43
35
|
handleType,
|
|
44
|
-
position
|
|
36
|
+
position,
|
|
45
37
|
originalEvent: event
|
|
46
38
|
};
|
|
47
39
|
onAction?.(actionEvent);
|
|
@@ -49,83 +41,23 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
49
41
|
handleId: id,
|
|
50
42
|
nodeId,
|
|
51
43
|
handleType,
|
|
52
|
-
position
|
|
44
|
+
position
|
|
53
45
|
});
|
|
54
46
|
}, [
|
|
55
|
-
connectionPosition,
|
|
56
47
|
id,
|
|
57
48
|
nodeId,
|
|
58
49
|
handleType,
|
|
50
|
+
position,
|
|
59
51
|
onAction
|
|
60
52
|
]);
|
|
61
53
|
const markAsHovered = useCallback(()=>setIsHovered(true), []);
|
|
62
54
|
const unmarkAsHovered = useCallback(()=>setIsHovered(false), []);
|
|
63
|
-
const showActionButton = !!onAction && 'source' === type;
|
|
64
55
|
const { width: handleWidth, height: handleHeight, top, bottom, left, right, transform } = useButtonHandleSizeAndPosition({
|
|
65
56
|
position,
|
|
66
57
|
positionPercent,
|
|
67
58
|
numHandles: total,
|
|
68
59
|
customPositionAndOffsets
|
|
69
60
|
});
|
|
70
|
-
if (connectionPosition !== position) {
|
|
71
|
-
const layout = getInwardHandleLayout(position, handleType);
|
|
72
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
73
|
-
className: cx('absolute flex overflow-visible', visible ? 'pointer-events-auto opacity-100' : 'pointer-events-none opacity-0'),
|
|
74
|
-
style: {
|
|
75
|
-
top,
|
|
76
|
-
bottom,
|
|
77
|
-
left,
|
|
78
|
-
right,
|
|
79
|
-
transform: layout.rootTransform
|
|
80
|
-
},
|
|
81
|
-
onMouseEnter: markAsHovered,
|
|
82
|
-
onMouseLeave: unmarkAsHovered,
|
|
83
|
-
onMouseDown: unmarkAsHovered,
|
|
84
|
-
children: [
|
|
85
|
-
/*#__PURE__*/ jsx(InwardHandleContent, {
|
|
86
|
-
handleType: handleType,
|
|
87
|
-
isVertical: isVertical,
|
|
88
|
-
selected: selected,
|
|
89
|
-
hovered: isHovered,
|
|
90
|
-
showNotch: showNotches,
|
|
91
|
-
label: label,
|
|
92
|
-
labelIcon: labelIcon,
|
|
93
|
-
labelBackgroundColor: labelBackgroundColor,
|
|
94
|
-
layout: layout
|
|
95
|
-
}),
|
|
96
|
-
/*#__PURE__*/ jsx(Handle, {
|
|
97
|
-
ref: handleRef,
|
|
98
|
-
type: type,
|
|
99
|
-
position: connectionPosition,
|
|
100
|
-
id: id,
|
|
101
|
-
onMouseEnter: markAsHovered,
|
|
102
|
-
onMouseLeave: unmarkAsHovered,
|
|
103
|
-
onMouseDown: unmarkAsHovered,
|
|
104
|
-
className: cx('absolute! z-20 flex! items-center! justify-center! overflow-visible! border-0! rounded-none! bg-transparent!', visible ? 'cursor-crosshair! pointer-events-auto! opacity-100' : 'cursor-default! pointer-events-none! opacity-0'),
|
|
105
|
-
style: {
|
|
106
|
-
...layout.anchorStyle,
|
|
107
|
-
width: INWARD_HANDLE_ANCHOR_SIZE_PX,
|
|
108
|
-
height: INWARD_HANDLE_ANCHOR_SIZE_PX
|
|
109
|
-
}
|
|
110
|
-
}),
|
|
111
|
-
showActionButton ? /*#__PURE__*/ jsx(HandleButton, {
|
|
112
|
-
visible: showButton,
|
|
113
|
-
labelVisible: visible,
|
|
114
|
-
position: connectionPosition,
|
|
115
|
-
onAction: handleButtonClick,
|
|
116
|
-
handleRef: handleRef
|
|
117
|
-
}) : null
|
|
118
|
-
]
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
const portal = showActionButton && portalAction && !customPositionAndOffsets ? getHandleActionPortal({
|
|
122
|
-
nodeId,
|
|
123
|
-
position,
|
|
124
|
-
positionPercent,
|
|
125
|
-
total,
|
|
126
|
-
nodeWidth,
|
|
127
|
-
nodeHeight
|
|
128
|
-
}) : void 0;
|
|
129
61
|
return /*#__PURE__*/ jsxs(Handle, {
|
|
130
62
|
ref: handleRef,
|
|
131
63
|
type: type,
|
|
@@ -152,7 +84,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
152
84
|
hovered: isHovered,
|
|
153
85
|
showNotch: showNotches
|
|
154
86
|
}),
|
|
155
|
-
|
|
87
|
+
onAction && 'source' === type ? /*#__PURE__*/ jsx(HandleButton, {
|
|
156
88
|
visible: showButton,
|
|
157
89
|
labelVisible: visible,
|
|
158
90
|
position: position,
|
|
@@ -160,8 +92,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
160
92
|
handleRef: handleRef,
|
|
161
93
|
label: label,
|
|
162
94
|
labelIcon: labelIcon,
|
|
163
|
-
labelBackgroundColor: labelBackgroundColor
|
|
164
|
-
portal: portal
|
|
95
|
+
labelBackgroundColor: labelBackgroundColor
|
|
165
96
|
}) : label && /*#__PURE__*/ jsx(HandleLabel, {
|
|
166
97
|
position: position,
|
|
167
98
|
backgroundColor: labelBackgroundColor,
|
|
@@ -172,142 +103,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
172
103
|
});
|
|
173
104
|
};
|
|
174
105
|
const ButtonHandle = /*#__PURE__*/ memo(ButtonHandleBase);
|
|
175
|
-
|
|
176
|
-
if (!nodeWidth || !nodeHeight) return;
|
|
177
|
-
const edgeCoverageRatio = HANDLE_EDGE_COVERAGE_RATIO / total;
|
|
178
|
-
const horizontalWidth = nodeWidth * edgeCoverageRatio;
|
|
179
|
-
const verticalHeight = nodeHeight * edgeCoverageRatio;
|
|
180
|
-
const x = positionPercent / 100 * nodeWidth;
|
|
181
|
-
const y = positionPercent / 100 * nodeHeight;
|
|
182
|
-
switch(position){
|
|
183
|
-
case Position.Top:
|
|
184
|
-
return {
|
|
185
|
-
nodeId,
|
|
186
|
-
left: x,
|
|
187
|
-
top: 0,
|
|
188
|
-
width: horizontalWidth,
|
|
189
|
-
height: HANDLE_CROSS_AXIS_SIZE_PX,
|
|
190
|
-
transform: 'translate(-50%, -50%)'
|
|
191
|
-
};
|
|
192
|
-
case Position.Bottom:
|
|
193
|
-
return {
|
|
194
|
-
nodeId,
|
|
195
|
-
left: x,
|
|
196
|
-
top: nodeHeight - HANDLE_CROSS_AXIS_SIZE_PX,
|
|
197
|
-
width: horizontalWidth,
|
|
198
|
-
height: HANDLE_CROSS_AXIS_SIZE_PX,
|
|
199
|
-
transform: 'translate(-50%, 50%)'
|
|
200
|
-
};
|
|
201
|
-
case Position.Left:
|
|
202
|
-
return {
|
|
203
|
-
nodeId,
|
|
204
|
-
left: 0,
|
|
205
|
-
top: y,
|
|
206
|
-
width: HANDLE_CROSS_AXIS_SIZE_PX,
|
|
207
|
-
height: verticalHeight,
|
|
208
|
-
transform: 'translate(-50%, -50%)'
|
|
209
|
-
};
|
|
210
|
-
case Position.Right:
|
|
211
|
-
return {
|
|
212
|
-
nodeId,
|
|
213
|
-
left: nodeWidth - HANDLE_CROSS_AXIS_SIZE_PX,
|
|
214
|
-
top: y,
|
|
215
|
-
width: HANDLE_CROSS_AXIS_SIZE_PX,
|
|
216
|
-
height: verticalHeight,
|
|
217
|
-
transform: 'translate(50%, -50%)'
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
function InwardHandleContent({ handleType, isVertical, selected, hovered, showNotch, label, labelIcon, labelBackgroundColor, layout }) {
|
|
222
|
-
const labelElement = label ? /*#__PURE__*/ jsxs("div", {
|
|
223
|
-
className: cx('pointer-events-none flex h-6 items-center gap-1.5 whitespace-nowrap rounded-full border border-border-subtle bg-surface-overlay px-2.5', 'text-xs font-medium text-foreground'),
|
|
224
|
-
style: labelBackgroundColor ? {
|
|
225
|
-
backgroundColor: labelBackgroundColor
|
|
226
|
-
} : void 0,
|
|
227
|
-
children: [
|
|
228
|
-
labelIcon,
|
|
229
|
-
/*#__PURE__*/ jsx("span", {
|
|
230
|
-
children: label
|
|
231
|
-
})
|
|
232
|
-
]
|
|
233
|
-
}) : null;
|
|
234
|
-
const notchElement = /*#__PURE__*/ jsx("span", {
|
|
235
|
-
className: "relative z-10 flex shrink-0",
|
|
236
|
-
style: layout.notchStyle,
|
|
237
|
-
children: /*#__PURE__*/ jsx(HandleNotch, {
|
|
238
|
-
handleType: handleType,
|
|
239
|
-
isVertical: isVertical,
|
|
240
|
-
selected: selected,
|
|
241
|
-
hovered: hovered,
|
|
242
|
-
showNotch: showNotch
|
|
243
|
-
})
|
|
244
|
-
});
|
|
245
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
246
|
-
className: cx('flex items-center', layout.contentDirectionClassName),
|
|
247
|
-
children: [
|
|
248
|
-
labelElement,
|
|
249
|
-
notchElement
|
|
250
|
-
]
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
function getInwardHandleLayout(position, handleType) {
|
|
254
|
-
const notchOverlap = -INWARD_NOTCH_OVERLAP_PX[handleType];
|
|
255
|
-
switch(position){
|
|
256
|
-
case Position.Left:
|
|
257
|
-
return {
|
|
258
|
-
rootTransform: 'translate(0, -50%)',
|
|
259
|
-
contentDirectionClassName: 'flex-row',
|
|
260
|
-
notchStyle: {
|
|
261
|
-
marginLeft: notchOverlap
|
|
262
|
-
},
|
|
263
|
-
anchorStyle: {
|
|
264
|
-
left: `calc(100% - ${INWARD_HANDLE_ANCHOR_RADIUS_PX}px)`,
|
|
265
|
-
top: '50%',
|
|
266
|
-
transform: 'translateY(-50%)'
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
case Position.Right:
|
|
270
|
-
return {
|
|
271
|
-
rootTransform: 'translate(0, -50%)',
|
|
272
|
-
contentDirectionClassName: 'flex-row-reverse',
|
|
273
|
-
notchStyle: {
|
|
274
|
-
marginRight: notchOverlap
|
|
275
|
-
},
|
|
276
|
-
anchorStyle: {
|
|
277
|
-
left: -INWARD_HANDLE_ANCHOR_RADIUS_PX,
|
|
278
|
-
top: '50%',
|
|
279
|
-
transform: 'translateY(-50%)'
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
case Position.Top:
|
|
283
|
-
return {
|
|
284
|
-
rootTransform: 'translate(-50%, 0)',
|
|
285
|
-
contentDirectionClassName: 'flex-col',
|
|
286
|
-
notchStyle: {
|
|
287
|
-
marginTop: notchOverlap
|
|
288
|
-
},
|
|
289
|
-
anchorStyle: {
|
|
290
|
-
left: '50%',
|
|
291
|
-
top: `calc(100% - ${INWARD_HANDLE_ANCHOR_RADIUS_PX}px)`,
|
|
292
|
-
transform: 'translateX(-50%)'
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
case Position.Bottom:
|
|
296
|
-
return {
|
|
297
|
-
rootTransform: 'translate(-50%, 0)',
|
|
298
|
-
contentDirectionClassName: 'flex-col-reverse',
|
|
299
|
-
notchStyle: {
|
|
300
|
-
marginBottom: notchOverlap
|
|
301
|
-
},
|
|
302
|
-
anchorStyle: {
|
|
303
|
-
left: '50%',
|
|
304
|
-
top: -INWARD_HANDLE_ANCHOR_RADIUS_PX,
|
|
305
|
-
transform: 'translateX(-50%)'
|
|
306
|
-
}
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight, portalActions = false })=>{
|
|
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 })=>{
|
|
311
107
|
const finalSelected = shouldShowAddButtonFn({
|
|
312
108
|
showAddButton,
|
|
313
109
|
selected,
|
|
@@ -318,17 +114,14 @@ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = pos
|
|
|
318
114
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
319
115
|
children: [
|
|
320
116
|
/*#__PURE__*/ jsx(HandleHoverBridge, {
|
|
321
|
-
position:
|
|
117
|
+
position: position,
|
|
322
118
|
visible: hasSourceButtons && finalSelected
|
|
323
119
|
}),
|
|
324
|
-
visibleHandles.map((handle, index)
|
|
325
|
-
const handleVisible = handle.showHandle ?? visible;
|
|
326
|
-
return /*#__PURE__*/ jsx(ButtonHandle, {
|
|
120
|
+
visibleHandles.map((handle, index)=>/*#__PURE__*/ jsx(ButtonHandle, {
|
|
327
121
|
id: handle.id,
|
|
328
122
|
nodeId: nodeId,
|
|
329
123
|
type: handle.type,
|
|
330
124
|
position: position,
|
|
331
|
-
connectionPosition: connectionPosition,
|
|
332
125
|
handleType: handle.handleType,
|
|
333
126
|
label: handle.label,
|
|
334
127
|
labelIcon: handle.labelIcon,
|
|
@@ -336,16 +129,14 @@ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = pos
|
|
|
336
129
|
index: index,
|
|
337
130
|
total: visibleHandles.length,
|
|
338
131
|
selected: selected,
|
|
339
|
-
visible:
|
|
340
|
-
showButton: finalSelected &&
|
|
132
|
+
visible: handle.showHandle ?? visible,
|
|
133
|
+
showButton: finalSelected && (handle.showHandle ?? visible) && handle.showButton,
|
|
341
134
|
onAction: handle.onAction,
|
|
342
135
|
showNotches: showNotches,
|
|
343
136
|
customPositionAndOffsets: customPositionAndOffsets,
|
|
344
137
|
nodeWidth: nodeWidth,
|
|
345
|
-
nodeHeight: nodeHeight
|
|
346
|
-
|
|
347
|
-
}, handle.id);
|
|
348
|
-
})
|
|
138
|
+
nodeHeight: nodeHeight
|
|
139
|
+
}, handle.id))
|
|
349
140
|
]
|
|
350
141
|
});
|
|
351
142
|
};
|
|
@@ -28,9 +28,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
topPositionForHandle: ()=>topPositionForHandle,
|
|
29
29
|
transformForHandle: ()=>transformForHandle,
|
|
30
30
|
snapToGrid: ()=>snapToGrid,
|
|
31
|
-
HANDLE_CROSS_AXIS_SIZE_PX: ()=>HANDLE_CROSS_AXIS_SIZE_PX,
|
|
32
31
|
heightForHandleWithPosition: ()=>heightForHandleWithPosition,
|
|
33
|
-
HANDLE_EDGE_COVERAGE_RATIO: ()=>HANDLE_EDGE_COVERAGE_RATIO,
|
|
34
32
|
bottomPositionForHandle: ()=>bottomPositionForHandle,
|
|
35
33
|
calculateGridAlignedHandlePositions: ()=>calculateGridAlignedHandlePositions,
|
|
36
34
|
pixelToPercent: ()=>pixelToPercent,
|
|
@@ -41,8 +39,6 @@ const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
|
41
39
|
const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
42
40
|
const isHorizontalEdge = (position)=>position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
|
|
43
41
|
const isVerticalEdge = (position)=>position === react_cjs_namespaceObject.Position.Left || position === react_cjs_namespaceObject.Position.Right;
|
|
44
|
-
const HANDLE_CROSS_AXIS_SIZE_PX = 24;
|
|
45
|
-
const HANDLE_EDGE_COVERAGE_RATIO = 0.5;
|
|
46
42
|
const snapToGrid = (value, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING)=>Math.round(value / gridSize) * gridSize;
|
|
47
43
|
const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING)=>{
|
|
48
44
|
if (0 === numHandles) return [];
|
|
@@ -75,11 +71,11 @@ const pixelToPercent = (pixelPosition, nodeSize)=>{
|
|
|
75
71
|
};
|
|
76
72
|
const widthForHandleWithPosition = ({ position, numHandles, customWidth })=>{
|
|
77
73
|
if (customWidth) return `${customWidth}px`;
|
|
78
|
-
return isHorizontalEdge(position) ? `${
|
|
74
|
+
return isHorizontalEdge(position) ? `${50 / numHandles}%` : '24px';
|
|
79
75
|
};
|
|
80
76
|
const heightForHandleWithPosition = ({ position, numHandles, customHeight })=>{
|
|
81
77
|
if (customHeight) return `${customHeight}px`;
|
|
82
|
-
return isHorizontalEdge(position) ?
|
|
78
|
+
return isHorizontalEdge(position) ? '24px' : `${50 / numHandles}%`;
|
|
83
79
|
};
|
|
84
80
|
const topPositionForHandle = ({ position, positionPercent, customHeight, customTop, customBottom })=>{
|
|
85
81
|
if (null != customTop) {
|
|
@@ -138,8 +134,6 @@ const transformForHandle = ({ position, customPositionAndOffsets })=>{
|
|
|
138
134
|
const horizontalPercent = hasCustomHorizontal ? '0%' : position === react_cjs_namespaceObject.Position.Right ? '50%' : '-50%';
|
|
139
135
|
return `translate(${horizontalPercent}, ${verticalPercent})`;
|
|
140
136
|
};
|
|
141
|
-
exports.HANDLE_CROSS_AXIS_SIZE_PX = __webpack_exports__.HANDLE_CROSS_AXIS_SIZE_PX;
|
|
142
|
-
exports.HANDLE_EDGE_COVERAGE_RATIO = __webpack_exports__.HANDLE_EDGE_COVERAGE_RATIO;
|
|
143
137
|
exports.bottomPositionForHandle = __webpack_exports__.bottomPositionForHandle;
|
|
144
138
|
exports.calculateGridAlignedHandlePositions = __webpack_exports__.calculateGridAlignedHandlePositions;
|
|
145
139
|
exports.heightForHandleWithPosition = __webpack_exports__.heightForHandleWithPosition;
|
|
@@ -151,8 +145,6 @@ exports.topPositionForHandle = __webpack_exports__.topPositionForHandle;
|
|
|
151
145
|
exports.transformForHandle = __webpack_exports__.transformForHandle;
|
|
152
146
|
exports.widthForHandleWithPosition = __webpack_exports__.widthForHandleWithPosition;
|
|
153
147
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
154
|
-
"HANDLE_CROSS_AXIS_SIZE_PX",
|
|
155
|
-
"HANDLE_EDGE_COVERAGE_RATIO",
|
|
156
148
|
"bottomPositionForHandle",
|
|
157
149
|
"calculateGridAlignedHandlePositions",
|
|
158
150
|
"heightForHandleWithPosition",
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Position } from '../../xyflow/react.ts';
|
|
2
2
|
import type { HandleConfigurationSpecificPosition } from '../../schema/node-definition/handle';
|
|
3
|
-
export declare const HANDLE_CROSS_AXIS_SIZE_PX = 24;
|
|
4
|
-
export declare const HANDLE_EDGE_COVERAGE_RATIO = 0.5;
|
|
5
3
|
export declare const snapToGrid: (value: number, gridSize?: number) => number;
|
|
6
4
|
export declare const calculateGridAlignedHandlePositions: (nodeSize: number, numHandles: number, gridSize?: number) => number[];
|
|
7
5
|
export declare const pixelToPercent: (pixelPosition: number, nodeSize: number) => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonHandleStyleUtils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAEpE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"ButtonHandleStyleUtils.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/ButtonHandleStyleUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAEpE,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AAoB/F,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,EAAE,WAAU,MAAqB,KAAG,MAE3E,CAAC;AAmBF,eAAO,MAAM,mCAAmC,GAC9C,UAAU,MAAM,EAChB,YAAY,MAAM,EAClB,WAAU,MAAqB,KAC9B,MAAM,EAyCR,CAAC;AAQF,eAAO,MAAM,cAAc,GAAI,eAAe,MAAM,EAAE,UAAU,MAAM,KAAG,MAGxE,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAI,wCAIxC;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,KAAG,MAMH,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,yCAIzC;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,KAAG,MAMH,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,uEAMlC;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,KAAG,MAyBH,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,uEAMrC;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,KAAG,MAsBH,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,sEAMnC;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,KAAG,MAyBH,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,sEAMpC;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,KAAG,MAsBH,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,yCAGhC;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,wBAAwB,CAAC,EAAE,mCAAmC,CAAC;CAChE,KAAG,MAgBH,CAAC"}
|
|
@@ -2,8 +2,6 @@ import { Position } from "../../xyflow/react.js";
|
|
|
2
2
|
import { GRID_SPACING } from "../../constants.js";
|
|
3
3
|
const isHorizontalEdge = (position)=>position === Position.Top || position === Position.Bottom;
|
|
4
4
|
const isVerticalEdge = (position)=>position === Position.Left || position === Position.Right;
|
|
5
|
-
const HANDLE_CROSS_AXIS_SIZE_PX = 24;
|
|
6
|
-
const HANDLE_EDGE_COVERAGE_RATIO = 0.5;
|
|
7
5
|
const snapToGrid = (value, gridSize = GRID_SPACING)=>Math.round(value / gridSize) * gridSize;
|
|
8
6
|
const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = GRID_SPACING)=>{
|
|
9
7
|
if (0 === numHandles) return [];
|
|
@@ -36,11 +34,11 @@ const pixelToPercent = (pixelPosition, nodeSize)=>{
|
|
|
36
34
|
};
|
|
37
35
|
const widthForHandleWithPosition = ({ position, numHandles, customWidth })=>{
|
|
38
36
|
if (customWidth) return `${customWidth}px`;
|
|
39
|
-
return isHorizontalEdge(position) ? `${
|
|
37
|
+
return isHorizontalEdge(position) ? `${50 / numHandles}%` : '24px';
|
|
40
38
|
};
|
|
41
39
|
const heightForHandleWithPosition = ({ position, numHandles, customHeight })=>{
|
|
42
40
|
if (customHeight) return `${customHeight}px`;
|
|
43
|
-
return isHorizontalEdge(position) ?
|
|
41
|
+
return isHorizontalEdge(position) ? '24px' : `${50 / numHandles}%`;
|
|
44
42
|
};
|
|
45
43
|
const topPositionForHandle = ({ position, positionPercent, customHeight, customTop, customBottom })=>{
|
|
46
44
|
if (null != customTop) {
|
|
@@ -99,4 +97,4 @@ const transformForHandle = ({ position, customPositionAndOffsets })=>{
|
|
|
99
97
|
const horizontalPercent = hasCustomHorizontal ? '0%' : position === Position.Right ? '50%' : '-50%';
|
|
100
98
|
return `translate(${horizontalPercent}, ${verticalPercent})`;
|
|
101
99
|
};
|
|
102
|
-
export {
|
|
100
|
+
export { bottomPositionForHandle, calculateGridAlignedHandlePositions, heightForHandleWithPosition, leftPositionForHandle, pixelToPercent, rightPositionForHandle, snapToGrid, topPositionForHandle, transformForHandle, widthForHandleWithPosition };
|
|
@@ -32,7 +32,6 @@ const index_cjs_namespaceObject = require("../../layouts/index.cjs");
|
|
|
32
32
|
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
33
33
|
const external_react_namespaceObject = require("react");
|
|
34
34
|
const CssUtil_cjs_namespaceObject = require("../../utils/CssUtil.cjs");
|
|
35
|
-
const external_NodeViewportOverlay_cjs_namespaceObject = require("../NodeViewportOverlay.cjs");
|
|
36
35
|
const external_CanvasInlineButton_cjs_namespaceObject = require("./CanvasInlineButton.cjs");
|
|
37
36
|
const external_HandleLabel_cjs_namespaceObject = require("./HandleLabel.cjs");
|
|
38
37
|
const BUTTON_POSITION = {
|
|
@@ -42,7 +41,7 @@ const BUTTON_POSITION = {
|
|
|
42
41
|
[react_cjs_namespaceObject.Position.Right]: 'flex-row left-full top-1/2 -translate-y-1/2'
|
|
43
42
|
};
|
|
44
43
|
const DRAG_THRESHOLD = 5;
|
|
45
|
-
const HandleButton = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ visible, labelVisible, position, onAction, handleRef, label, labelIcon, labelBackgroundColor
|
|
44
|
+
const HandleButton = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ visible, labelVisible, position, onAction, handleRef, label, labelIcon, labelBackgroundColor })=>{
|
|
46
45
|
const didDragRef = (0, external_react_namespaceObject.useRef)(false);
|
|
47
46
|
const teardownRef = (0, external_react_namespaceObject.useRef)(null);
|
|
48
47
|
(0, external_react_namespaceObject.useEffect)(()=>()=>teardownRef.current?.(), []);
|
|
@@ -90,7 +89,7 @@ const HandleButton = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ v
|
|
|
90
89
|
document.addEventListener('pointercancel', cleanup);
|
|
91
90
|
teardownRef.current = cleanup;
|
|
92
91
|
}, []);
|
|
93
|
-
|
|
92
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
94
93
|
className: (0, CssUtil_cjs_namespaceObject.cx)('absolute flex items-center pointer-events-none', BUTTON_POSITION[position]),
|
|
95
94
|
children: [
|
|
96
95
|
visible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasInlineButton_cjs_namespaceObject.CanvasInlineButton, {
|
|
@@ -107,21 +106,7 @@ const HandleButton = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ v
|
|
|
107
106
|
})
|
|
108
107
|
]
|
|
109
108
|
});
|
|
110
|
-
if (portal) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PortaledHandleButton, {
|
|
111
|
-
portal: portal,
|
|
112
|
-
children: content
|
|
113
|
-
});
|
|
114
|
-
return content;
|
|
115
109
|
});
|
|
116
|
-
function PortaledHandleButton({ portal, children }) {
|
|
117
|
-
const { nodeId, ...anchor } = portal;
|
|
118
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_NodeViewportOverlay_cjs_namespaceObject.NodeViewportOverlay, {
|
|
119
|
-
nodeId: nodeId,
|
|
120
|
-
anchor: anchor,
|
|
121
|
-
layer: "nodeHandleAffordance",
|
|
122
|
-
children: children
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
110
|
const InlineLabel = ({ label, labelIcon, backgroundColor, visible = true })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
126
111
|
className: (0, CssUtil_cjs_namespaceObject.cx)('px-1.5 py-0.5 rounded-sm whitespace-nowrap select-none transition-opacity duration-250 z-10', visible ? 'opacity-100' : 'opacity-0'),
|
|
127
112
|
style: backgroundColor ? {
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { Position } from '../../xyflow/react.ts';
|
|
2
|
-
export
|
|
3
|
-
nodeId: string;
|
|
4
|
-
left: number;
|
|
5
|
-
top: number;
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
transform: string;
|
|
9
|
-
};
|
|
10
|
-
export declare const HandleButton: import("react").MemoExoticComponent<({ visible, labelVisible, position, onAction, handleRef, label, labelIcon, labelBackgroundColor, portal, }: {
|
|
2
|
+
export declare const HandleButton: import("react").MemoExoticComponent<({ visible, labelVisible, position, onAction, handleRef, label, labelIcon, labelBackgroundColor, }: {
|
|
11
3
|
visible?: boolean;
|
|
12
4
|
labelVisible?: boolean;
|
|
13
5
|
position: Position;
|
|
@@ -16,7 +8,6 @@ export declare const HandleButton: import("react").MemoExoticComponent<({ visibl
|
|
|
16
8
|
label?: string;
|
|
17
9
|
labelIcon?: React.ReactNode;
|
|
18
10
|
labelBackgroundColor?: string;
|
|
19
|
-
portal?: HandleButtonPortal;
|
|
20
11
|
}) => import("react/jsx-runtime").JSX.Element>;
|
|
21
12
|
export declare const HandleHoverBridge: import("react").MemoExoticComponent<({ position, visible }: {
|
|
22
13
|
position: Position;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HandleButton.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/HandleButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"HandleButton.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/HandleButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAqBpE,eAAO,MAAM,YAAY,0IAUpB;IACD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,6CAiGF,CAAC;AA0CF,eAAO,MAAM,iBAAiB,8DACJ;IAAE,QAAQ,EAAE,QAAQ,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,oDAOlE,CAAC"}
|
|
@@ -3,7 +3,6 @@ import { Row } from "../../layouts/index.js";
|
|
|
3
3
|
import { Position } from "../../xyflow/react.js";
|
|
4
4
|
import { memo, useCallback, useEffect, useRef } from "react";
|
|
5
5
|
import { cx } from "../../utils/CssUtil.js";
|
|
6
|
-
import { NodeViewportOverlay } from "../NodeViewportOverlay.js";
|
|
7
6
|
import { CanvasInlineButton } from "./CanvasInlineButton.js";
|
|
8
7
|
import { LABEL_SHADOW_STYLE } from "./HandleLabel.js";
|
|
9
8
|
const BUTTON_POSITION = {
|
|
@@ -13,7 +12,7 @@ const BUTTON_POSITION = {
|
|
|
13
12
|
[Position.Right]: 'flex-row left-full top-1/2 -translate-y-1/2'
|
|
14
13
|
};
|
|
15
14
|
const DRAG_THRESHOLD = 5;
|
|
16
|
-
const HandleButton = /*#__PURE__*/ memo(({ visible, labelVisible, position, onAction, handleRef, label, labelIcon, labelBackgroundColor
|
|
15
|
+
const HandleButton = /*#__PURE__*/ memo(({ visible, labelVisible, position, onAction, handleRef, label, labelIcon, labelBackgroundColor })=>{
|
|
17
16
|
const didDragRef = useRef(false);
|
|
18
17
|
const teardownRef = useRef(null);
|
|
19
18
|
useEffect(()=>()=>teardownRef.current?.(), []);
|
|
@@ -61,7 +60,7 @@ const HandleButton = /*#__PURE__*/ memo(({ visible, labelVisible, position, onAc
|
|
|
61
60
|
document.addEventListener('pointercancel', cleanup);
|
|
62
61
|
teardownRef.current = cleanup;
|
|
63
62
|
}, []);
|
|
64
|
-
|
|
63
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
65
64
|
className: cx('absolute flex items-center pointer-events-none', BUTTON_POSITION[position]),
|
|
66
65
|
children: [
|
|
67
66
|
visible && /*#__PURE__*/ jsx(CanvasInlineButton, {
|
|
@@ -78,21 +77,7 @@ const HandleButton = /*#__PURE__*/ memo(({ visible, labelVisible, position, onAc
|
|
|
78
77
|
})
|
|
79
78
|
]
|
|
80
79
|
});
|
|
81
|
-
if (portal) return /*#__PURE__*/ jsx(PortaledHandleButton, {
|
|
82
|
-
portal: portal,
|
|
83
|
-
children: content
|
|
84
|
-
});
|
|
85
|
-
return content;
|
|
86
80
|
});
|
|
87
|
-
function PortaledHandleButton({ portal, children }) {
|
|
88
|
-
const { nodeId, ...anchor } = portal;
|
|
89
|
-
return /*#__PURE__*/ jsx(NodeViewportOverlay, {
|
|
90
|
-
nodeId: nodeId,
|
|
91
|
-
anchor: anchor,
|
|
92
|
-
layer: "nodeHandleAffordance",
|
|
93
|
-
children: children
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
81
|
const InlineLabel = ({ label, labelIcon, backgroundColor, visible = true })=>/*#__PURE__*/ jsx("div", {
|
|
97
82
|
className: cx('px-1.5 py-0.5 rounded-sm whitespace-nowrap select-none transition-opacity duration-250 z-10', visible ? 'opacity-100' : 'opacity-0'),
|
|
98
83
|
style: backgroundColor ? {
|
|
@@ -32,7 +32,7 @@ const external_react_namespaceObject = require("react");
|
|
|
32
32
|
const manifest_resolver_cjs_namespaceObject = require("../../utils/manifest-resolver.cjs");
|
|
33
33
|
const ConnectedHandlesContext_cjs_namespaceObject = require("../BaseCanvas/ConnectedHandlesContext.cjs");
|
|
34
34
|
const external_index_cjs_namespaceObject = require("./index.cjs");
|
|
35
|
-
const useButtonHandles = ({ handleConfigurations, shouldShowHandles, handleAction, nodeId, selected, hovered, showAddButton, showNotches, shouldShowAddButtonFn, nodeWidth, nodeHeight
|
|
35
|
+
const useButtonHandles = ({ handleConfigurations, shouldShowHandles, handleAction, nodeId, selected, hovered, showAddButton, showNotches, shouldShowAddButtonFn, nodeWidth, nodeHeight })=>{
|
|
36
36
|
const connectedHandleIds = (0, ConnectedHandlesContext_cjs_namespaceObject.useConnectedHandles)(nodeId);
|
|
37
37
|
const node = (0, react_namespaceObject.useNodesData)(nodeId);
|
|
38
38
|
const handleElements = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
@@ -56,8 +56,7 @@ const useButtonHandles = ({ handleConfigurations, shouldShowHandles, handleActio
|
|
|
56
56
|
customPositionAndOffsets: config.customPositionAndOffsets,
|
|
57
57
|
shouldShowAddButtonFn: shouldShowAddButtonFn,
|
|
58
58
|
nodeWidth: nodeWidth,
|
|
59
|
-
nodeHeight: nodeHeight
|
|
60
|
-
portalActions: portalActions
|
|
59
|
+
nodeHeight: nodeHeight
|
|
61
60
|
}, `${i}:${config.position}:${config.handles.map((h)=>h.id).join(',')}`);
|
|
62
61
|
});
|
|
63
62
|
return elements;
|
|
@@ -74,7 +73,6 @@ const useButtonHandles = ({ handleConfigurations, shouldShowHandles, handleActio
|
|
|
74
73
|
shouldShowAddButtonFn,
|
|
75
74
|
nodeWidth,
|
|
76
75
|
nodeHeight,
|
|
77
|
-
portalActions,
|
|
78
76
|
node?.data
|
|
79
77
|
]);
|
|
80
78
|
return handleElements;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { HandleGroupManifest } from '../../schema/node-definition';
|
|
2
2
|
import type { HandleActionEvent } from '../ButtonHandle';
|
|
3
|
-
export declare const useButtonHandles: ({ handleConfigurations, shouldShowHandles, handleAction, nodeId, selected, hovered, showAddButton, showNotches, shouldShowAddButtonFn, nodeWidth, nodeHeight,
|
|
3
|
+
export declare const useButtonHandles: ({ handleConfigurations, shouldShowHandles, handleAction, nodeId, selected, hovered, showAddButton, showNotches, shouldShowAddButtonFn, nodeWidth, nodeHeight, }: {
|
|
4
4
|
handleConfigurations: HandleGroupManifest[];
|
|
5
5
|
shouldShowHandles: boolean;
|
|
6
6
|
nodeId: string;
|
|
@@ -11,7 +11,6 @@ export declare const useButtonHandles: ({ handleConfigurations, shouldShowHandle
|
|
|
11
11
|
showNotches?: boolean;
|
|
12
12
|
nodeWidth?: number;
|
|
13
13
|
nodeHeight?: number;
|
|
14
|
-
portalActions?: boolean;
|
|
15
14
|
shouldShowAddButtonFn?: ({ showAddButton, selected, hovered, }: {
|
|
16
15
|
showAddButton: boolean;
|
|
17
16
|
selected: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useButtonHandles.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/useButtonHandles.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,eAAO,MAAM,gBAAgB,GAAI,
|
|
1
|
+
{"version":3,"file":"useButtonHandles.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/useButtonHandles.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAGxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,eAAO,MAAM,gBAAgB,GAAI,iKAY9B;IACD,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;IAC5C,iBAAiB,EAAE,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAUpB,qBAAqB,CAAC,EAAE,CAAC,EACvB,aAAa,EACb,QAAQ,EACR,OAAO,GACR,EAAE;QACD,aAAa,EAAE,OAAO,CAAC;QACvB,QAAQ,EAAE,OAAO,CAAC;QAClB,OAAO,EAAE,OAAO,CAAC;KAClB,KAAK,OAAO,CAAC;CACf,wFAgEA,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { useMemo } from "react";
|
|
|
4
4
|
import { resolveHandles } from "../../utils/manifest-resolver.js";
|
|
5
5
|
import { useConnectedHandles } from "../BaseCanvas/ConnectedHandlesContext.js";
|
|
6
6
|
import { ButtonHandles } from "./index.js";
|
|
7
|
-
const useButtonHandles = ({ handleConfigurations, shouldShowHandles, handleAction, nodeId, selected, hovered, showAddButton, showNotches, shouldShowAddButtonFn, nodeWidth, nodeHeight
|
|
7
|
+
const useButtonHandles = ({ handleConfigurations, shouldShowHandles, handleAction, nodeId, selected, hovered, showAddButton, showNotches, shouldShowAddButtonFn, nodeWidth, nodeHeight })=>{
|
|
8
8
|
const connectedHandleIds = useConnectedHandles(nodeId);
|
|
9
9
|
const node = useNodesData(nodeId);
|
|
10
10
|
const handleElements = useMemo(()=>{
|
|
@@ -28,8 +28,7 @@ const useButtonHandles = ({ handleConfigurations, shouldShowHandles, handleActio
|
|
|
28
28
|
customPositionAndOffsets: config.customPositionAndOffsets,
|
|
29
29
|
shouldShowAddButtonFn: shouldShowAddButtonFn,
|
|
30
30
|
nodeWidth: nodeWidth,
|
|
31
|
-
nodeHeight: nodeHeight
|
|
32
|
-
portalActions: portalActions
|
|
31
|
+
nodeHeight: nodeHeight
|
|
33
32
|
}, `${i}:${config.position}:${config.handles.map((h)=>h.id).join(',')}`);
|
|
34
33
|
});
|
|
35
34
|
return elements;
|
|
@@ -46,7 +45,6 @@ const useButtonHandles = ({ handleConfigurations, shouldShowHandles, handleActio
|
|
|
46
45
|
shouldShowAddButtonFn,
|
|
47
46
|
nodeWidth,
|
|
48
47
|
nodeHeight,
|
|
49
|
-
portalActions,
|
|
50
48
|
node?.data
|
|
51
49
|
]);
|
|
52
50
|
return handleElements;
|