@uipath/apollo-react 4.13.0-pr556.e4e2855 → 4.13.1-pr556.57ef73e
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/BaseNode/BaseNode.cjs +17 -7
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +17 -7
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +3 -3
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +3 -3
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +17 -4
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +17 -4
- package/dist/canvas/components/ButtonHandle/HandleButton.cjs +9 -3
- package/dist/canvas/components/ButtonHandle/HandleButton.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/HandleButton.js +9 -3
- package/dist/canvas/components/ButtonHandle/HandleLabel.cjs +11 -4
- package/dist/canvas/components/ButtonHandle/HandleLabel.d.ts +4 -1
- package/dist/canvas/components/ButtonHandle/HandleLabel.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/HandleLabel.js +7 -3
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.cjs +14 -9
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +1 -1
- package/dist/canvas/components/LoopNode/LoopNode.js +14 -9
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +11 -5
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +11 -5
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.cjs +15 -5
- 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 +15 -5
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.types.d.ts +1 -0
- package/dist/canvas/components/Toolbar/NodeToolbar/NodeToolbar.types.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
- package/dist/canvas/styles/reactflow-reset.css +8 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +3 -3
|
@@ -181,11 +181,11 @@ const BaseNodeComponent = (props)=>{
|
|
|
181
181
|
statusContext
|
|
182
182
|
]);
|
|
183
183
|
const computedHeight = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
184
|
-
const handleSpacing = 2.5 * external_constants_cjs_namespaceObject.GRID_SPACING;
|
|
185
184
|
const leftHandles = handleConfigurations.filter((config)=>config.position === react_cjs_namespaceObject.Position.Left && false !== config.visible).reduce((count, config)=>count + config.handles.filter((h)=>false !== h.visible).length, 0);
|
|
186
185
|
const rightHandles = handleConfigurations.filter((config)=>config.position === react_cjs_namespaceObject.Position.Right && false !== config.visible).reduce((count, config)=>count + config.handles.filter((h)=>false !== h.visible).length, 0);
|
|
187
186
|
const leftRightHandles = Math.max(leftHandles, rightHandles);
|
|
188
|
-
|
|
187
|
+
const minNodeHeight = (2 * leftRightHandles + 2) * external_constants_cjs_namespaceObject.GRID_SPACING;
|
|
188
|
+
return Math.max(baseHeightRef.current, minNodeHeight);
|
|
189
189
|
}, [
|
|
190
190
|
handleConfigurations,
|
|
191
191
|
height
|
|
@@ -279,10 +279,19 @@ const BaseNodeComponent = (props)=>{
|
|
|
279
279
|
isHovered,
|
|
280
280
|
isFocused
|
|
281
281
|
]);
|
|
282
|
-
const shouldShowHandles = (0, external_react_namespaceObject.useMemo)(()=>isConnecting || selected || isHovered, [
|
|
282
|
+
const shouldShowHandles = (0, external_react_namespaceObject.useMemo)(()=>(isConnecting || selected || isHovered) && !dragging, [
|
|
283
283
|
isConnecting,
|
|
284
284
|
selected,
|
|
285
|
-
isHovered
|
|
285
|
+
isHovered,
|
|
286
|
+
dragging
|
|
287
|
+
]);
|
|
288
|
+
const toolbarPosition = toolbarConfig?.position ?? (toolbarConfig ? react_cjs_namespaceObject.Position.Top : void 0);
|
|
289
|
+
const hasHandleButtonsAtToolbar = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
290
|
+
if (!toolbarPosition || !handleConfigurations?.length) return false;
|
|
291
|
+
return handleConfigurations.some((config)=>config.position === toolbarPosition && false !== config.visible && config.handles.some((h)=>'source' === h.type && false !== h.showButton));
|
|
292
|
+
}, [
|
|
293
|
+
toolbarPosition,
|
|
294
|
+
handleConfigurations
|
|
286
295
|
]);
|
|
287
296
|
const hasVisibleBottomHandles = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
288
297
|
if (!handleConfigurations || !Array.isArray(handleConfigurations) || !selected || 'circle' === displayShape) return false;
|
|
@@ -330,7 +339,7 @@ const BaseNodeComponent = (props)=>{
|
|
|
330
339
|
nodeId: id,
|
|
331
340
|
selected: selected ?? false,
|
|
332
341
|
hovered: isHovered,
|
|
333
|
-
showAddButton: 'design' === mode && !multipleNodesSelected && !isConnecting,
|
|
342
|
+
showAddButton: 'design' === mode && !multipleNodesSelected && !isConnecting && !dragging,
|
|
334
343
|
showNotches,
|
|
335
344
|
nodeWidth: width,
|
|
336
345
|
nodeHeight: height,
|
|
@@ -461,8 +470,9 @@ const BaseNodeComponent = (props)=>{
|
|
|
461
470
|
toolbarConfig && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbar_index_cjs_namespaceObject.NodeToolbar, {
|
|
462
471
|
nodeId: id,
|
|
463
472
|
config: toolbarConfig,
|
|
464
|
-
expanded: selected,
|
|
465
|
-
hidden: dragging || multipleNodesSelected
|
|
473
|
+
expanded: selected || isHovered,
|
|
474
|
+
hidden: dragging || multipleNodesSelected,
|
|
475
|
+
offsetToolbar: hasHandleButtonsAtToolbar
|
|
466
476
|
})
|
|
467
477
|
]
|
|
468
478
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAsChG,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,CAAC;AAa1B,eAAO,MAAM,kBAAkB,GAAI,OAAO,cAAc,YAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAsChG,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,CAAC;AAa1B,eAAO,MAAM,kBAAkB,GAAI,OAAO,cAAc,YAAkC,CAAC;AAsnB3F,eAAO,MAAM,QAAQ,8CAtlBa,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,6CAslBhB,CAAC"}
|
|
@@ -152,11 +152,11 @@ const BaseNodeComponent = (props)=>{
|
|
|
152
152
|
statusContext
|
|
153
153
|
]);
|
|
154
154
|
const computedHeight = useMemo(()=>{
|
|
155
|
-
const handleSpacing = 2.5 * GRID_SPACING;
|
|
156
155
|
const leftHandles = handleConfigurations.filter((config)=>config.position === Position.Left && false !== config.visible).reduce((count, config)=>count + config.handles.filter((h)=>false !== h.visible).length, 0);
|
|
157
156
|
const rightHandles = handleConfigurations.filter((config)=>config.position === Position.Right && false !== config.visible).reduce((count, config)=>count + config.handles.filter((h)=>false !== h.visible).length, 0);
|
|
158
157
|
const leftRightHandles = Math.max(leftHandles, rightHandles);
|
|
159
|
-
|
|
158
|
+
const minNodeHeight = (2 * leftRightHandles + 2) * GRID_SPACING;
|
|
159
|
+
return Math.max(baseHeightRef.current, minNodeHeight);
|
|
160
160
|
}, [
|
|
161
161
|
handleConfigurations,
|
|
162
162
|
height
|
|
@@ -250,10 +250,19 @@ const BaseNodeComponent = (props)=>{
|
|
|
250
250
|
isHovered,
|
|
251
251
|
isFocused
|
|
252
252
|
]);
|
|
253
|
-
const shouldShowHandles = useMemo(()=>isConnecting || selected || isHovered, [
|
|
253
|
+
const shouldShowHandles = useMemo(()=>(isConnecting || selected || isHovered) && !dragging, [
|
|
254
254
|
isConnecting,
|
|
255
255
|
selected,
|
|
256
|
-
isHovered
|
|
256
|
+
isHovered,
|
|
257
|
+
dragging
|
|
258
|
+
]);
|
|
259
|
+
const toolbarPosition = toolbarConfig?.position ?? (toolbarConfig ? Position.Top : void 0);
|
|
260
|
+
const hasHandleButtonsAtToolbar = useMemo(()=>{
|
|
261
|
+
if (!toolbarPosition || !handleConfigurations?.length) return false;
|
|
262
|
+
return handleConfigurations.some((config)=>config.position === toolbarPosition && false !== config.visible && config.handles.some((h)=>'source' === h.type && false !== h.showButton));
|
|
263
|
+
}, [
|
|
264
|
+
toolbarPosition,
|
|
265
|
+
handleConfigurations
|
|
257
266
|
]);
|
|
258
267
|
const hasVisibleBottomHandles = useMemo(()=>{
|
|
259
268
|
if (!handleConfigurations || !Array.isArray(handleConfigurations) || !selected || 'circle' === displayShape) return false;
|
|
@@ -301,7 +310,7 @@ const BaseNodeComponent = (props)=>{
|
|
|
301
310
|
nodeId: id,
|
|
302
311
|
selected: selected ?? false,
|
|
303
312
|
hovered: isHovered,
|
|
304
|
-
showAddButton: 'design' === mode && !multipleNodesSelected && !isConnecting,
|
|
313
|
+
showAddButton: 'design' === mode && !multipleNodesSelected && !isConnecting && !dragging,
|
|
305
314
|
showNotches,
|
|
306
315
|
nodeWidth: width,
|
|
307
316
|
nodeHeight: height,
|
|
@@ -432,8 +441,9 @@ const BaseNodeComponent = (props)=>{
|
|
|
432
441
|
toolbarConfig && /*#__PURE__*/ jsx(NodeToolbar, {
|
|
433
442
|
nodeId: id,
|
|
434
443
|
config: toolbarConfig,
|
|
435
|
-
expanded: selected,
|
|
436
|
-
hidden: dragging || multipleNodesSelected
|
|
444
|
+
expanded: selected || isHovered,
|
|
445
|
+
hidden: dragging || multipleNodesSelected,
|
|
446
|
+
offsetToolbar: hasHandleButtonsAtToolbar
|
|
437
447
|
})
|
|
438
448
|
]
|
|
439
449
|
}),
|
|
@@ -38,7 +38,7 @@ const external_HandleButton_cjs_namespaceObject = require("./HandleButton.cjs");
|
|
|
38
38
|
const external_HandleLabel_cjs_namespaceObject = require("./HandleLabel.cjs");
|
|
39
39
|
const external_HandleNotch_cjs_namespaceObject = require("./HandleNotch.cjs");
|
|
40
40
|
const external_useButtonHandleSizeAndPosition_cjs_namespaceObject = require("./useButtonHandleSizeAndPosition.cjs");
|
|
41
|
-
const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = position, handleType, label, labelIcon, labelBackgroundColor
|
|
41
|
+
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 })=>{
|
|
42
42
|
const handleRef = (0, external_react_namespaceObject.useRef)(null);
|
|
43
43
|
const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
|
|
44
44
|
const isVertical = position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
|
|
@@ -235,9 +235,9 @@ const ButtonHandle_InwardHandleLabel = /*#__PURE__*/ (0, external_react_namespac
|
|
|
235
235
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
236
236
|
ref: ref,
|
|
237
237
|
className: (0, CssUtil_cjs_namespaceObject.cx)('pointer-events-none absolute flex h-6 items-center whitespace-nowrap rounded-full border border-border-subtle px-2.5', external_ButtonHandleStyleUtils_cjs_namespaceObject.INWARD_LABEL_POSITION[connectionPosition]),
|
|
238
|
-
style: {
|
|
238
|
+
style: backgroundColor ? {
|
|
239
239
|
backgroundColor
|
|
240
|
-
},
|
|
240
|
+
} : void 0,
|
|
241
241
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Row, {
|
|
242
242
|
align: "center",
|
|
243
243
|
gap: 3,
|
|
@@ -9,7 +9,7 @@ import { HandleButton, HandleHoverBridge } from "./HandleButton.js";
|
|
|
9
9
|
import { HandleLabel } from "./HandleLabel.js";
|
|
10
10
|
import { HandleNotch } from "./HandleNotch.js";
|
|
11
11
|
import { useButtonHandleSizeAndPosition } from "./useButtonHandleSizeAndPosition.js";
|
|
12
|
-
const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = position, handleType, label, labelIcon, labelBackgroundColor
|
|
12
|
+
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 })=>{
|
|
13
13
|
const handleRef = useRef(null);
|
|
14
14
|
const [isHovered, setIsHovered] = useState(false);
|
|
15
15
|
const isVertical = position === Position.Top || position === Position.Bottom;
|
|
@@ -206,9 +206,9 @@ const ButtonHandle_InwardHandleLabel = /*#__PURE__*/ forwardRef(function({ conne
|
|
|
206
206
|
return /*#__PURE__*/ jsx("div", {
|
|
207
207
|
ref: ref,
|
|
208
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: {
|
|
209
|
+
style: backgroundColor ? {
|
|
210
210
|
backgroundColor
|
|
211
|
-
},
|
|
211
|
+
} : void 0,
|
|
212
212
|
children: /*#__PURE__*/ jsxs(Row, {
|
|
213
213
|
align: "center",
|
|
214
214
|
gap: 3,
|
|
@@ -44,14 +44,27 @@ const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
|
44
44
|
const isHorizontalEdge = (position)=>position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
|
|
45
45
|
const isVerticalEdge = (position)=>position === react_cjs_namespaceObject.Position.Left || position === react_cjs_namespaceObject.Position.Right;
|
|
46
46
|
const snapToGrid = (value, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING)=>Math.round(value / gridSize) * gridSize;
|
|
47
|
-
const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING
|
|
47
|
+
const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING)=>{
|
|
48
48
|
if (0 === numHandles) return [];
|
|
49
49
|
if (nodeSize <= 0) return [];
|
|
50
|
+
if (1 === numHandles) return [
|
|
51
|
+
nodeSize / 2
|
|
52
|
+
];
|
|
50
53
|
const idealSpacing = nodeSize / (numHandles + 1);
|
|
54
|
+
if (nodeSize % gridSize !== 0) {
|
|
55
|
+
const positions = [];
|
|
56
|
+
for(let i = 0; i < numHandles; i++)positions.push(idealSpacing * (i + 1));
|
|
57
|
+
return positions;
|
|
58
|
+
}
|
|
51
59
|
const roundedSpacing = Math.round(idealSpacing / gridSize) * gridSize;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
let gridAlignedSpacing = Math.max(gridSize, roundedSpacing);
|
|
61
|
+
let totalSpan = (numHandles - 1) * gridAlignedSpacing;
|
|
62
|
+
let startPosition = (nodeSize - totalSpan) / 2;
|
|
63
|
+
if (startPosition % gridSize !== 0 && gridAlignedSpacing > gridSize) {
|
|
64
|
+
gridAlignedSpacing -= gridSize;
|
|
65
|
+
totalSpan = (numHandles - 1) * gridAlignedSpacing;
|
|
66
|
+
startPosition = (nodeSize - totalSpan) / 2;
|
|
67
|
+
}
|
|
55
68
|
const positions = [];
|
|
56
69
|
for(let i = 0; i < numHandles; i++)positions.push(startPosition + i * gridAlignedSpacing);
|
|
57
70
|
return positions;
|
|
@@ -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;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,
|
|
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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AM,kBAAkB,GAAI,yCAGhC;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,wBAAwB,CAAC,EAAE,mCAAmC,CAAC;CAChE,KAAG,MAgBH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,YAAY,UAAU,GAAG,OAAO,GAAG,QAAQ,KAAG,MAIjF,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,UAAU,QAAQ,EAAE,OAAO,MAAM,KAAG,MAW5E,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,UAAU,QAAQ,KAAG,MAWzD,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAK1D,CAAC"}
|
|
@@ -3,14 +3,27 @@ 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
5
|
const snapToGrid = (value, gridSize = GRID_SPACING)=>Math.round(value / gridSize) * gridSize;
|
|
6
|
-
const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = GRID_SPACING
|
|
6
|
+
const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = GRID_SPACING)=>{
|
|
7
7
|
if (0 === numHandles) return [];
|
|
8
8
|
if (nodeSize <= 0) return [];
|
|
9
|
+
if (1 === numHandles) return [
|
|
10
|
+
nodeSize / 2
|
|
11
|
+
];
|
|
9
12
|
const idealSpacing = nodeSize / (numHandles + 1);
|
|
13
|
+
if (nodeSize % gridSize !== 0) {
|
|
14
|
+
const positions = [];
|
|
15
|
+
for(let i = 0; i < numHandles; i++)positions.push(idealSpacing * (i + 1));
|
|
16
|
+
return positions;
|
|
17
|
+
}
|
|
10
18
|
const roundedSpacing = Math.round(idealSpacing / gridSize) * gridSize;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
let gridAlignedSpacing = Math.max(gridSize, roundedSpacing);
|
|
20
|
+
let totalSpan = (numHandles - 1) * gridAlignedSpacing;
|
|
21
|
+
let startPosition = (nodeSize - totalSpan) / 2;
|
|
22
|
+
if (startPosition % gridSize !== 0 && gridAlignedSpacing > gridSize) {
|
|
23
|
+
gridAlignedSpacing -= gridSize;
|
|
24
|
+
totalSpan = (numHandles - 1) * gridAlignedSpacing;
|
|
25
|
+
startPosition = (nodeSize - totalSpan) / 2;
|
|
26
|
+
}
|
|
14
27
|
const positions = [];
|
|
15
28
|
for(let i = 0; i < numHandles; i++)positions.push(startPosition + i * gridAlignedSpacing);
|
|
16
29
|
return positions;
|
|
@@ -33,6 +33,7 @@ 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
35
|
const external_CanvasInlineButton_cjs_namespaceObject = require("./CanvasInlineButton.cjs");
|
|
36
|
+
const external_HandleLabel_cjs_namespaceObject = require("./HandleLabel.cjs");
|
|
36
37
|
const BUTTON_POSITION = {
|
|
37
38
|
[react_cjs_namespaceObject.Position.Top]: 'flex-col-reverse bottom-full left-1/2 -translate-x-1/2',
|
|
38
39
|
[react_cjs_namespaceObject.Position.Bottom]: 'flex-col top-full left-1/2 -translate-x-1/2',
|
|
@@ -71,6 +72,10 @@ const HandleButton = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ v
|
|
|
71
72
|
clientX: rect.left + rect.width / 2,
|
|
72
73
|
clientY: rect.top + rect.height / 2
|
|
73
74
|
}));
|
|
75
|
+
handleEl.dispatchEvent(new MouseEvent('mouseout', {
|
|
76
|
+
bubbles: true,
|
|
77
|
+
relatedTarget: document.body
|
|
78
|
+
}));
|
|
74
79
|
}
|
|
75
80
|
};
|
|
76
81
|
const cleanup = ()=>{
|
|
@@ -85,7 +90,7 @@ const HandleButton = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ v
|
|
|
85
90
|
teardownRef.current = cleanup;
|
|
86
91
|
}, []);
|
|
87
92
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
88
|
-
className: (0, CssUtil_cjs_namespaceObject.cx)('absolute flex items-center
|
|
93
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)('absolute flex items-center pointer-events-none', BUTTON_POSITION[position]),
|
|
89
94
|
children: [
|
|
90
95
|
visible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_CanvasInlineButton_cjs_namespaceObject.CanvasInlineButton, {
|
|
91
96
|
"aria-label": "Add node",
|
|
@@ -103,7 +108,7 @@ const HandleButton = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(({ v
|
|
|
103
108
|
});
|
|
104
109
|
});
|
|
105
110
|
const InlineLabel = ({ label, labelIcon, backgroundColor, visible = true })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
106
|
-
className: (0, CssUtil_cjs_namespaceObject.cx)('px-1.5 py-0.5 rounded-sm whitespace-nowrap select-none transition-opacity duration-250', visible ? 'opacity-100' : 'opacity-0'),
|
|
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'),
|
|
107
112
|
style: backgroundColor ? {
|
|
108
113
|
backgroundColor
|
|
109
114
|
} : void 0,
|
|
@@ -114,6 +119,7 @@ const InlineLabel = ({ label, labelIcon, backgroundColor, visible = true })=>/*#
|
|
|
114
119
|
labelIcon,
|
|
115
120
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
116
121
|
className: "text-xs font-bold text-foreground-muted",
|
|
122
|
+
style: backgroundColor ? void 0 : external_HandleLabel_cjs_namespaceObject.LABEL_SHADOW_STYLE,
|
|
117
123
|
children: label
|
|
118
124
|
})
|
|
119
125
|
]
|
|
@@ -130,7 +136,7 @@ const HandleHoverBridge = /*#__PURE__*/ (0, external_react_namespaceObject.memo)
|
|
|
130
136
|
if (!visible) return null;
|
|
131
137
|
const isVertical = position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
|
|
132
138
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
133
|
-
className: (0, CssUtil_cjs_namespaceObject.cx)(BRIDGE_BASE, BRIDGE_POSITION[position], isVertical ? 'h-
|
|
139
|
+
className: (0, CssUtil_cjs_namespaceObject.cx)(BRIDGE_BASE, BRIDGE_POSITION[position], isVertical ? 'h-15' : 'w-15')
|
|
134
140
|
});
|
|
135
141
|
});
|
|
136
142
|
exports.HandleButton = __webpack_exports__.HandleButton;
|
|
@@ -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"}
|
|
@@ -4,6 +4,7 @@ import { Position } from "../../xyflow/react.js";
|
|
|
4
4
|
import { memo, useCallback, useEffect, useRef } from "react";
|
|
5
5
|
import { cx } from "../../utils/CssUtil.js";
|
|
6
6
|
import { CanvasInlineButton } from "./CanvasInlineButton.js";
|
|
7
|
+
import { LABEL_SHADOW_STYLE } from "./HandleLabel.js";
|
|
7
8
|
const BUTTON_POSITION = {
|
|
8
9
|
[Position.Top]: 'flex-col-reverse bottom-full left-1/2 -translate-x-1/2',
|
|
9
10
|
[Position.Bottom]: 'flex-col top-full left-1/2 -translate-x-1/2',
|
|
@@ -42,6 +43,10 @@ const HandleButton = /*#__PURE__*/ memo(({ visible, labelVisible, position, onAc
|
|
|
42
43
|
clientX: rect.left + rect.width / 2,
|
|
43
44
|
clientY: rect.top + rect.height / 2
|
|
44
45
|
}));
|
|
46
|
+
handleEl.dispatchEvent(new MouseEvent('mouseout', {
|
|
47
|
+
bubbles: true,
|
|
48
|
+
relatedTarget: document.body
|
|
49
|
+
}));
|
|
45
50
|
}
|
|
46
51
|
};
|
|
47
52
|
const cleanup = ()=>{
|
|
@@ -56,7 +61,7 @@ const HandleButton = /*#__PURE__*/ memo(({ visible, labelVisible, position, onAc
|
|
|
56
61
|
teardownRef.current = cleanup;
|
|
57
62
|
}, []);
|
|
58
63
|
return /*#__PURE__*/ jsxs("div", {
|
|
59
|
-
className: cx('absolute flex items-center
|
|
64
|
+
className: cx('absolute flex items-center pointer-events-none', BUTTON_POSITION[position]),
|
|
60
65
|
children: [
|
|
61
66
|
visible && /*#__PURE__*/ jsx(CanvasInlineButton, {
|
|
62
67
|
"aria-label": "Add node",
|
|
@@ -74,7 +79,7 @@ const HandleButton = /*#__PURE__*/ memo(({ visible, labelVisible, position, onAc
|
|
|
74
79
|
});
|
|
75
80
|
});
|
|
76
81
|
const InlineLabel = ({ label, labelIcon, backgroundColor, visible = true })=>/*#__PURE__*/ jsx("div", {
|
|
77
|
-
className: cx('px-1.5 py-0.5 rounded-sm whitespace-nowrap select-none transition-opacity duration-250', visible ? 'opacity-100' : 'opacity-0'),
|
|
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'),
|
|
78
83
|
style: backgroundColor ? {
|
|
79
84
|
backgroundColor
|
|
80
85
|
} : void 0,
|
|
@@ -85,6 +90,7 @@ const InlineLabel = ({ label, labelIcon, backgroundColor, visible = true })=>/*#
|
|
|
85
90
|
labelIcon,
|
|
86
91
|
/*#__PURE__*/ jsx("span", {
|
|
87
92
|
className: "text-xs font-bold text-foreground-muted",
|
|
93
|
+
style: backgroundColor ? void 0 : LABEL_SHADOW_STYLE,
|
|
88
94
|
children: label
|
|
89
95
|
})
|
|
90
96
|
]
|
|
@@ -101,7 +107,7 @@ const HandleHoverBridge = /*#__PURE__*/ memo(({ position, visible })=>{
|
|
|
101
107
|
if (!visible) return null;
|
|
102
108
|
const isVertical = position === Position.Top || position === Position.Bottom;
|
|
103
109
|
return /*#__PURE__*/ jsx("div", {
|
|
104
|
-
className: cx(BRIDGE_BASE, BRIDGE_POSITION[position], isVertical ? 'h-
|
|
110
|
+
className: cx(BRIDGE_BASE, BRIDGE_POSITION[position], isVertical ? 'h-15' : 'w-15')
|
|
105
111
|
});
|
|
106
112
|
});
|
|
107
113
|
export { HandleButton, HandleHoverBridge };
|
|
@@ -24,12 +24,16 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
HandleLabel: ()=>HandleLabel
|
|
27
|
+
HandleLabel: ()=>HandleLabel,
|
|
28
|
+
LABEL_SHADOW_STYLE: ()=>LABEL_SHADOW_STYLE
|
|
28
29
|
});
|
|
29
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
31
|
const index_cjs_namespaceObject = require("../../layouts/index.cjs");
|
|
31
32
|
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
32
33
|
const CssUtil_cjs_namespaceObject = require("../../utils/CssUtil.cjs");
|
|
34
|
+
const LABEL_SHADOW_STYLE = {
|
|
35
|
+
textShadow: '0 0 4px var(--canvas-background), 0 0 4px var(--canvas-background)'
|
|
36
|
+
};
|
|
33
37
|
const LABEL_POSITION = {
|
|
34
38
|
[react_cjs_namespaceObject.Position.Top]: 'bottom-[calc(100%+4px)] left-1/2 -translate-x-1/2',
|
|
35
39
|
[react_cjs_namespaceObject.Position.Bottom]: 'top-[calc(100%+4px)] left-1/2 -translate-x-1/2',
|
|
@@ -38,9 +42,9 @@ const LABEL_POSITION = {
|
|
|
38
42
|
};
|
|
39
43
|
const HandleLabel = ({ position, backgroundColor, label, labelIcon, shouldTruncate })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
40
44
|
className: (0, CssUtil_cjs_namespaceObject.cx)('absolute px-1.5 py-0.5 rounded-sm z-1 whitespace-nowrap select-none', LABEL_POSITION[position], shouldTruncate && 'max-w-[50px] overflow-hidden'),
|
|
41
|
-
style: {
|
|
45
|
+
style: backgroundColor ? {
|
|
42
46
|
backgroundColor
|
|
43
|
-
},
|
|
47
|
+
} : void 0,
|
|
44
48
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Row, {
|
|
45
49
|
align: "center",
|
|
46
50
|
gap: 4,
|
|
@@ -48,14 +52,17 @@ const HandleLabel = ({ position, backgroundColor, label, labelIcon, shouldTrunca
|
|
|
48
52
|
labelIcon,
|
|
49
53
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
50
54
|
className: (0, CssUtil_cjs_namespaceObject.cx)('text-xs font-bold text-foreground-muted', shouldTruncate && 'overflow-hidden text-ellipsis whitespace-nowrap'),
|
|
55
|
+
style: backgroundColor ? void 0 : LABEL_SHADOW_STYLE,
|
|
51
56
|
children: label
|
|
52
57
|
})
|
|
53
58
|
]
|
|
54
59
|
})
|
|
55
60
|
});
|
|
56
61
|
exports.HandleLabel = __webpack_exports__.HandleLabel;
|
|
62
|
+
exports.LABEL_SHADOW_STYLE = __webpack_exports__.LABEL_SHADOW_STYLE;
|
|
57
63
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
58
|
-
"HandleLabel"
|
|
64
|
+
"HandleLabel",
|
|
65
|
+
"LABEL_SHADOW_STYLE"
|
|
59
66
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
60
67
|
Object.defineProperty(exports, '__esModule', {
|
|
61
68
|
value: true
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Position } from '../../xyflow/react.ts';
|
|
2
|
+
export declare const LABEL_SHADOW_STYLE: {
|
|
3
|
+
readonly textShadow: "0 0 4px var(--canvas-background), 0 0 4px var(--canvas-background)";
|
|
4
|
+
};
|
|
2
5
|
export declare const HandleLabel: ({ position, backgroundColor, label, labelIcon, shouldTruncate, }: {
|
|
3
6
|
position: Position;
|
|
4
|
-
backgroundColor
|
|
7
|
+
backgroundColor?: string;
|
|
5
8
|
label: string;
|
|
6
9
|
labelIcon?: React.ReactNode;
|
|
7
10
|
shouldTruncate?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HandleLabel.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/HandleLabel.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"HandleLabel.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/HandleLabel.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAGpE,eAAO,MAAM,kBAAkB;;CAErB,CAAC;AASX,eAAO,MAAM,WAAW,GAAI,kEAMzB;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,4CAsBA,CAAC"}
|
|
@@ -2,6 +2,9 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Row } from "../../layouts/index.js";
|
|
3
3
|
import { Position } from "../../xyflow/react.js";
|
|
4
4
|
import { cx } from "../../utils/CssUtil.js";
|
|
5
|
+
const LABEL_SHADOW_STYLE = {
|
|
6
|
+
textShadow: '0 0 4px var(--canvas-background), 0 0 4px var(--canvas-background)'
|
|
7
|
+
};
|
|
5
8
|
const LABEL_POSITION = {
|
|
6
9
|
[Position.Top]: 'bottom-[calc(100%+4px)] left-1/2 -translate-x-1/2',
|
|
7
10
|
[Position.Bottom]: 'top-[calc(100%+4px)] left-1/2 -translate-x-1/2',
|
|
@@ -10,9 +13,9 @@ const LABEL_POSITION = {
|
|
|
10
13
|
};
|
|
11
14
|
const HandleLabel = ({ position, backgroundColor, label, labelIcon, shouldTruncate })=>/*#__PURE__*/ jsx("div", {
|
|
12
15
|
className: cx('absolute px-1.5 py-0.5 rounded-sm z-1 whitespace-nowrap select-none', LABEL_POSITION[position], shouldTruncate && 'max-w-[50px] overflow-hidden'),
|
|
13
|
-
style: {
|
|
16
|
+
style: backgroundColor ? {
|
|
14
17
|
backgroundColor
|
|
15
|
-
},
|
|
18
|
+
} : void 0,
|
|
16
19
|
children: /*#__PURE__*/ jsxs(Row, {
|
|
17
20
|
align: "center",
|
|
18
21
|
gap: 4,
|
|
@@ -20,9 +23,10 @@ const HandleLabel = ({ position, backgroundColor, label, labelIcon, shouldTrunca
|
|
|
20
23
|
labelIcon,
|
|
21
24
|
/*#__PURE__*/ jsx("span", {
|
|
22
25
|
className: cx('text-xs font-bold text-foreground-muted', shouldTruncate && 'overflow-hidden text-ellipsis whitespace-nowrap'),
|
|
26
|
+
style: backgroundColor ? void 0 : LABEL_SHADOW_STYLE,
|
|
23
27
|
children: label
|
|
24
28
|
})
|
|
25
29
|
]
|
|
26
30
|
})
|
|
27
31
|
});
|
|
28
|
-
export { HandleLabel };
|
|
32
|
+
export { HandleLabel, LABEL_SHADOW_STYLE };
|
|
@@ -247,7 +247,7 @@ function useSmartPosition(nodeId, handleId, handleType, defaultPosition, hasSour
|
|
|
247
247
|
hasSourceHandles
|
|
248
248
|
]);
|
|
249
249
|
}
|
|
250
|
-
function SmartHandle({ type, id, defaultPosition = 'source' === type ? react_namespaceObject.Position.Right : react_namespaceObject.Position.Left, handleType = 'source' === type ? 'output' : 'input', style, className, nodeWidth, nodeHeight, label, labelIcon, labelBackgroundColor
|
|
250
|
+
function SmartHandle({ type, id, defaultPosition = 'source' === type ? react_namespaceObject.Position.Right : react_namespaceObject.Position.Left, handleType = 'source' === type ? 'output' : 'input', style, className, nodeWidth, nodeHeight, label, labelIcon, labelBackgroundColor, showButton = false, selected = false, showNotches = true, onAction, visible = true, configOrder, ...rest }) {
|
|
251
251
|
const nodeId = (0, react_namespaceObject.useNodeId)();
|
|
252
252
|
const updateNodeInternals = (0, react_namespaceObject.useUpdateNodeInternals)();
|
|
253
253
|
const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartHandle.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/SmartHandle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,WAAW,EAEhB,QAAQ,EAKT,MAAM,eAAe,CAAC;AAYvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAaxD,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAA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,EACd,WAAW,EACX,GAAG,IAAI,EACR,EAAE,gBAAgB,2CAgMlB;AASD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,2CAEtE;AAKD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,MAAM,CAAC,2CAEtE"}
|
|
@@ -216,7 +216,7 @@ function useSmartPosition(nodeId, handleId, handleType, defaultPosition, hasSour
|
|
|
216
216
|
hasSourceHandles
|
|
217
217
|
]);
|
|
218
218
|
}
|
|
219
|
-
function SmartHandle({ type, id, defaultPosition = 'source' === type ? Position.Right : Position.Left, handleType = 'source' === type ? 'output' : 'input', style, className, nodeWidth, nodeHeight, label, labelIcon, labelBackgroundColor
|
|
219
|
+
function SmartHandle({ type, id, defaultPosition = 'source' === type ? Position.Right : Position.Left, handleType = 'source' === type ? 'output' : 'input', style, className, nodeWidth, nodeHeight, label, labelIcon, labelBackgroundColor, showButton = false, selected = false, showNotches = true, onAction, visible = true, configOrder, ...rest }) {
|
|
220
220
|
const nodeId = useNodeId();
|
|
221
221
|
const updateNodeInternals = useUpdateNodeInternals();
|
|
222
222
|
const [isHovered, setIsHovered] = useState(false);
|
|
@@ -49,7 +49,6 @@ const external_Toolbar_index_cjs_namespaceObject = require("../Toolbar/index.cjs
|
|
|
49
49
|
const external_LoopNode_constants_cjs_namespaceObject = require("./LoopNode.constants.cjs");
|
|
50
50
|
const external_LoopNode_helpers_cjs_namespaceObject = require("./LoopNode.helpers.cjs");
|
|
51
51
|
const EMPTY_DATA = {};
|
|
52
|
-
const NOOP_HANDLE_ACTION = (_event)=>{};
|
|
53
52
|
const RESIZE_CONTROLS = [
|
|
54
53
|
{
|
|
55
54
|
position: 'top-left',
|
|
@@ -210,8 +209,11 @@ function LoopNodeComponent(props) {
|
|
|
210
209
|
]);
|
|
211
210
|
const handleMouseEnter = (0, external_react_namespaceObject.useCallback)(()=>setIsHovered(true), []);
|
|
212
211
|
const handleMouseLeave = (0, external_react_namespaceObject.useCallback)(()=>setIsHovered(false), []);
|
|
213
|
-
const
|
|
214
|
-
|
|
212
|
+
const handleOuterHandleAction = (0, external_react_namespaceObject.useCallback)((_event)=>{
|
|
213
|
+
setIsHovered(false);
|
|
214
|
+
}, []);
|
|
215
|
+
const shouldShowHandles = (isConnecting || selected || isHovered) && !dragging;
|
|
216
|
+
const showHandleAddButtons = 'design' === mode && !multipleNodesSelected && !isConnecting && !dragging;
|
|
215
217
|
const showResizeControls = selected && !dragging && 'design' === mode;
|
|
216
218
|
const showEmptyStateButton = 'design' === mode && !hasChildNodes && !!onAddFirstChild;
|
|
217
219
|
const interactionState = resolveInteractionState(dragging, selected, isHovered);
|
|
@@ -287,7 +289,7 @@ function LoopNodeComponent(props) {
|
|
|
287
289
|
toolbarConfig && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbar_index_cjs_namespaceObject.NodeToolbar, {
|
|
288
290
|
nodeId: id,
|
|
289
291
|
config: toolbarConfig,
|
|
290
|
-
expanded: selected,
|
|
292
|
+
expanded: selected || isHovered,
|
|
291
293
|
hidden: dragging || multipleNodesSelected
|
|
292
294
|
}),
|
|
293
295
|
handleGroupVariants.map(([variant, groups])=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(HandleGroups, {
|
|
@@ -301,7 +303,8 @@ function LoopNodeComponent(props) {
|
|
|
301
303
|
showNotches: shouldShowHandles,
|
|
302
304
|
nodeWidth: width,
|
|
303
305
|
nodeHeight: height,
|
|
304
|
-
connectedHandleIds: connectedHandleIds
|
|
306
|
+
connectedHandleIds: connectedHandleIds,
|
|
307
|
+
onOuterHandleAction: handleOuterHandleAction
|
|
305
308
|
}, variant))
|
|
306
309
|
]
|
|
307
310
|
});
|
|
@@ -376,7 +379,7 @@ function ResizeCornerIndicators({ selected }) {
|
|
|
376
379
|
}, position))
|
|
377
380
|
});
|
|
378
381
|
}
|
|
379
|
-
function HandleGroups({ nodeId, variant, groups, selected, hovered, shouldShowHandles, showAddButton, showNotches, nodeWidth, nodeHeight, connectedHandleIds }) {
|
|
382
|
+
function HandleGroups({ nodeId, variant, groups, selected, hovered, shouldShowHandles, showAddButton, showNotches, nodeWidth, nodeHeight, connectedHandleIds, onOuterHandleAction }) {
|
|
380
383
|
if (0 === groups.length) return null;
|
|
381
384
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
|
|
382
385
|
children: groups.map((group, groupIndex)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(HandleGroup, {
|
|
@@ -390,21 +393,23 @@ function HandleGroups({ nodeId, variant, groups, selected, hovered, shouldShowHa
|
|
|
390
393
|
showNotches: showNotches,
|
|
391
394
|
nodeWidth: nodeWidth,
|
|
392
395
|
nodeHeight: nodeHeight,
|
|
393
|
-
connectedHandleIds: connectedHandleIds
|
|
396
|
+
connectedHandleIds: connectedHandleIds,
|
|
397
|
+
onOuterHandleAction: onOuterHandleAction
|
|
394
398
|
}, `${variant}:${group.position}:${groupIndex}`))
|
|
395
399
|
});
|
|
396
400
|
}
|
|
397
|
-
function HandleGroup({ nodeId, variant, group, selected, hovered, shouldShowHandles, showAddButton, showNotches, nodeWidth, nodeHeight, connectedHandleIds }) {
|
|
401
|
+
function HandleGroup({ nodeId, variant, group, selected, hovered, shouldShowHandles, showAddButton, showNotches, nodeWidth, nodeHeight, connectedHandleIds, onOuterHandleAction }) {
|
|
398
402
|
const groupVisible = shouldShowHandles && (group.visible ?? true);
|
|
399
403
|
const enhancedHandles = (0, external_react_namespaceObject.useMemo)(()=>group.handles.map((handle)=>({
|
|
400
404
|
...handle,
|
|
401
405
|
showHandle: connectedHandleIds.has(handle.id) || groupVisible,
|
|
402
406
|
showButton: 'inner' === variant && 'source' === handle.type ? false : handle.showButton,
|
|
403
|
-
onAction: handle.onAction ?? ('inner' !== variant && 'source' === handle.type && handle.showButton ?
|
|
407
|
+
onAction: handle.onAction ?? ('inner' !== variant && 'source' === handle.type && handle.showButton ? onOuterHandleAction : void 0)
|
|
404
408
|
})), [
|
|
405
409
|
group.handles,
|
|
406
410
|
connectedHandleIds,
|
|
407
411
|
groupVisible,
|
|
412
|
+
onOuterHandleAction,
|
|
408
413
|
variant
|
|
409
414
|
]);
|
|
410
415
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_ButtonHandle_index_cjs_namespaceObject.ButtonHandles, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoopNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.tsx"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"LoopNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/LoopNode/LoopNode.tsx"],"names":[],"mappings":"AA2CA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA0CtD,iBAAS,iBAAiB,CAAC,KAAK,EAAE,aAAa,2CAkP9C;AAED,eAAO,MAAM,QAAQ,+DAA0B,CAAC"}
|
|
@@ -120,7 +120,7 @@ function pickPreferredInnerHandle(groups, type) {
|
|
|
120
120
|
handle
|
|
121
121
|
})));
|
|
122
122
|
if (0 === candidates.length) return null;
|
|
123
|
-
return candidates
|
|
123
|
+
return candidates[0];
|
|
124
124
|
}
|
|
125
125
|
exports.getLoopBodyCenter = __webpack_exports__.getLoopBodyCenter;
|
|
126
126
|
exports.getLoopRelativeBodyCenter = __webpack_exports__.getLoopRelativeBodyCenter;
|
|
@@ -89,6 +89,6 @@ function pickPreferredInnerHandle(groups, type) {
|
|
|
89
89
|
handle
|
|
90
90
|
})));
|
|
91
91
|
if (0 === candidates.length) return null;
|
|
92
|
-
return candidates
|
|
92
|
+
return candidates[0];
|
|
93
93
|
}
|
|
94
94
|
export { getLoopBodyCenter, getLoopRelativeBodyCenter, partitionLoopHandleGroups, resolveLoopPreviewConnectionHandles };
|