@uipath/apollo-react 4.13.0-pr556.ddd6fa1 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canvas/components/AddNodePanel/AddNodeManager.cjs +7 -26
- package/dist/canvas/components/AddNodePanel/AddNodeManager.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/AddNodeManager.js +7 -26
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +41 -0
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +3 -0
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +1 -0
- package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +7 -0
- package/dist/canvas/components/AddNodePanel/index.cjs +6 -2
- package/dist/canvas/components/AddNodePanel/index.d.ts +1 -0
- package/dist/canvas/components/AddNodePanel/index.d.ts.map +1 -1
- package/dist/canvas/components/AddNodePanel/index.js +2 -1
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +0 -1
- package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.cjs +3 -8
- package/dist/canvas/components/BaseNode/BaseNode.d.ts +1 -2
- package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
- package/dist/canvas/components/BaseNode/BaseNode.js +3 -5
- package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +34 -115
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +2 -4
- package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandle.js +36 -117
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +1 -48
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +0 -4
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
- package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +1 -36
- package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +1 -1
- package/dist/canvas/components/ButtonHandle/SmartHandle.js +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.cjs +2 -3
- package/dist/canvas/components/Edges/SequenceEdge.d.ts +2 -11
- package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
- package/dist/canvas/components/Edges/SequenceEdge.js +3 -4
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +15 -23
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts +0 -2
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +16 -24
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +8 -11
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
- package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +8 -11
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +25 -34
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts +1 -2
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
- package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +26 -35
- package/dist/canvas/components/index.cjs +20 -27
- package/dist/canvas/components/index.d.ts +0 -1
- package/dist/canvas/components/index.d.ts.map +1 -1
- package/dist/canvas/components/index.js +0 -1
- package/dist/canvas/constants.cjs +0 -8
- package/dist/canvas/constants.d.ts +0 -2
- package/dist/canvas/constants.d.ts.map +1 -1
- package/dist/canvas/constants.js +1 -3
- package/dist/canvas/core/NodeTypeRegistry.cjs +23 -39
- package/dist/canvas/core/NodeTypeRegistry.d.ts +4 -8
- package/dist/canvas/core/NodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/NodeTypeRegistry.js +23 -39
- package/dist/canvas/core/useNodeTypeRegistry.cjs +3 -4
- package/dist/canvas/core/useNodeTypeRegistry.d.ts +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.d.ts.map +1 -1
- package/dist/canvas/core/useNodeTypeRegistry.js +3 -4
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.cjs +3 -10
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.d.ts.map +1 -1
- package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +3 -10
- package/dist/canvas/hooks/usePreviewNode.cjs +2 -4
- package/dist/canvas/hooks/usePreviewNode.d.ts.map +1 -1
- package/dist/canvas/hooks/usePreviewNode.js +2 -4
- package/dist/canvas/schema/node-definition/handle.cjs +2 -10
- package/dist/canvas/schema/node-definition/handle.d.ts +0 -9
- package/dist/canvas/schema/node-definition/handle.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/handle.js +1 -6
- package/dist/canvas/schema/node-definition/index.cjs +1 -4
- package/dist/canvas/schema/node-definition/index.d.ts +3 -3
- package/dist/canvas/schema/node-definition/index.d.ts.map +1 -1
- package/dist/canvas/schema/node-definition/index.js +2 -2
- package/dist/canvas/schema/node-definition/node-manifest.d.ts +0 -4
- package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts +0 -1
- package/dist/canvas/storybook-utils/manifests/index.d.ts.map +1 -1
- package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
- package/dist/canvas/styles/tailwind.canvas.css +1 -1
- package/dist/canvas/utils/{createPreviewGraph.cjs → createPreviewNode.cjs} +41 -115
- package/dist/canvas/utils/createPreviewNode.d.ts +17 -0
- package/dist/canvas/utils/createPreviewNode.d.ts.map +1 -0
- package/dist/canvas/utils/{createPreviewGraph.js → createPreviewNode.js} +36 -95
- package/dist/canvas/utils/index.cjs +10 -10
- package/dist/canvas/utils/index.d.ts +2 -2
- package/dist/canvas/utils/index.d.ts.map +1 -1
- package/dist/canvas/utils/index.js +2 -2
- package/package.json +3 -3
- package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +0 -112
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts +0 -6
- package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopCanvasNode.js +0 -78
- package/dist/canvas/components/LoopNode/LoopNode.cjs +0 -430
- package/dist/canvas/components/LoopNode/LoopNode.constants.cjs +0 -77
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts +0 -12
- package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.constants.js +0 -13
- package/dist/canvas/components/LoopNode/LoopNode.d.ts +0 -5
- package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +0 -137
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +0 -26
- package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.helpers.js +0 -94
- package/dist/canvas/components/LoopNode/LoopNode.js +0 -396
- package/dist/canvas/components/LoopNode/LoopNode.types.cjs +0 -18
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +0 -11
- package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNode.types.js +0 -0
- package/dist/canvas/components/LoopNode/LoopNodePreview.cjs +0 -61
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts +0 -9
- package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/LoopNodePreview.js +0 -27
- package/dist/canvas/components/LoopNode/index.cjs +0 -72
- package/dist/canvas/components/LoopNode/index.d.ts +0 -4
- package/dist/canvas/components/LoopNode/index.d.ts.map +0 -1
- package/dist/canvas/components/LoopNode/index.js +0 -3
- package/dist/canvas/utils/createPreviewGraph.d.ts +0 -43
- package/dist/canvas/utils/createPreviewGraph.d.ts.map +0 -1
|
@@ -35,20 +35,6 @@ const usePreviewNode_cjs_namespaceObject = require("../../hooks/usePreviewNode.c
|
|
|
35
35
|
const external_utils_index_cjs_namespaceObject = require("../../utils/index.cjs");
|
|
36
36
|
const external_FloatingCanvasPanel_index_cjs_namespaceObject = require("../FloatingCanvasPanel/index.cjs");
|
|
37
37
|
const external_AddNodePanel_cjs_namespaceObject = require("./AddNodePanel.cjs");
|
|
38
|
-
function resolveNodePlacement(nodes, insertedNode, ignoredNodeTypes) {
|
|
39
|
-
if (!insertedNode.parentId) return (0, external_utils_index_cjs_namespaceObject.resolveCollisions)(nodes, {
|
|
40
|
-
ignoredNodeTypes
|
|
41
|
-
});
|
|
42
|
-
const siblingNodes = nodes.filter((node)=>node.parentId === insertedNode.parentId);
|
|
43
|
-
const resolvedSiblings = (0, external_utils_index_cjs_namespaceObject.resolveCollisions)(siblingNodes, {
|
|
44
|
-
ignoredNodeTypes
|
|
45
|
-
});
|
|
46
|
-
const resolvedSiblingsById = new Map(resolvedSiblings.map((node)=>[
|
|
47
|
-
node.id,
|
|
48
|
-
node
|
|
49
|
-
]));
|
|
50
|
-
return nodes.map((node)=>resolvedSiblingsById.get(node.id) ?? node);
|
|
51
|
-
}
|
|
52
38
|
const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData, onBeforeNodeAdded, onNodeAdded, ignoredNodeTypes })=>{
|
|
53
39
|
const reactFlowInstance = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
54
40
|
const registry = (0, index_cjs_namespaceObject.useOptionalNodeTypeRegistry)();
|
|
@@ -97,17 +83,15 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
|
|
|
97
83
|
id: newNodeId,
|
|
98
84
|
type: nodeItem.data.type,
|
|
99
85
|
position: currentPreviewNode.position,
|
|
100
|
-
parentId: currentPreviewNode.parentId,
|
|
101
|
-
extent: currentPreviewNode.extent,
|
|
102
86
|
selected: true,
|
|
103
87
|
data: nodeData
|
|
104
88
|
};
|
|
105
|
-
const newNodeManifest = registry?.getManifest(nodeItem.data.type
|
|
89
|
+
const newNodeManifest = registry?.getManifest(nodeItem.data.type);
|
|
106
90
|
const newEdges = [];
|
|
107
91
|
const previewEdgeIds = [];
|
|
108
92
|
for (const connectionInfoItem of previewNodeConnectionInfo){
|
|
109
93
|
const newNodeHandleType = connectionInfoItem.addNewNodeAsSource ? 'source' : 'target';
|
|
110
|
-
const newNodeDefaultHandle = newNodeManifest ? registry?.getDefaultHandle(newNodeManifest.nodeType, newNodeHandleType
|
|
94
|
+
const newNodeDefaultHandle = newNodeManifest ? registry?.getDefaultHandle(newNodeManifest.nodeType, newNodeHandleType) : void 0;
|
|
111
95
|
const newNodeHandleId = newNodeDefaultHandle?.id;
|
|
112
96
|
const edgeSourceTargetData = connectionInfoItem.addNewNodeAsSource ? {
|
|
113
97
|
source: newNode.id,
|
|
@@ -124,12 +108,7 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
|
|
|
124
108
|
newEdges.push({
|
|
125
109
|
id: newEdgeId,
|
|
126
110
|
...edgeSourceTargetData,
|
|
127
|
-
type: 'default'
|
|
128
|
-
...currentPreviewNode.parentId ? {
|
|
129
|
-
data: {
|
|
130
|
-
parentId: currentPreviewNode.parentId
|
|
131
|
-
}
|
|
132
|
-
} : {}
|
|
111
|
+
type: 'default'
|
|
133
112
|
});
|
|
134
113
|
previewEdgeIds.push(connectionInfoItem.previewEdgeId);
|
|
135
114
|
}
|
|
@@ -145,7 +124,9 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
|
|
|
145
124
|
})),
|
|
146
125
|
finalNode
|
|
147
126
|
];
|
|
148
|
-
return
|
|
127
|
+
return (0, external_utils_index_cjs_namespaceObject.resolveCollisions)(newNodes, {
|
|
128
|
+
ignoredNodeTypes
|
|
129
|
+
});
|
|
149
130
|
});
|
|
150
131
|
reactFlowInstance.setEdges((edges)=>[
|
|
151
132
|
...edges.filter((e)=>!previewEdgeIds.includes(e.id)),
|
|
@@ -153,7 +134,7 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
|
|
|
153
134
|
]);
|
|
154
135
|
const [firstConnection] = previewNodeConnectionInfo;
|
|
155
136
|
if (firstConnection) {
|
|
156
|
-
const firstEdgeSourceHandle = firstConnection.addNewNodeAsSource ? newNodeManifest && registry?.getDefaultHandle(newNodeManifest.nodeType, 'source'
|
|
137
|
+
const firstEdgeSourceHandle = firstConnection.addNewNodeAsSource ? newNodeManifest && registry?.getDefaultHandle(newNodeManifest.nodeType, 'source')?.id : firstConnection.existingHandleId;
|
|
157
138
|
const firstEdgeData = firstConnection.addNewNodeAsSource ? {
|
|
158
139
|
source: finalNode.id,
|
|
159
140
|
sourceHandle: firstEdgeSourceHandle ?? 'output'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddNodeManager.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/AddNodePanel/AddNodeManager.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAE3E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,MAAM,WAAW,mBAAmB;IAKlC,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC;IAI7E,YAAY,CAAC,EAAE,OAAO,CAAC;IAIvB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,CAAC,E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OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAK7F,cAAc,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,KAAK,YAAY,CAAC;IAOtE,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK;QAAE,OAAO,EAAE,IAAI,CAAC;QAAC,QAAQ,EAAE,IAAI,EAAE,CAAA;KAAE,CAAC;IAK7F,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,KAAK,IAAI,CAAC;IAMpF,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AASD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqMxD,CAAC"}
|
|
@@ -7,20 +7,6 @@ import { usePreviewNode } from "../../hooks/usePreviewNode.js";
|
|
|
7
7
|
import { resolveCollisions } from "../../utils/index.js";
|
|
8
8
|
import { FloatingCanvasPanel } from "../FloatingCanvasPanel/index.js";
|
|
9
9
|
import { AddNodePanel } from "./AddNodePanel.js";
|
|
10
|
-
function resolveNodePlacement(nodes, insertedNode, ignoredNodeTypes) {
|
|
11
|
-
if (!insertedNode.parentId) return resolveCollisions(nodes, {
|
|
12
|
-
ignoredNodeTypes
|
|
13
|
-
});
|
|
14
|
-
const siblingNodes = nodes.filter((node)=>node.parentId === insertedNode.parentId);
|
|
15
|
-
const resolvedSiblings = resolveCollisions(siblingNodes, {
|
|
16
|
-
ignoredNodeTypes
|
|
17
|
-
});
|
|
18
|
-
const resolvedSiblingsById = new Map(resolvedSiblings.map((node)=>[
|
|
19
|
-
node.id,
|
|
20
|
-
node
|
|
21
|
-
]));
|
|
22
|
-
return nodes.map((node)=>resolvedSiblingsById.get(node.id) ?? node);
|
|
23
|
-
}
|
|
24
10
|
const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData, onBeforeNodeAdded, onNodeAdded, ignoredNodeTypes })=>{
|
|
25
11
|
const reactFlowInstance = useReactFlow();
|
|
26
12
|
const registry = useOptionalNodeTypeRegistry();
|
|
@@ -69,17 +55,15 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
|
|
|
69
55
|
id: newNodeId,
|
|
70
56
|
type: nodeItem.data.type,
|
|
71
57
|
position: currentPreviewNode.position,
|
|
72
|
-
parentId: currentPreviewNode.parentId,
|
|
73
|
-
extent: currentPreviewNode.extent,
|
|
74
58
|
selected: true,
|
|
75
59
|
data: nodeData
|
|
76
60
|
};
|
|
77
|
-
const newNodeManifest = registry?.getManifest(nodeItem.data.type
|
|
61
|
+
const newNodeManifest = registry?.getManifest(nodeItem.data.type);
|
|
78
62
|
const newEdges = [];
|
|
79
63
|
const previewEdgeIds = [];
|
|
80
64
|
for (const connectionInfoItem of previewNodeConnectionInfo){
|
|
81
65
|
const newNodeHandleType = connectionInfoItem.addNewNodeAsSource ? 'source' : 'target';
|
|
82
|
-
const newNodeDefaultHandle = newNodeManifest ? registry?.getDefaultHandle(newNodeManifest.nodeType, newNodeHandleType
|
|
66
|
+
const newNodeDefaultHandle = newNodeManifest ? registry?.getDefaultHandle(newNodeManifest.nodeType, newNodeHandleType) : void 0;
|
|
83
67
|
const newNodeHandleId = newNodeDefaultHandle?.id;
|
|
84
68
|
const edgeSourceTargetData = connectionInfoItem.addNewNodeAsSource ? {
|
|
85
69
|
source: newNode.id,
|
|
@@ -96,12 +80,7 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
|
|
|
96
80
|
newEdges.push({
|
|
97
81
|
id: newEdgeId,
|
|
98
82
|
...edgeSourceTargetData,
|
|
99
|
-
type: 'default'
|
|
100
|
-
...currentPreviewNode.parentId ? {
|
|
101
|
-
data: {
|
|
102
|
-
parentId: currentPreviewNode.parentId
|
|
103
|
-
}
|
|
104
|
-
} : {}
|
|
83
|
+
type: 'default'
|
|
105
84
|
});
|
|
106
85
|
previewEdgeIds.push(connectionInfoItem.previewEdgeId);
|
|
107
86
|
}
|
|
@@ -117,7 +96,9 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
|
|
|
117
96
|
})),
|
|
118
97
|
finalNode
|
|
119
98
|
];
|
|
120
|
-
return
|
|
99
|
+
return resolveCollisions(newNodes, {
|
|
100
|
+
ignoredNodeTypes
|
|
101
|
+
});
|
|
121
102
|
});
|
|
122
103
|
reactFlowInstance.setEdges((edges)=>[
|
|
123
104
|
...edges.filter((e)=>!previewEdgeIds.includes(e.id)),
|
|
@@ -125,7 +106,7 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
|
|
|
125
106
|
]);
|
|
126
107
|
const [firstConnection] = previewNodeConnectionInfo;
|
|
127
108
|
if (firstConnection) {
|
|
128
|
-
const firstEdgeSourceHandle = firstConnection.addNewNodeAsSource ? newNodeManifest && registry?.getDefaultHandle(newNodeManifest.nodeType, 'source'
|
|
109
|
+
const firstEdgeSourceHandle = firstConnection.addNewNodeAsSource ? newNodeManifest && registry?.getDefaultHandle(newNodeManifest.nodeType, 'source')?.id : firstConnection.existingHandleId;
|
|
129
110
|
const firstEdgeData = firstConnection.addNewNodeAsSource ? {
|
|
130
111
|
source: finalNode.id,
|
|
131
112
|
sourceHandle: firstEdgeSourceHandle ?? 'output'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
createAddNodePreview: ()=>createAddNodePreview
|
|
28
|
+
});
|
|
29
|
+
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
30
|
+
const createPreviewNode_cjs_namespaceObject = require("../../utils/createPreviewNode.cjs");
|
|
31
|
+
function createAddNodePreview(sourceNodeId, sourceHandleId, reactFlowInstance, handlePosition = react_cjs_namespaceObject.Position.Right, sourceHandleType = 'source', ignoredNodeTypes = []) {
|
|
32
|
+
const preview = (0, createPreviewNode_cjs_namespaceObject.createPreviewNode)(sourceNodeId, sourceHandleId, reactFlowInstance, void 0, void 0, sourceHandleType, void 0, handlePosition, ignoredNodeTypes);
|
|
33
|
+
if (preview) (0, createPreviewNode_cjs_namespaceObject.applyPreviewToReactFlow)(preview, reactFlowInstance);
|
|
34
|
+
}
|
|
35
|
+
exports.createAddNodePreview = __webpack_exports__.createAddNodePreview;
|
|
36
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
37
|
+
"createAddNodePreview"
|
|
38
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
39
|
+
Object.defineProperty(exports, '__esModule', {
|
|
40
|
+
value: true
|
|
41
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Position, type ReactFlowInstance } from '../../xyflow/react.ts';
|
|
2
|
+
export declare function createAddNodePreview(sourceNodeId: string, sourceHandleId: string, reactFlowInstance: ReactFlowInstance, handlePosition?: Position, sourceHandleType?: 'source' | 'target', ignoredNodeTypes?: string[]): void;
|
|
3
|
+
//# sourceMappingURL=createAddNodePreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAddNodePreview.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/AddNodePanel/createAddNodePreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAa5F,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,EACtB,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,GAAE,QAAyB,EACzC,gBAAgB,GAAE,QAAQ,GAAG,QAAmB,EAChD,gBAAgB,GAAE,MAAM,EAAO,GAC9B,IAAI,CAiBN"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Position } from "../../xyflow/react.js";
|
|
2
|
+
import { applyPreviewToReactFlow, createPreviewNode } from "../../utils/createPreviewNode.js";
|
|
3
|
+
function createAddNodePreview(sourceNodeId, sourceHandleId, reactFlowInstance, handlePosition = Position.Right, sourceHandleType = 'source', ignoredNodeTypes = []) {
|
|
4
|
+
const preview = createPreviewNode(sourceNodeId, sourceHandleId, reactFlowInstance, void 0, void 0, sourceHandleType, void 0, handlePosition, ignoredNodeTypes);
|
|
5
|
+
if (preview) applyPreviewToReactFlow(preview, reactFlowInstance);
|
|
6
|
+
}
|
|
7
|
+
export { createAddNodePreview };
|
|
@@ -24,20 +24,24 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
AddNodePanel: ()=>external_AddNodePanel_cjs_namespaceObject.AddNodePanel,
|
|
27
28
|
AddNodeManager: ()=>external_AddNodeManager_cjs_namespaceObject.AddNodeManager,
|
|
28
29
|
AddNodePreview: ()=>external_AddNodePreview_cjs_namespaceObject.AddNodePreview,
|
|
29
|
-
|
|
30
|
+
createAddNodePreview: ()=>external_createAddNodePreview_cjs_namespaceObject.createAddNodePreview
|
|
30
31
|
});
|
|
31
32
|
const external_AddNodeManager_cjs_namespaceObject = require("./AddNodeManager.cjs");
|
|
32
33
|
const external_AddNodePanel_cjs_namespaceObject = require("./AddNodePanel.cjs");
|
|
33
34
|
const external_AddNodePreview_cjs_namespaceObject = require("./AddNodePreview.cjs");
|
|
35
|
+
const external_createAddNodePreview_cjs_namespaceObject = require("./createAddNodePreview.cjs");
|
|
34
36
|
exports.AddNodeManager = __webpack_exports__.AddNodeManager;
|
|
35
37
|
exports.AddNodePanel = __webpack_exports__.AddNodePanel;
|
|
36
38
|
exports.AddNodePreview = __webpack_exports__.AddNodePreview;
|
|
39
|
+
exports.createAddNodePreview = __webpack_exports__.createAddNodePreview;
|
|
37
40
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
38
41
|
"AddNodeManager",
|
|
39
42
|
"AddNodePanel",
|
|
40
|
-
"AddNodePreview"
|
|
43
|
+
"AddNodePreview",
|
|
44
|
+
"createAddNodePreview"
|
|
41
45
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
42
46
|
Object.defineProperty(exports, '__esModule', {
|
|
43
47
|
value: true
|
|
@@ -3,4 +3,5 @@ export { AddNodeManager } from './AddNodeManager';
|
|
|
3
3
|
export { AddNodePanel } from './AddNodePanel';
|
|
4
4
|
export type { AddNodePanelProps, NodeItemData } from './AddNodePanel.types';
|
|
5
5
|
export { AddNodePreview, type AddNodePreviewData } from './AddNodePreview';
|
|
6
|
+
export { createAddNodePreview } from './createAddNodePreview';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/AddNodePanel/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/AddNodePanel/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AddNodeManager } from "./AddNodeManager.js";
|
|
2
2
|
import { AddNodePanel } from "./AddNodePanel.js";
|
|
3
3
|
import { AddNodePreview } from "./AddNodePreview.js";
|
|
4
|
-
|
|
4
|
+
import { createAddNodePreview } from "./createAddNodePreview.js";
|
|
5
|
+
export { AddNodeManager, AddNodePanel, AddNodePreview, createAddNodePreview };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-flow.manifest.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/AgentCanvas/agent-flow.manifest.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa7B,CAAC"}
|
|
@@ -24,7 +24,6 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
selectIsConnecting: ()=>selectIsConnecting,
|
|
28
27
|
BaseNode: ()=>BaseNode
|
|
29
28
|
});
|
|
30
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
@@ -71,7 +70,6 @@ const getContainerHeight = (height, hasFooter, footerVariant)=>{
|
|
|
71
70
|
};
|
|
72
71
|
const BaseNodeComponent = (props)=>{
|
|
73
72
|
const { type, data, selected, id, dragging, width, height } = props;
|
|
74
|
-
const nodeVersion = 'string' == typeof data?.version ? data.version : void 0;
|
|
75
73
|
const { onHandleAction: onHandleActionProp, shouldShowAddButtonFn: shouldShowAddButtonFnProp, shouldShowButtonHandleNotchesFn: shouldShowButtonHandleNotchesFnProp, toolbarConfig: toolbarConfigProp, handleConfigurations: handleConfigurationsProp, adornments: adornmentsProp, suggestionType, disabled, executionStatusOverride, labelTooltip, labelBackgroundColor, footerVariant, footerComponent, subLabelComponent, iconComponent } = (0, external_BaseNodeConfigContext_cjs_namespaceObject.useBaseNodeOverrideConfig)();
|
|
76
74
|
const updateNodeInternals = (0, react_cjs_namespaceObject.useUpdateNodeInternals)();
|
|
77
75
|
const { updateNodeData, updateNode } = (0, react_cjs_namespaceObject.useReactFlow)();
|
|
@@ -89,10 +87,9 @@ const BaseNodeComponent = (props)=>{
|
|
|
89
87
|
const isConnecting = (0, react_cjs_namespaceObject.useStore)(selectIsConnecting);
|
|
90
88
|
const { multipleNodesSelected } = (0, SelectionStateContext_cjs_namespaceObject.useSelectionState)();
|
|
91
89
|
const { isDarkMode } = (0, CanvasThemeContext_cjs_namespaceObject.useCanvasTheme)();
|
|
92
|
-
const manifest = (0, external_react_namespaceObject.useMemo)(()=>nodeTypeRegistry.getManifest(type
|
|
90
|
+
const manifest = (0, external_react_namespaceObject.useMemo)(()=>nodeTypeRegistry.getManifest(type), [
|
|
93
91
|
type,
|
|
94
|
-
nodeTypeRegistry
|
|
95
|
-
nodeVersion
|
|
92
|
+
nodeTypeRegistry
|
|
96
93
|
]);
|
|
97
94
|
const statusContext = (0, external_react_namespaceObject.useMemo)(()=>({
|
|
98
95
|
nodeId: id,
|
|
@@ -478,10 +475,8 @@ const BaseNodeComponent = (props)=>{
|
|
|
478
475
|
};
|
|
479
476
|
const BaseNode = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(BaseNodeComponent);
|
|
480
477
|
exports.BaseNode = __webpack_exports__.BaseNode;
|
|
481
|
-
exports.selectIsConnecting = __webpack_exports__.selectIsConnecting;
|
|
482
478
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
483
|
-
"BaseNode"
|
|
484
|
-
"selectIsConnecting"
|
|
479
|
+
"BaseNode"
|
|
485
480
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
486
481
|
Object.defineProperty(exports, '__esModule', {
|
|
487
482
|
value: true
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Node, NodeProps
|
|
1
|
+
import type { Node, NodeProps } from '../../xyflow/react.ts';
|
|
2
2
|
import type { BaseNodeData } from './BaseNode.types';
|
|
3
|
-
export declare const selectIsConnecting: (state: ReactFlowState) => boolean;
|
|
4
3
|
export declare const BaseNode: import("react").MemoExoticComponent<(props: NodeProps<Node<BaseNodeData>>) => import("react/jsx-runtime").JSX.Element>;
|
|
5
4
|
//# sourceMappingURL=BaseNode.d.ts.map
|
|
@@ -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,
|
|
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;AAknB1B,eAAO,MAAM,QAAQ,8CArkBa,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,6CAqkBhB,CAAC"}
|
|
@@ -42,7 +42,6 @@ const getContainerHeight = (height, hasFooter, footerVariant)=>{
|
|
|
42
42
|
};
|
|
43
43
|
const BaseNodeComponent = (props)=>{
|
|
44
44
|
const { type, data, selected, id, dragging, width, height } = props;
|
|
45
|
-
const nodeVersion = 'string' == typeof data?.version ? data.version : void 0;
|
|
46
45
|
const { onHandleAction: onHandleActionProp, shouldShowAddButtonFn: shouldShowAddButtonFnProp, shouldShowButtonHandleNotchesFn: shouldShowButtonHandleNotchesFnProp, toolbarConfig: toolbarConfigProp, handleConfigurations: handleConfigurationsProp, adornments: adornmentsProp, suggestionType, disabled, executionStatusOverride, labelTooltip, labelBackgroundColor, footerVariant, footerComponent, subLabelComponent, iconComponent } = useBaseNodeOverrideConfig();
|
|
47
46
|
const updateNodeInternals = useUpdateNodeInternals();
|
|
48
47
|
const { updateNodeData, updateNode } = useReactFlow();
|
|
@@ -60,10 +59,9 @@ const BaseNodeComponent = (props)=>{
|
|
|
60
59
|
const isConnecting = useStore(selectIsConnecting);
|
|
61
60
|
const { multipleNodesSelected } = useSelectionState();
|
|
62
61
|
const { isDarkMode } = useCanvasTheme();
|
|
63
|
-
const manifest = useMemo(()=>nodeTypeRegistry.getManifest(type
|
|
62
|
+
const manifest = useMemo(()=>nodeTypeRegistry.getManifest(type), [
|
|
64
63
|
type,
|
|
65
|
-
nodeTypeRegistry
|
|
66
|
-
nodeVersion
|
|
64
|
+
nodeTypeRegistry
|
|
67
65
|
]);
|
|
68
66
|
const statusContext = useMemo(()=>({
|
|
69
67
|
nodeId: id,
|
|
@@ -448,4 +446,4 @@ const BaseNodeComponent = (props)=>{
|
|
|
448
446
|
return nodeContent;
|
|
449
447
|
};
|
|
450
448
|
const BaseNode = /*#__PURE__*/ memo(BaseNodeComponent);
|
|
451
|
-
export { BaseNode
|
|
449
|
+
export { BaseNode };
|
|
@@ -28,7 +28,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
ButtonHandle: ()=>ButtonHandle
|
|
29
29
|
});
|
|
30
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
-
const index_cjs_namespaceObject = require("../../layouts/index.cjs");
|
|
32
31
|
const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
|
|
33
32
|
const external_react_namespaceObject = require("react");
|
|
34
33
|
const CanvasEventBus_cjs_namespaceObject = require("../../utils/CanvasEventBus.cjs");
|
|
@@ -38,7 +37,7 @@ const external_HandleButton_cjs_namespaceObject = require("./HandleButton.cjs");
|
|
|
38
37
|
const external_HandleLabel_cjs_namespaceObject = require("./HandleLabel.cjs");
|
|
39
38
|
const external_HandleNotch_cjs_namespaceObject = require("./HandleNotch.cjs");
|
|
40
39
|
const external_useButtonHandleSizeAndPosition_cjs_namespaceObject = require("./useButtonHandleSizeAndPosition.cjs");
|
|
41
|
-
const ButtonHandleBase = ({ id, nodeId, type, position,
|
|
40
|
+
const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor = 'var(--canvas-background-secondary)', visible = true, showButton = true, selected = false, index = 0, total = 1, onAction, showNotches = true, customPositionAndOffsets, nodeWidth, nodeHeight })=>{
|
|
42
41
|
const handleRef = (0, external_react_namespaceObject.useRef)(null);
|
|
43
42
|
const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
|
|
44
43
|
const isVertical = position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
|
|
@@ -63,7 +62,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
63
62
|
handleId: id,
|
|
64
63
|
nodeId,
|
|
65
64
|
handleType,
|
|
66
|
-
position
|
|
65
|
+
position,
|
|
67
66
|
originalEvent: event
|
|
68
67
|
};
|
|
69
68
|
onAction?.(actionEvent);
|
|
@@ -71,13 +70,13 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
71
70
|
handleId: id,
|
|
72
71
|
nodeId,
|
|
73
72
|
handleType,
|
|
74
|
-
position
|
|
73
|
+
position
|
|
75
74
|
});
|
|
76
75
|
}, [
|
|
77
|
-
connectionPosition,
|
|
78
76
|
id,
|
|
79
77
|
nodeId,
|
|
80
78
|
handleType,
|
|
79
|
+
position,
|
|
81
80
|
onAction
|
|
82
81
|
]);
|
|
83
82
|
const markAsHovered = (0, external_react_namespaceObject.useCallback)(()=>setIsHovered(true), []);
|
|
@@ -88,91 +87,52 @@ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = pos
|
|
|
88
87
|
numHandles: total,
|
|
89
88
|
customPositionAndOffsets
|
|
90
89
|
});
|
|
91
|
-
|
|
92
|
-
const { inwardLabelRef, rootWidth, rootHeight, rootTransform } = useInwardLabelLayout({
|
|
93
|
-
hasInwardLabel,
|
|
94
|
-
isVertical,
|
|
95
|
-
position,
|
|
96
|
-
handleType,
|
|
97
|
-
handleWidth,
|
|
98
|
-
handleHeight,
|
|
99
|
-
transform
|
|
100
|
-
});
|
|
101
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_cjs_namespaceObject.Handle, {
|
|
90
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(react_cjs_namespaceObject.Handle, {
|
|
102
91
|
ref: handleRef,
|
|
103
92
|
type: type,
|
|
104
|
-
position:
|
|
93
|
+
position: position,
|
|
105
94
|
id: id,
|
|
106
95
|
onMouseEnter: markAsHovered,
|
|
107
96
|
onMouseLeave: unmarkAsHovered,
|
|
108
97
|
onMouseDown: unmarkAsHovered,
|
|
109
98
|
className: (0, CssUtil_cjs_namespaceObject.cx)('flex! items-center! justify-center! border-0! rounded-none! bg-transparent!', visible ? 'cursor-crosshair! pointer-events-auto! opacity-100' : 'cursor-default! pointer-events-none! opacity-0'),
|
|
110
99
|
style: {
|
|
111
|
-
width:
|
|
112
|
-
height:
|
|
100
|
+
width: handleWidth,
|
|
101
|
+
height: handleHeight,
|
|
113
102
|
top,
|
|
114
103
|
bottom,
|
|
115
104
|
left,
|
|
116
105
|
right,
|
|
117
|
-
transform
|
|
106
|
+
transform
|
|
118
107
|
},
|
|
119
|
-
children:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
handleRef: handleRef
|
|
144
|
-
}) : null
|
|
145
|
-
]
|
|
146
|
-
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
147
|
-
children: [
|
|
148
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleNotch_cjs_namespaceObject.HandleNotch, {
|
|
149
|
-
handleType: handleType,
|
|
150
|
-
isVertical: isVertical,
|
|
151
|
-
selected: selected,
|
|
152
|
-
hovered: isHovered,
|
|
153
|
-
showNotch: showNotches
|
|
154
|
-
}),
|
|
155
|
-
onAction && 'source' === type && showButton ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
|
|
156
|
-
visible: showButton,
|
|
157
|
-
labelVisible: visible,
|
|
158
|
-
position: position,
|
|
159
|
-
onAction: handleButtonClick,
|
|
160
|
-
handleRef: handleRef,
|
|
161
|
-
label: label,
|
|
162
|
-
labelIcon: labelIcon,
|
|
163
|
-
labelBackgroundColor: labelBackgroundColor
|
|
164
|
-
}) : label && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleLabel_cjs_namespaceObject.HandleLabel, {
|
|
165
|
-
position: position,
|
|
166
|
-
backgroundColor: labelBackgroundColor,
|
|
167
|
-
label: label,
|
|
168
|
-
labelIcon: labelIcon
|
|
169
|
-
})
|
|
170
|
-
]
|
|
171
|
-
})
|
|
108
|
+
children: [
|
|
109
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleNotch_cjs_namespaceObject.HandleNotch, {
|
|
110
|
+
handleType: handleType,
|
|
111
|
+
isVertical: isVertical,
|
|
112
|
+
selected: selected,
|
|
113
|
+
hovered: isHovered,
|
|
114
|
+
showNotch: showNotches
|
|
115
|
+
}),
|
|
116
|
+
onAction && 'source' === type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
|
|
117
|
+
visible: showButton,
|
|
118
|
+
labelVisible: visible,
|
|
119
|
+
position: position,
|
|
120
|
+
onAction: handleButtonClick,
|
|
121
|
+
handleRef: handleRef,
|
|
122
|
+
label: label,
|
|
123
|
+
labelIcon: labelIcon,
|
|
124
|
+
labelBackgroundColor: labelBackgroundColor
|
|
125
|
+
}) : label && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleLabel_cjs_namespaceObject.HandleLabel, {
|
|
126
|
+
position: position,
|
|
127
|
+
backgroundColor: labelBackgroundColor,
|
|
128
|
+
label: label,
|
|
129
|
+
labelIcon: labelIcon
|
|
130
|
+
})
|
|
131
|
+
]
|
|
172
132
|
});
|
|
173
133
|
};
|
|
174
134
|
const ButtonHandle = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(ButtonHandleBase);
|
|
175
|
-
const ButtonHandlesBase = ({ nodeId, handles, position,
|
|
135
|
+
const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
|
|
176
136
|
const finalSelected = shouldShowAddButtonFn({
|
|
177
137
|
showAddButton,
|
|
178
138
|
selected,
|
|
@@ -191,7 +151,6 @@ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = pos
|
|
|
191
151
|
nodeId: nodeId,
|
|
192
152
|
type: handle.type,
|
|
193
153
|
position: position,
|
|
194
|
-
connectionPosition: connectionPosition,
|
|
195
154
|
handleType: handle.handleType,
|
|
196
155
|
label: handle.label,
|
|
197
156
|
labelIcon: handle.labelIcon,
|
|
@@ -211,46 +170,6 @@ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = pos
|
|
|
211
170
|
});
|
|
212
171
|
};
|
|
213
172
|
const ButtonHandles = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(ButtonHandlesBase);
|
|
214
|
-
function useInwardLabelLayout({ hasInwardLabel, isVertical, position, handleType, handleWidth, handleHeight, transform }) {
|
|
215
|
-
const inwardLabelRef = (0, external_react_namespaceObject.useRef)(null);
|
|
216
|
-
const [inwardLabelInset, setInwardLabelInset] = (0, external_react_namespaceObject.useState)(0);
|
|
217
|
-
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
218
|
-
if (!hasInwardLabel) return void setInwardLabelInset((current)=>0 === current ? current : 0);
|
|
219
|
-
const rect = inwardLabelRef.current?.getBoundingClientRect();
|
|
220
|
-
const nextInset = isVertical ? rect?.height ?? 0 : rect?.width ?? 0;
|
|
221
|
-
setInwardLabelInset((current)=>current === nextInset ? current : nextInset);
|
|
222
|
-
}, [
|
|
223
|
-
hasInwardLabel,
|
|
224
|
-
isVertical
|
|
225
|
-
]);
|
|
226
|
-
const inwardHandleSize = (0, external_ButtonHandleStyleUtils_cjs_namespaceObject.getInwardHandleSize)(handleType);
|
|
227
|
-
return {
|
|
228
|
-
inwardLabelRef,
|
|
229
|
-
rootWidth: hasInwardLabel && !isVertical ? inwardHandleSize : handleWidth,
|
|
230
|
-
rootHeight: hasInwardLabel && isVertical ? inwardHandleSize : handleHeight,
|
|
231
|
-
rootTransform: hasInwardLabel ? (0, external_ButtonHandleStyleUtils_cjs_namespaceObject.getInwardHandleTransform)(position, inwardLabelInset) : transform
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
const ButtonHandle_InwardHandleLabel = /*#__PURE__*/ (0, external_react_namespaceObject.forwardRef)(function({ connectionPosition, label, labelIcon, backgroundColor }, ref) {
|
|
235
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
236
|
-
ref: ref,
|
|
237
|
-
className: (0, CssUtil_cjs_namespaceObject.cx)('pointer-events-none absolute flex h-6 items-center whitespace-nowrap rounded-full border border-border-subtle px-2.5', external_ButtonHandleStyleUtils_cjs_namespaceObject.INWARD_LABEL_POSITION[connectionPosition]),
|
|
238
|
-
style: {
|
|
239
|
-
backgroundColor
|
|
240
|
-
},
|
|
241
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_cjs_namespaceObject.Row, {
|
|
242
|
-
align: "center",
|
|
243
|
-
gap: 3,
|
|
244
|
-
children: [
|
|
245
|
-
labelIcon,
|
|
246
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
247
|
-
className: "text-xs font-medium text-foreground",
|
|
248
|
-
children: label
|
|
249
|
-
})
|
|
250
|
-
]
|
|
251
|
-
})
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
173
|
exports.ButtonHandle = __webpack_exports__.ButtonHandle;
|
|
255
174
|
exports.ButtonHandles = __webpack_exports__.ButtonHandles;
|
|
256
175
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -12,7 +12,6 @@ type ButtonHandleProps = {
|
|
|
12
12
|
nodeId: string;
|
|
13
13
|
type: 'source' | 'target';
|
|
14
14
|
position: Position;
|
|
15
|
-
connectionPosition?: Position;
|
|
16
15
|
handleType: 'artifact' | 'input' | 'output';
|
|
17
16
|
label?: string;
|
|
18
17
|
labelIcon?: React.ReactNode;
|
|
@@ -28,7 +27,7 @@ type ButtonHandleProps = {
|
|
|
28
27
|
nodeWidth?: number;
|
|
29
28
|
nodeHeight?: number;
|
|
30
29
|
};
|
|
31
|
-
export declare const ButtonHandle: import("react").MemoExoticComponent<({ id, nodeId, type, position,
|
|
30
|
+
export declare const ButtonHandle: import("react").MemoExoticComponent<({ id, nodeId, type, position, handleType, label, labelIcon, labelBackgroundColor, visible, showButton, selected, index, total, onAction, showNotches, customPositionAndOffsets, nodeWidth, nodeHeight, }: ButtonHandleProps) => import("react/jsx-runtime").JSX.Element>;
|
|
32
31
|
export interface ButtonHandleConfig {
|
|
33
32
|
id: string;
|
|
34
33
|
type: 'source' | 'target';
|
|
@@ -42,11 +41,10 @@ export interface ButtonHandleConfig {
|
|
|
42
41
|
onAction?: (event: HandleActionEvent) => void;
|
|
43
42
|
customPositionAndOffsets?: HandleConfigurationSpecificPosition;
|
|
44
43
|
}
|
|
45
|
-
export declare const ButtonHandles: import("react").MemoExoticComponent<({ nodeId, handles, position,
|
|
44
|
+
export declare const ButtonHandles: import("react").MemoExoticComponent<({ nodeId, handles, position, selected, hovered, visible, showAddButton, showNotches, customPositionAndOffsets, shouldShowAddButtonFn, nodeWidth, nodeHeight, }: {
|
|
46
45
|
nodeId: string;
|
|
47
46
|
handles: ButtonHandleConfig[];
|
|
48
47
|
position: Position;
|
|
49
|
-
connectionPosition?: Position;
|
|
50
48
|
selected?: boolean;
|
|
51
49
|
hovered?: boolean;
|
|
52
50
|
visible?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonHandle.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/ButtonHandle.tsx"],"names":[],"mappings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