@uipath/apollo-react 4.13.0 → 4.13.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/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 +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +1 -1
- 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/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/styles/reactflow-reset.css +4 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/package.json +1 -1
|
@@ -178,11 +178,11 @@ const BaseNodeComponent = (props)=>{
|
|
|
178
178
|
statusContext
|
|
179
179
|
]);
|
|
180
180
|
const computedHeight = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
181
|
-
const handleSpacing = 2.5 * external_constants_cjs_namespaceObject.GRID_SPACING;
|
|
182
181
|
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);
|
|
183
182
|
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);
|
|
184
183
|
const leftRightHandles = Math.max(leftHandles, rightHandles);
|
|
185
|
-
|
|
184
|
+
const minNodeHeight = (2 * leftRightHandles + 2) * external_constants_cjs_namespaceObject.GRID_SPACING;
|
|
185
|
+
return Math.max(baseHeightRef.current, minNodeHeight);
|
|
186
186
|
}, [
|
|
187
187
|
handleConfigurations,
|
|
188
188
|
height
|
|
@@ -276,10 +276,19 @@ const BaseNodeComponent = (props)=>{
|
|
|
276
276
|
isHovered,
|
|
277
277
|
isFocused
|
|
278
278
|
]);
|
|
279
|
-
const shouldShowHandles = (0, external_react_namespaceObject.useMemo)(()=>isConnecting || selected || isHovered, [
|
|
279
|
+
const shouldShowHandles = (0, external_react_namespaceObject.useMemo)(()=>(isConnecting || selected || isHovered) && !dragging, [
|
|
280
280
|
isConnecting,
|
|
281
281
|
selected,
|
|
282
|
-
isHovered
|
|
282
|
+
isHovered,
|
|
283
|
+
dragging
|
|
284
|
+
]);
|
|
285
|
+
const toolbarPosition = toolbarConfig?.position ?? (toolbarConfig ? react_cjs_namespaceObject.Position.Top : void 0);
|
|
286
|
+
const hasHandleButtonsAtToolbar = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
287
|
+
if (!toolbarPosition || !handleConfigurations?.length) return false;
|
|
288
|
+
return handleConfigurations.some((config)=>config.position === toolbarPosition && false !== config.visible && config.handles.some((h)=>'source' === h.type && false !== h.showButton));
|
|
289
|
+
}, [
|
|
290
|
+
toolbarPosition,
|
|
291
|
+
handleConfigurations
|
|
283
292
|
]);
|
|
284
293
|
const hasVisibleBottomHandles = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
285
294
|
if (!handleConfigurations || !Array.isArray(handleConfigurations) || !selected || 'circle' === displayShape) return false;
|
|
@@ -327,7 +336,7 @@ const BaseNodeComponent = (props)=>{
|
|
|
327
336
|
nodeId: id,
|
|
328
337
|
selected: selected ?? false,
|
|
329
338
|
hovered: isHovered,
|
|
330
|
-
showAddButton: 'design' === mode && !multipleNodesSelected && !isConnecting,
|
|
339
|
+
showAddButton: 'design' === mode && !multipleNodesSelected && !isConnecting && !dragging,
|
|
331
340
|
showNotches,
|
|
332
341
|
nodeWidth: width,
|
|
333
342
|
nodeHeight: height,
|
|
@@ -458,8 +467,9 @@ const BaseNodeComponent = (props)=>{
|
|
|
458
467
|
toolbarConfig && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_Toolbar_index_cjs_namespaceObject.NodeToolbar, {
|
|
459
468
|
nodeId: id,
|
|
460
469
|
config: toolbarConfig,
|
|
461
|
-
expanded: selected,
|
|
462
|
-
hidden: dragging || multipleNodesSelected
|
|
470
|
+
expanded: selected || isHovered,
|
|
471
|
+
hidden: dragging || multipleNodesSelected,
|
|
472
|
+
offsetToolbar: hasHandleButtonsAtToolbar
|
|
463
473
|
})
|
|
464
474
|
]
|
|
465
475
|
}),
|
|
@@ -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,EAAkB,MAAM,0CAA0C,CAAC;AAsChG,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,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,EAAkB,MAAM,0CAA0C,CAAC;AAsChG,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,CAAC;AA+nB1B,eAAO,MAAM,QAAQ,8CAllBa,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,6CAklBhB,CAAC"}
|
|
@@ -150,11 +150,11 @@ const BaseNodeComponent = (props)=>{
|
|
|
150
150
|
statusContext
|
|
151
151
|
]);
|
|
152
152
|
const computedHeight = useMemo(()=>{
|
|
153
|
-
const handleSpacing = 2.5 * GRID_SPACING;
|
|
154
153
|
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);
|
|
155
154
|
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);
|
|
156
155
|
const leftRightHandles = Math.max(leftHandles, rightHandles);
|
|
157
|
-
|
|
156
|
+
const minNodeHeight = (2 * leftRightHandles + 2) * GRID_SPACING;
|
|
157
|
+
return Math.max(baseHeightRef.current, minNodeHeight);
|
|
158
158
|
}, [
|
|
159
159
|
handleConfigurations,
|
|
160
160
|
height
|
|
@@ -248,10 +248,19 @@ const BaseNodeComponent = (props)=>{
|
|
|
248
248
|
isHovered,
|
|
249
249
|
isFocused
|
|
250
250
|
]);
|
|
251
|
-
const shouldShowHandles = useMemo(()=>isConnecting || selected || isHovered, [
|
|
251
|
+
const shouldShowHandles = useMemo(()=>(isConnecting || selected || isHovered) && !dragging, [
|
|
252
252
|
isConnecting,
|
|
253
253
|
selected,
|
|
254
|
-
isHovered
|
|
254
|
+
isHovered,
|
|
255
|
+
dragging
|
|
256
|
+
]);
|
|
257
|
+
const toolbarPosition = toolbarConfig?.position ?? (toolbarConfig ? Position.Top : void 0);
|
|
258
|
+
const hasHandleButtonsAtToolbar = useMemo(()=>{
|
|
259
|
+
if (!toolbarPosition || !handleConfigurations?.length) return false;
|
|
260
|
+
return handleConfigurations.some((config)=>config.position === toolbarPosition && false !== config.visible && config.handles.some((h)=>'source' === h.type && false !== h.showButton));
|
|
261
|
+
}, [
|
|
262
|
+
toolbarPosition,
|
|
263
|
+
handleConfigurations
|
|
255
264
|
]);
|
|
256
265
|
const hasVisibleBottomHandles = useMemo(()=>{
|
|
257
266
|
if (!handleConfigurations || !Array.isArray(handleConfigurations) || !selected || 'circle' === displayShape) return false;
|
|
@@ -299,7 +308,7 @@ const BaseNodeComponent = (props)=>{
|
|
|
299
308
|
nodeId: id,
|
|
300
309
|
selected: selected ?? false,
|
|
301
310
|
hovered: isHovered,
|
|
302
|
-
showAddButton: 'design' === mode && !multipleNodesSelected && !isConnecting,
|
|
311
|
+
showAddButton: 'design' === mode && !multipleNodesSelected && !isConnecting && !dragging,
|
|
303
312
|
showNotches,
|
|
304
313
|
nodeWidth: width,
|
|
305
314
|
nodeHeight: height,
|
|
@@ -430,8 +439,9 @@ const BaseNodeComponent = (props)=>{
|
|
|
430
439
|
toolbarConfig && /*#__PURE__*/ jsx(NodeToolbar, {
|
|
431
440
|
nodeId: id,
|
|
432
441
|
config: toolbarConfig,
|
|
433
|
-
expanded: selected,
|
|
434
|
-
hidden: dragging || multipleNodesSelected
|
|
442
|
+
expanded: selected || isHovered,
|
|
443
|
+
hidden: dragging || multipleNodesSelected,
|
|
444
|
+
offsetToolbar: hasHandleButtonsAtToolbar
|
|
435
445
|
})
|
|
436
446
|
]
|
|
437
447
|
}),
|
|
@@ -37,7 +37,7 @@ const external_HandleButton_cjs_namespaceObject = require("./HandleButton.cjs");
|
|
|
37
37
|
const external_HandleLabel_cjs_namespaceObject = require("./HandleLabel.cjs");
|
|
38
38
|
const external_HandleNotch_cjs_namespaceObject = require("./HandleNotch.cjs");
|
|
39
39
|
const external_useButtonHandleSizeAndPosition_cjs_namespaceObject = require("./useButtonHandleSizeAndPosition.cjs");
|
|
40
|
-
const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor
|
|
40
|
+
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 })=>{
|
|
41
41
|
const handleRef = (0, external_react_namespaceObject.useRef)(null);
|
|
42
42
|
const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
|
|
43
43
|
const isVertical = position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
|
|
@@ -8,7 +8,7 @@ import { HandleButton, HandleHoverBridge } from "./HandleButton.js";
|
|
|
8
8
|
import { HandleLabel } from "./HandleLabel.js";
|
|
9
9
|
import { HandleNotch } from "./HandleNotch.js";
|
|
10
10
|
import { useButtonHandleSizeAndPosition } from "./useButtonHandleSizeAndPosition.js";
|
|
11
|
-
const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor
|
|
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 })=>{
|
|
12
12
|
const handleRef = useRef(null);
|
|
13
13
|
const [isHovered, setIsHovered] = useState(false);
|
|
14
14
|
const isVertical = position === Position.Top || position === Position.Bottom;
|
|
@@ -40,14 +40,27 @@ const external_constants_cjs_namespaceObject = require("../../constants.cjs");
|
|
|
40
40
|
const isHorizontalEdge = (position)=>position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
|
|
41
41
|
const isVerticalEdge = (position)=>position === react_cjs_namespaceObject.Position.Left || position === react_cjs_namespaceObject.Position.Right;
|
|
42
42
|
const snapToGrid = (value, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING)=>Math.round(value / gridSize) * gridSize;
|
|
43
|
-
const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING
|
|
43
|
+
const calculateGridAlignedHandlePositions = (nodeSize, numHandles, gridSize = external_constants_cjs_namespaceObject.GRID_SPACING)=>{
|
|
44
44
|
if (0 === numHandles) return [];
|
|
45
45
|
if (nodeSize <= 0) return [];
|
|
46
|
+
if (1 === numHandles) return [
|
|
47
|
+
nodeSize / 2
|
|
48
|
+
];
|
|
46
49
|
const idealSpacing = nodeSize / (numHandles + 1);
|
|
50
|
+
if (nodeSize % gridSize !== 0) {
|
|
51
|
+
const positions = [];
|
|
52
|
+
for(let i = 0; i < numHandles; i++)positions.push(idealSpacing * (i + 1));
|
|
53
|
+
return positions;
|
|
54
|
+
}
|
|
47
55
|
const roundedSpacing = Math.round(idealSpacing / gridSize) * gridSize;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
let gridAlignedSpacing = Math.max(gridSize, roundedSpacing);
|
|
57
|
+
let totalSpan = (numHandles - 1) * gridAlignedSpacing;
|
|
58
|
+
let startPosition = (nodeSize - totalSpan) / 2;
|
|
59
|
+
if (startPosition % gridSize !== 0 && gridAlignedSpacing > gridSize) {
|
|
60
|
+
gridAlignedSpacing -= gridSize;
|
|
61
|
+
totalSpan = (numHandles - 1) * gridAlignedSpacing;
|
|
62
|
+
startPosition = (nodeSize - totalSpan) / 2;
|
|
63
|
+
}
|
|
51
64
|
const positions = [];
|
|
52
65
|
for(let i = 0; i < numHandles; i++)positions.push(startPosition + i * gridAlignedSpacing);
|
|
53
66
|
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,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"}
|
|
@@ -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,CAAC,WAAW,EAAE,UAAU,CAAC;IAErE,eAAe,CAAC,EAAE,QAAQ,CAAC;IAE3B,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IAE7C,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAM9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAMlB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAoED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,WAAW,GACxB,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,2CAiEA;AAyUD,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,EAAE,EACF,eAAoE,EACpE,UAAmD,EACnD,KAAK,EACL,SAAS,EACT,SAAS,EACT,UAAU,EACV,KAAK,EACL,SAAS,EACT,
|
|
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,CAAC,WAAW,EAAE,UAAU,CAAC;IAErE,eAAe,CAAC,EAAE,QAAQ,CAAC;IAE3B,UAAU,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IAE7C,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAE5B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAE5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAM9C,OAAO,CAAC,EAAE,OAAO,CAAC;IAMlB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAoED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,WAAW,GACxB,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,2CAiEA;AAyUD,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,EAAE,EACF,eAAoE,EACpE,UAAmD,EACnD,KAAK,EACL,SAAS,EACT,SAAS,EACT,UAAU,EACV,KAAK,EACL,SAAS,EACT,oBAAoB,EACpB,UAAkB,EAClB,QAAgB,EAChB,WAAkB,EAClB,QAAQ,EACR,OAAc,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);
|
|
@@ -37,11 +37,12 @@ const external_NodeToolbar_utils_cjs_namespaceObject = require("./NodeToolbar.ut
|
|
|
37
37
|
const external_useToolbarState_cjs_namespaceObject = require("./useToolbarState.cjs");
|
|
38
38
|
const POSITIONER_BASE_CLASS = 'absolute flex pointer-events-none z-10';
|
|
39
39
|
const POSITIONER_POSITION_CLASS = {
|
|
40
|
-
top: 'top-[-52px] left-0 right-0 flex-row',
|
|
41
|
-
bottom: 'bottom-[-52px] left-0 right-0 flex-row',
|
|
42
|
-
left: 'left-[-52px] top-0 bottom-0 flex-col',
|
|
43
|
-
right: 'right-[-52px] top-0 bottom-0 flex-col'
|
|
40
|
+
top: 'top-[calc(-52px-var(--toolbar-offset,0px))] left-0 right-0 flex-row',
|
|
41
|
+
bottom: 'bottom-[calc(-52px-var(--toolbar-offset,0px))] left-0 right-0 flex-row',
|
|
42
|
+
left: 'left-[calc(-52px-var(--toolbar-offset,0px))] top-0 bottom-0 flex-col',
|
|
43
|
+
right: 'right-[calc(-52px-var(--toolbar-offset,0px))] top-0 bottom-0 flex-col'
|
|
44
44
|
};
|
|
45
|
+
const TOOLBAR_OFFSET = 48;
|
|
45
46
|
const POSITIONER_ALIGN_CLASS = {
|
|
46
47
|
start: 'justify-start',
|
|
47
48
|
center: 'justify-center',
|
|
@@ -61,7 +62,7 @@ const DROPDOWN_MENU_CLASS = "absolute top-[-2px] left-[calc(100%+4px)] min-w-[18
|
|
|
61
62
|
const DROPDOWN_ITEM_BASE_CLASS = "flex items-center gap-3 w-full py-2 px-3 bg-transparent border-none rounded-[4px] text-sm text-(--canvas-foreground) text-left [transition:background_0.15s_ease] enabled:hover:bg-(--canvas-background-hover) future:enabled:hover:bg-(--canvas-background-overlay) [&>svg]:shrink-0 [&>svg]:text-(--canvas-foreground)";
|
|
62
63
|
const DROPDOWN_ITEM_DISABLED_CLASS = 'cursor-not-allowed opacity-40 pointer-events-none';
|
|
63
64
|
const DROPDOWN_ITEM_ENABLED_CLASS = 'cursor-pointer opacity-100';
|
|
64
|
-
const NodeToolbarComponent = ({ nodeId, config, expanded, hidden })=>{
|
|
65
|
+
const NodeToolbarComponent = ({ nodeId, config, expanded, hidden, offsetToolbar })=>{
|
|
65
66
|
const { isDropdownOpen, setIsDropdownOpen, dropdownRef, buttonRef, actionsToDisplay, displayState, shouldShowOverflow, overflowActionsToDisplay, separatorOrientation, toggleDropdown } = (0, external_useToolbarState_cjs_namespaceObject.useToolbarState)({
|
|
66
67
|
config,
|
|
67
68
|
expanded,
|
|
@@ -80,6 +81,14 @@ const NodeToolbarComponent = ({ nodeId, config, expanded, hidden })=>{
|
|
|
80
81
|
const separatorClassName = (0, external_react_namespaceObject.useMemo)(()=>(0, apollo_wind_namespaceObject.cn)(SEPARATOR_BASE_CLASS, 'horizontal' === separatorOrientation ? SEPARATOR_HORIZONTAL_CLASS : SEPARATOR_VERTICAL_CLASS), [
|
|
81
82
|
separatorOrientation
|
|
82
83
|
]);
|
|
84
|
+
const offsetStyle = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
85
|
+
if (!offsetToolbar) return;
|
|
86
|
+
return {
|
|
87
|
+
'--toolbar-offset': `${TOOLBAR_OFFSET}px`
|
|
88
|
+
};
|
|
89
|
+
}, [
|
|
90
|
+
offsetToolbar
|
|
91
|
+
]);
|
|
83
92
|
const toolbarAnimationVariants = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
84
93
|
const offsetAxis = 'top' === position || 'bottom' === position ? 'y' : 'x';
|
|
85
94
|
const offsetAmount = 'top' === position || 'left' === position ? -10 : 10;
|
|
@@ -111,6 +120,7 @@ const NodeToolbarComponent = ({ nodeId, config, expanded, hidden })=>{
|
|
|
111
120
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.AnimatePresence, {
|
|
112
121
|
children: 'hidden' !== displayState && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
113
122
|
className: positionerClassName,
|
|
123
|
+
style: offsetStyle,
|
|
114
124
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(react_namespaceObject.motion.div, {
|
|
115
125
|
layout: "position",
|
|
116
126
|
className: containerClassName,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { NodeToolbarProps } from './NodeToolbar.types';
|
|
2
|
-
export declare const NodeToolbar: import("react").MemoExoticComponent<({ nodeId, config, expanded, hidden }: NodeToolbarProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
2
|
+
export declare const NodeToolbar: import("react").MemoExoticComponent<({ nodeId, config, expanded, hidden, offsetToolbar, }: NodeToolbarProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
3
3
|
//# sourceMappingURL=NodeToolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeToolbar.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Toolbar/NodeToolbar/NodeToolbar.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"NodeToolbar.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Toolbar/NodeToolbar/NodeToolbar.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA8O5D,eAAO,MAAM,WAAW,6FAhLrB,gBAAgB,oDAgLkC,CAAC"}
|
|
@@ -9,11 +9,12 @@ import { isSeparator } from "./NodeToolbar.utils.js";
|
|
|
9
9
|
import { useToolbarState } from "./useToolbarState.js";
|
|
10
10
|
const POSITIONER_BASE_CLASS = 'absolute flex pointer-events-none z-10';
|
|
11
11
|
const POSITIONER_POSITION_CLASS = {
|
|
12
|
-
top: 'top-[-52px] left-0 right-0 flex-row',
|
|
13
|
-
bottom: 'bottom-[-52px] left-0 right-0 flex-row',
|
|
14
|
-
left: 'left-[-52px] top-0 bottom-0 flex-col',
|
|
15
|
-
right: 'right-[-52px] top-0 bottom-0 flex-col'
|
|
12
|
+
top: 'top-[calc(-52px-var(--toolbar-offset,0px))] left-0 right-0 flex-row',
|
|
13
|
+
bottom: 'bottom-[calc(-52px-var(--toolbar-offset,0px))] left-0 right-0 flex-row',
|
|
14
|
+
left: 'left-[calc(-52px-var(--toolbar-offset,0px))] top-0 bottom-0 flex-col',
|
|
15
|
+
right: 'right-[calc(-52px-var(--toolbar-offset,0px))] top-0 bottom-0 flex-col'
|
|
16
16
|
};
|
|
17
|
+
const TOOLBAR_OFFSET = 48;
|
|
17
18
|
const POSITIONER_ALIGN_CLASS = {
|
|
18
19
|
start: 'justify-start',
|
|
19
20
|
center: 'justify-center',
|
|
@@ -33,7 +34,7 @@ const DROPDOWN_MENU_CLASS = "absolute top-[-2px] left-[calc(100%+4px)] min-w-[18
|
|
|
33
34
|
const DROPDOWN_ITEM_BASE_CLASS = "flex items-center gap-3 w-full py-2 px-3 bg-transparent border-none rounded-[4px] text-sm text-(--canvas-foreground) text-left [transition:background_0.15s_ease] enabled:hover:bg-(--canvas-background-hover) future:enabled:hover:bg-(--canvas-background-overlay) [&>svg]:shrink-0 [&>svg]:text-(--canvas-foreground)";
|
|
34
35
|
const DROPDOWN_ITEM_DISABLED_CLASS = 'cursor-not-allowed opacity-40 pointer-events-none';
|
|
35
36
|
const DROPDOWN_ITEM_ENABLED_CLASS = 'cursor-pointer opacity-100';
|
|
36
|
-
const NodeToolbarComponent = ({ nodeId, config, expanded, hidden })=>{
|
|
37
|
+
const NodeToolbarComponent = ({ nodeId, config, expanded, hidden, offsetToolbar })=>{
|
|
37
38
|
const { isDropdownOpen, setIsDropdownOpen, dropdownRef, buttonRef, actionsToDisplay, displayState, shouldShowOverflow, overflowActionsToDisplay, separatorOrientation, toggleDropdown } = useToolbarState({
|
|
38
39
|
config,
|
|
39
40
|
expanded,
|
|
@@ -52,6 +53,14 @@ const NodeToolbarComponent = ({ nodeId, config, expanded, hidden })=>{
|
|
|
52
53
|
const separatorClassName = useMemo(()=>cn(SEPARATOR_BASE_CLASS, 'horizontal' === separatorOrientation ? SEPARATOR_HORIZONTAL_CLASS : SEPARATOR_VERTICAL_CLASS), [
|
|
53
54
|
separatorOrientation
|
|
54
55
|
]);
|
|
56
|
+
const offsetStyle = useMemo(()=>{
|
|
57
|
+
if (!offsetToolbar) return;
|
|
58
|
+
return {
|
|
59
|
+
'--toolbar-offset': `${TOOLBAR_OFFSET}px`
|
|
60
|
+
};
|
|
61
|
+
}, [
|
|
62
|
+
offsetToolbar
|
|
63
|
+
]);
|
|
55
64
|
const toolbarAnimationVariants = useMemo(()=>{
|
|
56
65
|
const offsetAxis = 'top' === position || 'bottom' === position ? 'y' : 'x';
|
|
57
66
|
const offsetAmount = 'top' === position || 'left' === position ? -10 : 10;
|
|
@@ -83,6 +92,7 @@ const NodeToolbarComponent = ({ nodeId, config, expanded, hidden })=>{
|
|
|
83
92
|
return /*#__PURE__*/ jsx(AnimatePresence, {
|
|
84
93
|
children: 'hidden' !== displayState && /*#__PURE__*/ jsx("div", {
|
|
85
94
|
className: positionerClassName,
|
|
95
|
+
style: offsetStyle,
|
|
86
96
|
children: /*#__PURE__*/ jsxs(motion.div, {
|
|
87
97
|
layout: "position",
|
|
88
98
|
className: containerClassName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeToolbar.types.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Toolbar/NodeToolbar/NodeToolbar.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAC/C,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAElB,MAAM,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NodeToolbar.types.d.ts","sourceRoot":"","sources":["../../../../../src/canvas/components/Toolbar/NodeToolbar/NodeToolbar.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IAC/C,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;CACpC;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAElB,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
padding: 0 !important;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
.react-flow__node:hover {
|
|
14
|
+
z-index: 1000 !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
.future-dark .apollo-canvas-background {
|
|
14
18
|
background-image: linear-gradient(135deg, var(--canvas-background-overlay, var(--surface-overlay)) 0%, var(--canvas-background, var(--surface)) 100%);
|
|
15
19
|
}
|