@uipath/apollo-react 4.13.0 → 4.13.1-pr581.30f7035
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 +26 -7
- package/dist/canvas/components/AddNodePanel/AddNodeManager.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodeManager.js +26 -7
- package/dist/canvas/components/AddNodePanel/AddNodePanel.types.d.ts +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodePanel.types.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/index.cjs +2 -6
- package/dist/canvas/components/AddNodePanel/index.d.ts +0 -1
- package/dist/canvas/components/AddNodePanel/index.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/index.js +1 -2
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +1 -0
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.cjs +25 -10
- package/dist/canvas/components/BaseNode/BaseNode.d.ts +2 -1
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +22 -10
- package/dist/canvas/components/BaseNode/BaseNode.types.d.ts +2 -0
- package/dist/canvas/components/BaseNode/BaseNode.types.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +115 -34
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +4 -2
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +117 -36
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +65 -5
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +4 -0
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +53 -5
- 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 +2 -2
- package/dist/canvas/components/ButtonHandle/SmartHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +2 -2
- package/dist/canvas/components/Edges/SequenceEdge.cjs +3 -2
- package/dist/canvas/components/Edges/SequenceEdge.d.ts +11 -2
- package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.js +4 -3
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +23 -15
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts +2 -0
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +24 -16
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +11 -8
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +11 -8
- package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +112 -0
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts +6 -0
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopCanvasNode.js +78 -0
- package/dist/canvas/components/LoopNode/LoopNode.cjs +435 -0
- package/dist/canvas/components/LoopNode/LoopNode.constants.cjs +77 -0
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts +12 -0
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNode.constants.js +13 -0
- package/dist/canvas/components/LoopNode/LoopNode.d.ts +5 -0
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +137 -0
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +26 -0
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +94 -0
- package/dist/canvas/components/LoopNode/LoopNode.js +401 -0
- package/dist/canvas/components/LoopNode/LoopNode.types.cjs +18 -0
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +11 -0
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNode.types.js +0 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.cjs +61 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts +9 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.js +27 -0
- package/dist/canvas/components/LoopNode/index.cjs +72 -0
- package/dist/canvas/components/LoopNode/index.d.ts +4 -0
- package/dist/canvas/components/LoopNode/index.d.ts.map +1 -0
- package/dist/canvas/components/LoopNode/index.js +3 -0
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +34 -25
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts +2 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +35 -26
- 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/components/index.cjs +27 -20
- package/dist/canvas/components/index.d.ts +1 -0
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +1 -0
- package/dist/canvas/constants.cjs +8 -0
- package/dist/canvas/constants.d.ts +2 -0
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +3 -1
- package/dist/canvas/core/CategoryTreeAdapter.cjs +1 -1
- package/dist/canvas/core/CategoryTreeAdapter.js +1 -1
- package/dist/canvas/core/NodeTypeRegistry.cjs +40 -24
- package/dist/canvas/core/NodeTypeRegistry.d.ts +8 -4
- package/dist/canvas/core/NodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/NodeTypeRegistry.js +40 -24
- package/dist/canvas/core/useNodeTypeRegistry.cjs +4 -3
- package/dist/canvas/core/useNodeTypeRegistry.d.ts +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.js +4 -3
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.cjs +10 -3
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.d.ts.map +1 -1
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +10 -3
- package/dist/canvas/hooks/usePreviewNode.cjs +4 -2
- package/dist/canvas/hooks/usePreviewNode.d.ts.map +1 -1
- package/dist/canvas/hooks/usePreviewNode.js +4 -2
- package/dist/canvas/schema/node-definition/handle.cjs +10 -2
- package/dist/canvas/schema/node-definition/handle.d.ts +9 -0
- package/dist/canvas/schema/node-definition/handle.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/handle.js +6 -1
- package/dist/canvas/schema/node-definition/index.cjs +4 -1
- 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 +4 -0
- package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts +1 -0
- package/dist/canvas/storybook-utils/manifests/index.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
- package/dist/canvas/styles/reactflow-reset.css +8 -0
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/utils/{createPreviewNode.cjs → createPreviewGraph.cjs} +115 -41
- package/dist/canvas/utils/createPreviewGraph.d.ts +43 -0
- package/dist/canvas/utils/createPreviewGraph.d.ts.map +1 -0
- package/dist/canvas/utils/{createPreviewNode.js → createPreviewGraph.js} +95 -36
- package/dist/canvas/utils/index.cjs +10 -10
- package/dist/canvas/utils/index.d.ts +2 -2
- package/dist/canvas/utils/index.d.ts.map +1 -1
- package/dist/canvas/utils/index.js +2 -2
- package/package.json +3 -3
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +0 -41
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +0 -3
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +0 -1
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +0 -7
- package/dist/canvas/utils/createPreviewNode.d.ts +0 -17
- package/dist/canvas/utils/createPreviewNode.d.ts.map +0 -1
|
@@ -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;
|
|
@@ -84,4 +97,39 @@ const transformForHandle = ({ position, customPositionAndOffsets })=>{
|
|
|
84
97
|
const horizontalPercent = hasCustomHorizontal ? '0%' : position === Position.Right ? '50%' : '-50%';
|
|
85
98
|
return `translate(${horizontalPercent}, ${verticalPercent})`;
|
|
86
99
|
};
|
|
87
|
-
|
|
100
|
+
const getInwardHandleSize = (handleType)=>{
|
|
101
|
+
if ('input' === handleType) return '14px';
|
|
102
|
+
if ('artifact' === handleType) return '16px';
|
|
103
|
+
return '18px';
|
|
104
|
+
};
|
|
105
|
+
const getInwardHandleTransform = (position, inset)=>{
|
|
106
|
+
switch(position){
|
|
107
|
+
case Position.Left:
|
|
108
|
+
return `translate(${inset}px, -50%)`;
|
|
109
|
+
case Position.Right:
|
|
110
|
+
return `translate(${-inset}px, -50%)`;
|
|
111
|
+
case Position.Top:
|
|
112
|
+
return `translate(-50%, ${inset}px)`;
|
|
113
|
+
case Position.Bottom:
|
|
114
|
+
return `translate(-50%, ${-inset}px)`;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const getInwardNotchLayout = (position)=>{
|
|
118
|
+
switch(position){
|
|
119
|
+
case Position.Top:
|
|
120
|
+
return 'flex-col justify-start';
|
|
121
|
+
case Position.Bottom:
|
|
122
|
+
return 'flex-col justify-end';
|
|
123
|
+
case Position.Left:
|
|
124
|
+
return 'justify-start';
|
|
125
|
+
case Position.Right:
|
|
126
|
+
return 'justify-end';
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
const INWARD_LABEL_POSITION = {
|
|
130
|
+
[Position.Top]: 'top-full left-1/2 -translate-x-1/2',
|
|
131
|
+
[Position.Bottom]: 'bottom-full left-1/2 -translate-x-1/2',
|
|
132
|
+
[Position.Left]: 'left-full top-1/2 -translate-y-1/2',
|
|
133
|
+
[Position.Right]: 'right-full top-1/2 -translate-y-1/2'
|
|
134
|
+
};
|
|
135
|
+
export { INWARD_LABEL_POSITION, bottomPositionForHandle, calculateGridAlignedHandlePositions, getInwardHandleSize, getInwardHandleTransform, getInwardNotchLayout, heightForHandleWithPosition, leftPositionForHandle, pixelToPercent, rightPositionForHandle, snapToGrid, topPositionForHandle, transformForHandle, widthForHandleWithPosition };
|
|
@@ -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);
|
|
@@ -384,7 +384,7 @@ function SmartHandle({ type, id, defaultPosition = 'source' === type ? react_nam
|
|
|
384
384
|
...rest,
|
|
385
385
|
children: visible && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
386
386
|
children: [
|
|
387
|
-
onAction && 'source' === type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
|
|
387
|
+
onAction && 'source' === type && showButton ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
|
|
388
388
|
visible: showButton,
|
|
389
389
|
labelVisible: visible,
|
|
390
390
|
position: computedPosition,
|
|
@@ -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);
|
|
@@ -353,7 +353,7 @@ function SmartHandle({ type, id, defaultPosition = 'source' === type ? Position.
|
|
|
353
353
|
...rest,
|
|
354
354
|
children: visible && /*#__PURE__*/ jsxs(Fragment, {
|
|
355
355
|
children: [
|
|
356
|
-
onAction && 'source' === type ? /*#__PURE__*/ jsx(HandleButton, {
|
|
356
|
+
onAction && 'source' === type && showButton ? /*#__PURE__*/ jsx(HandleButton, {
|
|
357
357
|
visible: showButton,
|
|
358
358
|
labelVisible: visible,
|
|
359
359
|
position: computedPosition,
|
|
@@ -80,7 +80,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
|
|
|
80
80
|
const pathElementRef = (0, external_react_namespaceObject.useRef)(null);
|
|
81
81
|
const { mode } = (0, BaseCanvasModeProvider_cjs_namespaceObject.useBaseCanvasMode)();
|
|
82
82
|
const isReadOnly = 'readonly' === mode;
|
|
83
|
-
const isPreviewEdge = id === external_constants_cjs_namespaceObject.PREVIEW_EDGE_ID;
|
|
83
|
+
const isPreviewEdge = id === external_constants_cjs_namespaceObject.PREVIEW_EDGE_ID || source === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID || target === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID;
|
|
84
84
|
const executionStatus = (0, index_cjs_namespaceObject.useEdgeExecutionState)(id, target);
|
|
85
85
|
const { validationStatus } = (0, index_cjs_namespaceObject.useElementValidationStatus)(id) ?? {
|
|
86
86
|
validationStatus: void 0
|
|
@@ -111,7 +111,8 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ (0, external_react_namespaceObje
|
|
|
111
111
|
sourcePosition,
|
|
112
112
|
targetPosition,
|
|
113
113
|
source,
|
|
114
|
-
target
|
|
114
|
+
target,
|
|
115
|
+
parentId: data?.parentId
|
|
115
116
|
});
|
|
116
117
|
const getEdgeColor = ()=>{
|
|
117
118
|
if (isDiffAdded) return 'var(--canvas-success-icon)';
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
import { type EdgeProps } from '../../xyflow/react.ts';
|
|
2
|
-
|
|
1
|
+
import { type Edge, type EdgeProps } from '../../xyflow/react.ts';
|
|
2
|
+
interface SequenceEdgeData extends Record<string, unknown> {
|
|
3
|
+
isDiffAdded?: boolean;
|
|
4
|
+
isDiffRemoved?: boolean;
|
|
5
|
+
label?: string;
|
|
6
|
+
parentId?: string;
|
|
7
|
+
}
|
|
8
|
+
type SequenceEdgeType = Edge<SequenceEdgeData>;
|
|
9
|
+
type SequenceEdgeProps = EdgeProps<SequenceEdgeType>;
|
|
10
|
+
export declare const SequenceEdge: import("react").NamedExoticComponent<SequenceEdgeProps>;
|
|
11
|
+
export {};
|
|
3
12
|
//# sourceMappingURL=SequenceEdge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SequenceEdge.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Edges/SequenceEdge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"SequenceEdge.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/Edges/SequenceEdge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,SAAS,EAAY,MAAM,0CAA0C,CAAC;AAW/F,UAAU,gBAAiB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACxD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,KAAK,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAC/C,KAAK,iBAAiB,GAAG,SAAS,CAAC,gBAAgB,CAAC,CAAC;AA2CrD,eAAO,MAAM,YAAY,yDAyMJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Position } from "../../xyflow/react.js";
|
|
3
3
|
import { memo, useRef, useState } from "react";
|
|
4
|
-
import { PREVIEW_EDGE_ID } from "../../constants.js";
|
|
4
|
+
import { PREVIEW_EDGE_ID, PREVIEW_NODE_ID } from "../../constants.js";
|
|
5
5
|
import { useEdgeExecutionState, useEdgePath, useElementValidationStatus } from "../../hooks/index.js";
|
|
6
6
|
import { useBaseCanvasMode } from "../BaseCanvas/BaseCanvasModeProvider.js";
|
|
7
7
|
import { EdgeToolbar, useEdgeToolbarState } from "../Toolbar/index.js";
|
|
@@ -52,7 +52,7 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
|
|
|
52
52
|
const pathElementRef = useRef(null);
|
|
53
53
|
const { mode } = useBaseCanvasMode();
|
|
54
54
|
const isReadOnly = 'readonly' === mode;
|
|
55
|
-
const isPreviewEdge = id === PREVIEW_EDGE_ID;
|
|
55
|
+
const isPreviewEdge = id === PREVIEW_EDGE_ID || source === PREVIEW_NODE_ID || target === PREVIEW_NODE_ID;
|
|
56
56
|
const executionStatus = useEdgeExecutionState(id, target);
|
|
57
57
|
const { validationStatus } = useElementValidationStatus(id) ?? {
|
|
58
58
|
validationStatus: void 0
|
|
@@ -83,7 +83,8 @@ const SequenceEdge_SequenceEdge = /*#__PURE__*/ memo(function({ id, selected, so
|
|
|
83
83
|
sourcePosition,
|
|
84
84
|
targetPosition,
|
|
85
85
|
source,
|
|
86
|
-
target
|
|
86
|
+
target,
|
|
87
|
+
parentId: data?.parentId
|
|
87
88
|
});
|
|
88
89
|
const getEdgeColor = ()=>{
|
|
89
90
|
if (isDiffAdded) return 'var(--canvas-success-icon)';
|
|
@@ -38,6 +38,7 @@ const animatedViewportManager_cjs_namespaceObject = require("../../stores/animat
|
|
|
38
38
|
const canvasStore_cjs_namespaceObject = require("../../stores/canvasStore.cjs");
|
|
39
39
|
const viewportManager_cjs_namespaceObject = require("../../stores/viewportManager.cjs");
|
|
40
40
|
const external_types_cjs_namespaceObject = require("../../types.cjs");
|
|
41
|
+
const createPreviewGraph_cjs_namespaceObject = require("../../utils/createPreviewGraph.cjs");
|
|
41
42
|
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
42
43
|
const transitions_cjs_namespaceObject = require("../../utils/transitions.cjs");
|
|
43
44
|
const AddNodeManager_cjs_namespaceObject = require("../AddNodePanel/AddNodeManager.cjs");
|
|
@@ -52,7 +53,7 @@ const DEFAULT_NODE_TYPES = {
|
|
|
52
53
|
'blank-canvas-node': external_BlankCanvasNode_index_cjs_namespaceObject.BlankCanvasNode,
|
|
53
54
|
preview: AddNodePreview_cjs_namespaceObject.AddNodePreview
|
|
54
55
|
};
|
|
55
|
-
const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
56
|
+
const HierarchicalCanvas = ({ additionalNodeTypes, mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
56
57
|
const canvasRef = (0, external_react_namespaceObject.useRef)(null);
|
|
57
58
|
const containerRef = (0, external_react_namespaceObject.useRef)(null);
|
|
58
59
|
const [reactFlowInstance, setReactFlowInstance] = (0, external_react_namespaceObject.useState)(null);
|
|
@@ -65,14 +66,17 @@ const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onC
|
|
|
65
66
|
const shouldAnimate = 'design' === mode && !(0, transitions_cjs_namespaceObject.prefersReducedMotion)();
|
|
66
67
|
const nodeManifests = (0, external_core_index_cjs_namespaceObject.useNodeManifests)();
|
|
67
68
|
const nodeTypes = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
const manifestNodeTypes = Object.fromEntries(nodeManifests.map(({ nodeType })=>nodeType).filter((nodeType)=>!Object.hasOwn(DEFAULT_NODE_TYPES, nodeType)).map((nodeType)=>[
|
|
70
|
+
nodeType,
|
|
71
|
+
external_BaseNode_index_cjs_namespaceObject.BaseNode
|
|
72
|
+
]));
|
|
73
|
+
return {
|
|
74
|
+
...DEFAULT_NODE_TYPES,
|
|
75
|
+
...manifestNodeTypes,
|
|
76
|
+
...additionalNodeTypes
|
|
77
|
+
};
|
|
75
78
|
}, [
|
|
79
|
+
additionalNodeTypes,
|
|
76
80
|
nodeManifests
|
|
77
81
|
]);
|
|
78
82
|
const currentCanvas = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectCurrentCanvas);
|
|
@@ -206,22 +210,26 @@ const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onC
|
|
|
206
210
|
const canvas = currentCanvasRef.current;
|
|
207
211
|
if (!connection.source || !connection.target || !canvas) return;
|
|
208
212
|
if (connection.target === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID || connection.source === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID) return;
|
|
213
|
+
const parentId = (0, createPreviewGraph_cjs_namespaceObject.inferParentId)(connection.source, connection.target, canvas.nodes);
|
|
209
214
|
const newEdge = {
|
|
210
215
|
id: `${connection.source}-${connection.target}-${Date.now()}`,
|
|
211
216
|
source: connection.source,
|
|
212
217
|
target: connection.target,
|
|
213
218
|
sourceHandle: connection.sourceHandle || void 0,
|
|
214
|
-
targetHandle: connection.targetHandle || void 0
|
|
219
|
+
targetHandle: connection.targetHandle || void 0,
|
|
220
|
+
...parentId ? {
|
|
221
|
+
data: {
|
|
222
|
+
parentId
|
|
223
|
+
}
|
|
224
|
+
} : {}
|
|
215
225
|
};
|
|
226
|
+
const hasPreview = canvas.nodes.some((n)=>n.id === external_constants_cjs_namespaceObject.PREVIEW_NODE_ID);
|
|
227
|
+
const baseEdges = hasPreview ? canvas.edges.filter((edge)=>edge.source !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID && edge.target !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID) : canvas.edges;
|
|
216
228
|
updateEdges([
|
|
217
|
-
...
|
|
229
|
+
...baseEdges,
|
|
218
230
|
newEdge
|
|
219
231
|
]);
|
|
220
|
-
|
|
221
|
-
if (hasPreview) {
|
|
222
|
-
updateNodes(canvas.nodes.filter((n)=>n.id !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID));
|
|
223
|
-
updateEdges(canvas.edges.filter((e)=>e.id !== external_constants_cjs_namespaceObject.PREVIEW_EDGE_ID));
|
|
224
|
-
}
|
|
232
|
+
if (hasPreview) updateNodes(canvas.nodes.filter((n)=>n.id !== external_constants_cjs_namespaceObject.PREVIEW_NODE_ID));
|
|
225
233
|
}, [
|
|
226
234
|
updateNodes,
|
|
227
235
|
updateEdges
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type NodeTypes } from '../../xyflow/react.ts';
|
|
1
2
|
import type React from 'react';
|
|
2
3
|
import type { CanvasLevel } from '../../types/canvas.types';
|
|
3
4
|
interface HierarchicalCanvasProps {
|
|
5
|
+
additionalNodeTypes?: NodeTypes;
|
|
4
6
|
mode?: 'view' | 'design' | 'readonly';
|
|
5
7
|
initialCanvases?: Record<string, CanvasLevel>;
|
|
6
8
|
initialPath?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchicalCanvas.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/HierarchicalCanvas.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HierarchicalCanvas.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/HierarchicalCanvas.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EAUf,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4B/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAY5D,UAAU,uBAAuB;IAC/B,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;IAKtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IAK9C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAMvB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,KAAK,IAAI,CAAC;IAInE,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;CACzC;AASD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAqZhE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Panel, applyEdgeChanges, applyNodeChanges } from "../../xyflow/react.js";
|
|
3
3
|
import { Spinner } from "@uipath/apollo-wind";
|
|
4
4
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { PREVIEW_NODE_ID } from "../../constants.js";
|
|
6
6
|
import { Breadcrumb } from "../../controls/index.js";
|
|
7
7
|
import { useNodeManifests } from "../../core/index.js";
|
|
8
8
|
import { useAddNodeOnConnectEnd } from "../../hooks/useAddNodeOnConnectEnd.js";
|
|
@@ -10,6 +10,7 @@ import { animatedViewportManager } from "../../stores/animatedViewportManager.js
|
|
|
10
10
|
import { selectBreadcrumbs, selectCanvasStack, selectCurrentCanvas, selectCurrentPath, selectDrillIntoNode, selectInitializeCanvas, selectInitializeWithData, selectNavigateToDepth, selectNavigateToSiblingCanvas, selectPreviousCanvas, selectTransitionState, selectUpdateEdges, selectUpdateNodes, selectUpdateSelection, selectUpdateViewport, useCanvasStore } from "../../stores/canvasStore.js";
|
|
11
11
|
import { viewportManager } from "../../stores/viewportManager.js";
|
|
12
12
|
import { DefaultCanvasTranslations } from "../../types.js";
|
|
13
|
+
import { inferParentId } from "../../utils/createPreviewGraph.js";
|
|
13
14
|
import { CanvasIcon } from "../../utils/icon-registry.js";
|
|
14
15
|
import { prefersReducedMotion } from "../../utils/transitions.js";
|
|
15
16
|
import { AddNodeManager } from "../AddNodePanel/AddNodeManager.js";
|
|
@@ -24,7 +25,7 @@ const DEFAULT_NODE_TYPES = {
|
|
|
24
25
|
'blank-canvas-node': BlankCanvasNode,
|
|
25
26
|
preview: AddNodePreview
|
|
26
27
|
};
|
|
27
|
-
const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
28
|
+
const HierarchicalCanvas = ({ additionalNodeTypes, mode = 'design', initialCanvases, initialPath, onCanvasesChange, onPathChange })=>{
|
|
28
29
|
const canvasRef = useRef(null);
|
|
29
30
|
const containerRef = useRef(null);
|
|
30
31
|
const [reactFlowInstance, setReactFlowInstance] = useState(null);
|
|
@@ -37,14 +38,17 @@ const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onC
|
|
|
37
38
|
const shouldAnimate = 'design' === mode && !prefersReducedMotion();
|
|
38
39
|
const nodeManifests = useNodeManifests();
|
|
39
40
|
const nodeTypes = useMemo(()=>{
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
const manifestNodeTypes = Object.fromEntries(nodeManifests.map(({ nodeType })=>nodeType).filter((nodeType)=>!Object.hasOwn(DEFAULT_NODE_TYPES, nodeType)).map((nodeType)=>[
|
|
42
|
+
nodeType,
|
|
43
|
+
BaseNode
|
|
44
|
+
]));
|
|
45
|
+
return {
|
|
46
|
+
...DEFAULT_NODE_TYPES,
|
|
47
|
+
...manifestNodeTypes,
|
|
48
|
+
...additionalNodeTypes
|
|
49
|
+
};
|
|
47
50
|
}, [
|
|
51
|
+
additionalNodeTypes,
|
|
48
52
|
nodeManifests
|
|
49
53
|
]);
|
|
50
54
|
const currentCanvas = useCanvasStore(selectCurrentCanvas);
|
|
@@ -178,22 +182,26 @@ const HierarchicalCanvas = ({ mode = 'design', initialCanvases, initialPath, onC
|
|
|
178
182
|
const canvas = currentCanvasRef.current;
|
|
179
183
|
if (!connection.source || !connection.target || !canvas) return;
|
|
180
184
|
if (connection.target === PREVIEW_NODE_ID || connection.source === PREVIEW_NODE_ID) return;
|
|
185
|
+
const parentId = inferParentId(connection.source, connection.target, canvas.nodes);
|
|
181
186
|
const newEdge = {
|
|
182
187
|
id: `${connection.source}-${connection.target}-${Date.now()}`,
|
|
183
188
|
source: connection.source,
|
|
184
189
|
target: connection.target,
|
|
185
190
|
sourceHandle: connection.sourceHandle || void 0,
|
|
186
|
-
targetHandle: connection.targetHandle || void 0
|
|
191
|
+
targetHandle: connection.targetHandle || void 0,
|
|
192
|
+
...parentId ? {
|
|
193
|
+
data: {
|
|
194
|
+
parentId
|
|
195
|
+
}
|
|
196
|
+
} : {}
|
|
187
197
|
};
|
|
198
|
+
const hasPreview = canvas.nodes.some((n)=>n.id === PREVIEW_NODE_ID);
|
|
199
|
+
const baseEdges = hasPreview ? canvas.edges.filter((edge)=>edge.source !== PREVIEW_NODE_ID && edge.target !== PREVIEW_NODE_ID) : canvas.edges;
|
|
188
200
|
updateEdges([
|
|
189
|
-
...
|
|
201
|
+
...baseEdges,
|
|
190
202
|
newEdge
|
|
191
203
|
]);
|
|
192
|
-
|
|
193
|
-
if (hasPreview) {
|
|
194
|
-
updateNodes(canvas.nodes.filter((n)=>n.id !== PREVIEW_NODE_ID));
|
|
195
|
-
updateEdges(canvas.edges.filter((e)=>e.id !== PREVIEW_EDGE_ID));
|
|
196
|
-
}
|
|
204
|
+
if (hasPreview) updateNodes(canvas.nodes.filter((n)=>n.id !== PREVIEW_NODE_ID));
|
|
197
205
|
}, [
|
|
198
206
|
updateNodes,
|
|
199
207
|
updateEdges
|
|
@@ -33,8 +33,8 @@ const external_react_namespaceObject = require("react");
|
|
|
33
33
|
const index_cjs_namespaceObject = require("../../core/index.cjs");
|
|
34
34
|
const canvasStore_cjs_namespaceObject = require("../../stores/canvasStore.cjs");
|
|
35
35
|
const CanvasEventBus_cjs_namespaceObject = require("../../utils/CanvasEventBus.cjs");
|
|
36
|
+
const createPreviewGraph_cjs_namespaceObject = require("../../utils/createPreviewGraph.cjs");
|
|
36
37
|
const icon_registry_cjs_namespaceObject = require("../../utils/icon-registry.cjs");
|
|
37
|
-
const createAddNodePreview_cjs_namespaceObject = require("../AddNodePanel/createAddNodePreview.cjs");
|
|
38
38
|
const external_HierarchicalCanvas_cjs_namespaceObject = require("./HierarchicalCanvas.cjs");
|
|
39
39
|
const createDemoCanvases = ()=>{
|
|
40
40
|
const rootCanvas = {
|
|
@@ -332,13 +332,16 @@ const CanvasWithControlsContent = ({ initialCanvases, initialPath, onCanvasesCha
|
|
|
332
332
|
const removeEdge = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectRemoveEdge);
|
|
333
333
|
const updateNodes = (0, canvasStore_cjs_namespaceObject.useCanvasStore)(canvasStore_cjs_namespaceObject.selectUpdateNodes);
|
|
334
334
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
335
|
+
const unsubscribe = CanvasEventBus_cjs_namespaceObject.canvasEventBus.on('handle:action', (event)=>{
|
|
336
|
+
(0, createPreviewGraph_cjs_namespaceObject.showPreviewGraph)({
|
|
337
|
+
sourceNodeId: event.nodeId,
|
|
338
|
+
sourceHandleId: event.handleId,
|
|
339
|
+
reactFlowInstance,
|
|
340
|
+
sourceHandleType: 'input' === event.handleType ? 'target' : 'source',
|
|
341
|
+
handlePosition: event.position
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
return unsubscribe;
|
|
342
345
|
}, [
|
|
343
346
|
reactFlowInstance
|
|
344
347
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchicalCanvasWithControls.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HierarchicalCanvasWithControls.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA8d/B,eAAO,MAAM,8BAA8B,EAAE,KAAK,CAAC,EA8BlD,CAAC"}
|