@uipath/apollo-react 4.12.0 → 4.12.1-pr556.9394355

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.
Files changed (118) hide show
  1. package/dist/canvas/components/AddNodePanel/AddNodeManager.cjs +26 -7
  2. package/dist/canvas/components/AddNodePanel/AddNodeManager.d.ts.map +1 -1
  3. package/dist/canvas/components/AddNodePanel/AddNodeManager.js +26 -7
  4. package/dist/canvas/components/AddNodePanel/createAddNodePreview.cjs +2 -2
  5. package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts +8 -1
  6. package/dist/canvas/components/AddNodePanel/createAddNodePreview.d.ts.map +1 -1
  7. package/dist/canvas/components/AddNodePanel/createAddNodePreview.js +2 -2
  8. package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts +1 -0
  9. package/dist/canvas/components/AgentCanvas/agent-flow.manifest.d.ts.map +1 -1
  10. package/dist/canvas/components/BaseNode/BaseNode.cjs +8 -3
  11. package/dist/canvas/components/BaseNode/BaseNode.d.ts +2 -1
  12. package/dist/canvas/components/BaseNode/BaseNode.d.ts.map +1 -1
  13. package/dist/canvas/components/BaseNode/BaseNode.js +5 -3
  14. package/dist/canvas/components/ButtonHandle/ButtonHandle.cjs +115 -34
  15. package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts +4 -2
  16. package/dist/canvas/components/ButtonHandle/ButtonHandle.d.ts.map +1 -1
  17. package/dist/canvas/components/ButtonHandle/ButtonHandle.js +117 -36
  18. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.cjs +48 -1
  19. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts +4 -0
  20. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.d.ts.map +1 -1
  21. package/dist/canvas/components/ButtonHandle/ButtonHandleStyleUtils.js +36 -1
  22. package/dist/canvas/components/ButtonHandle/SmartHandle.cjs +1 -1
  23. package/dist/canvas/components/ButtonHandle/SmartHandle.js +1 -1
  24. package/dist/canvas/components/Edges/SequenceEdge.cjs +3 -2
  25. package/dist/canvas/components/Edges/SequenceEdge.d.ts +11 -2
  26. package/dist/canvas/components/Edges/SequenceEdge.d.ts.map +1 -1
  27. package/dist/canvas/components/Edges/SequenceEdge.js +4 -3
  28. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.cjs +20 -10
  29. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts +2 -0
  30. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.d.ts.map +1 -1
  31. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvas.js +21 -11
  32. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.cjs +5 -8
  33. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.d.ts.map +1 -1
  34. package/dist/canvas/components/HierarchicalCanvas/HierarchicalCanvasWithControls.js +5 -8
  35. package/dist/canvas/components/LoopNode/LoopCanvasNode.cjs +80 -0
  36. package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts +6 -0
  37. package/dist/canvas/components/LoopNode/LoopCanvasNode.d.ts.map +1 -0
  38. package/dist/canvas/components/LoopNode/LoopCanvasNode.js +46 -0
  39. package/dist/canvas/components/LoopNode/LoopNode.cjs +440 -0
  40. package/dist/canvas/components/LoopNode/LoopNode.constants.cjs +77 -0
  41. package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts +12 -0
  42. package/dist/canvas/components/LoopNode/LoopNode.constants.d.ts.map +1 -0
  43. package/dist/canvas/components/LoopNode/LoopNode.constants.js +13 -0
  44. package/dist/canvas/components/LoopNode/LoopNode.d.ts +5 -0
  45. package/dist/canvas/components/LoopNode/LoopNode.d.ts.map +1 -0
  46. package/dist/canvas/components/LoopNode/LoopNode.helpers.cjs +110 -0
  47. package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts +19 -0
  48. package/dist/canvas/components/LoopNode/LoopNode.helpers.d.ts.map +1 -0
  49. package/dist/canvas/components/LoopNode/LoopNode.helpers.js +70 -0
  50. package/dist/canvas/components/LoopNode/LoopNode.js +406 -0
  51. package/dist/canvas/components/LoopNode/LoopNode.types.cjs +18 -0
  52. package/dist/canvas/components/LoopNode/LoopNode.types.d.ts +16 -0
  53. package/dist/canvas/components/LoopNode/LoopNode.types.d.ts.map +1 -0
  54. package/dist/canvas/components/LoopNode/LoopNode.types.js +0 -0
  55. package/dist/canvas/components/LoopNode/LoopNodePreview.cjs +81 -0
  56. package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts +8 -0
  57. package/dist/canvas/components/LoopNode/LoopNodePreview.d.ts.map +1 -0
  58. package/dist/canvas/components/LoopNode/LoopNodePreview.js +44 -0
  59. package/dist/canvas/components/LoopNode/index.cjs +72 -0
  60. package/dist/canvas/components/LoopNode/index.d.ts +4 -0
  61. package/dist/canvas/components/LoopNode/index.d.ts.map +1 -0
  62. package/dist/canvas/components/LoopNode/index.js +3 -0
  63. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.cjs +20 -18
  64. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts +2 -1
  65. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.d.ts.map +1 -1
  66. package/dist/canvas/components/Toolbar/EdgeToolbar/useEdgeToolbarState.js +21 -19
  67. package/dist/canvas/components/Toolbox/ListView.cjs +3 -2
  68. package/dist/canvas/components/Toolbox/ListView.d.ts +1 -0
  69. package/dist/canvas/components/Toolbox/ListView.d.ts.map +1 -1
  70. package/dist/canvas/components/Toolbox/ListView.js +3 -2
  71. package/dist/canvas/components/Toolbox/Toolbox.cjs +38 -9
  72. package/dist/canvas/components/Toolbox/Toolbox.d.ts.map +1 -1
  73. package/dist/canvas/components/Toolbox/Toolbox.js +38 -9
  74. package/dist/canvas/components/index.cjs +27 -20
  75. package/dist/canvas/components/index.d.ts +1 -0
  76. package/dist/canvas/components/index.d.ts.map +1 -1
  77. package/dist/canvas/components/index.js +1 -0
  78. package/dist/canvas/core/NodeTypeRegistry.cjs +41 -23
  79. package/dist/canvas/core/NodeTypeRegistry.d.ts +8 -4
  80. package/dist/canvas/core/NodeTypeRegistry.d.ts.map +1 -1
  81. package/dist/canvas/core/NodeTypeRegistry.js +41 -23
  82. package/dist/canvas/core/useNodeTypeRegistry.cjs +4 -3
  83. package/dist/canvas/core/useNodeTypeRegistry.d.ts +1 -1
  84. package/dist/canvas/core/useNodeTypeRegistry.d.ts.map +1 -1
  85. package/dist/canvas/core/useNodeTypeRegistry.js +4 -3
  86. package/dist/canvas/hooks/useAddNodeOnConnectEnd.cjs +4 -3
  87. package/dist/canvas/hooks/useAddNodeOnConnectEnd.d.ts.map +1 -1
  88. package/dist/canvas/hooks/useAddNodeOnConnectEnd.js +4 -3
  89. package/dist/canvas/hooks/usePreviewNode.cjs +4 -2
  90. package/dist/canvas/hooks/usePreviewNode.d.ts.map +1 -1
  91. package/dist/canvas/hooks/usePreviewNode.js +4 -2
  92. package/dist/canvas/schema/node-definition/handle.cjs +10 -2
  93. package/dist/canvas/schema/node-definition/handle.d.ts +9 -0
  94. package/dist/canvas/schema/node-definition/handle.d.ts.map +1 -1
  95. package/dist/canvas/schema/node-definition/handle.js +6 -1
  96. package/dist/canvas/schema/node-definition/index.cjs +4 -1
  97. package/dist/canvas/schema/node-definition/index.d.ts +3 -3
  98. package/dist/canvas/schema/node-definition/index.d.ts.map +1 -1
  99. package/dist/canvas/schema/node-definition/index.js +2 -2
  100. package/dist/canvas/schema/node-definition/node-manifest.d.ts +4 -0
  101. package/dist/canvas/schema/node-definition/node-manifest.d.ts.map +1 -1
  102. package/dist/canvas/storybook-utils/manifests/index.d.ts +1 -0
  103. package/dist/canvas/storybook-utils/manifests/index.d.ts.map +1 -1
  104. package/dist/canvas/storybook-utils/manifests/node-definitions.d.ts.map +1 -1
  105. package/dist/canvas/styles/tailwind.canvas.css +1 -1
  106. package/dist/canvas/utils/createPreviewGraph.cjs +94 -0
  107. package/dist/canvas/utils/createPreviewGraph.d.ts +24 -0
  108. package/dist/canvas/utils/createPreviewGraph.d.ts.map +1 -0
  109. package/dist/canvas/utils/createPreviewGraph.js +51 -0
  110. package/dist/canvas/utils/createPreviewNode.cjs +29 -13
  111. package/dist/canvas/utils/createPreviewNode.d.ts +5 -1
  112. package/dist/canvas/utils/createPreviewNode.d.ts.map +1 -1
  113. package/dist/canvas/utils/createPreviewNode.js +23 -13
  114. package/dist/canvas/utils/index.cjs +33 -26
  115. package/dist/canvas/utils/index.d.ts +2 -1
  116. package/dist/canvas/utils/index.d.ts.map +1 -1
  117. package/dist/canvas/utils/index.js +2 -1
  118. package/package.json +1 -1
@@ -35,6 +35,20 @@ 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
+ }
38
52
  const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData, onBeforeNodeAdded, onNodeAdded, ignoredNodeTypes })=>{
39
53
  const reactFlowInstance = (0, react_cjs_namespaceObject.useReactFlow)();
40
54
  const registry = (0, index_cjs_namespaceObject.useOptionalNodeTypeRegistry)();
@@ -83,15 +97,17 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
83
97
  id: newNodeId,
84
98
  type: nodeItem.data.type,
85
99
  position: currentPreviewNode.position,
100
+ parentId: currentPreviewNode.parentId,
101
+ extent: currentPreviewNode.extent,
86
102
  selected: true,
87
103
  data: nodeData
88
104
  };
89
- const newNodeManifest = registry?.getManifest(nodeItem.data.type);
105
+ const newNodeManifest = registry?.getManifest(nodeItem.data.type, nodeItem.data.version);
90
106
  const newEdges = [];
91
107
  const previewEdgeIds = [];
92
108
  for (const connectionInfoItem of previewNodeConnectionInfo){
93
109
  const newNodeHandleType = connectionInfoItem.addNewNodeAsSource ? 'source' : 'target';
94
- const newNodeDefaultHandle = newNodeManifest ? registry?.getDefaultHandle(newNodeManifest.nodeType, newNodeHandleType) : void 0;
110
+ const newNodeDefaultHandle = newNodeManifest ? registry?.getDefaultHandle(newNodeManifest.nodeType, newNodeHandleType, nodeItem.data.version) : void 0;
95
111
  const newNodeHandleId = newNodeDefaultHandle?.id;
96
112
  const edgeSourceTargetData = connectionInfoItem.addNewNodeAsSource ? {
97
113
  source: newNode.id,
@@ -108,7 +124,12 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
108
124
  newEdges.push({
109
125
  id: newEdgeId,
110
126
  ...edgeSourceTargetData,
111
- type: 'default'
127
+ type: 'default',
128
+ ...currentPreviewNode.parentId ? {
129
+ data: {
130
+ parentId: currentPreviewNode.parentId
131
+ }
132
+ } : {}
112
133
  });
113
134
  previewEdgeIds.push(connectionInfoItem.previewEdgeId);
114
135
  }
@@ -124,9 +145,7 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
124
145
  })),
125
146
  finalNode
126
147
  ];
127
- return (0, external_utils_index_cjs_namespaceObject.resolveCollisions)(newNodes, {
128
- ignoredNodeTypes
129
- });
148
+ return resolveNodePlacement(newNodes, finalNode, ignoredNodeTypes);
130
149
  });
131
150
  reactFlowInstance.setEdges((edges)=>[
132
151
  ...edges.filter((e)=>!previewEdgeIds.includes(e.id)),
@@ -134,7 +153,7 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
134
153
  ]);
135
154
  const [firstConnection] = previewNodeConnectionInfo;
136
155
  if (firstConnection) {
137
- const firstEdgeSourceHandle = firstConnection.addNewNodeAsSource ? newNodeManifest && registry?.getDefaultHandle(newNodeManifest.nodeType, 'source')?.id : firstConnection.existingHandleId;
156
+ const firstEdgeSourceHandle = firstConnection.addNewNodeAsSource ? newNodeManifest && registry?.getDefaultHandle(newNodeManifest.nodeType, 'source', nodeItem.data.version)?.id : firstConnection.existingHandleId;
138
157
  const firstEdgeData = firstConnection.addNewNodeAsSource ? {
139
158
  source: finalNode.id,
140
159
  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,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,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AK,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;AAqBD,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgNxD,CAAC"}
@@ -7,6 +7,20 @@ 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
+ }
10
24
  const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData, onBeforeNodeAdded, onNodeAdded, ignoredNodeTypes })=>{
11
25
  const reactFlowInstance = useReactFlow();
12
26
  const registry = useOptionalNodeTypeRegistry();
@@ -55,15 +69,17 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
55
69
  id: newNodeId,
56
70
  type: nodeItem.data.type,
57
71
  position: currentPreviewNode.position,
72
+ parentId: currentPreviewNode.parentId,
73
+ extent: currentPreviewNode.extent,
58
74
  selected: true,
59
75
  data: nodeData
60
76
  };
61
- const newNodeManifest = registry?.getManifest(nodeItem.data.type);
77
+ const newNodeManifest = registry?.getManifest(nodeItem.data.type, nodeItem.data.version);
62
78
  const newEdges = [];
63
79
  const previewEdgeIds = [];
64
80
  for (const connectionInfoItem of previewNodeConnectionInfo){
65
81
  const newNodeHandleType = connectionInfoItem.addNewNodeAsSource ? 'source' : 'target';
66
- const newNodeDefaultHandle = newNodeManifest ? registry?.getDefaultHandle(newNodeManifest.nodeType, newNodeHandleType) : void 0;
82
+ const newNodeDefaultHandle = newNodeManifest ? registry?.getDefaultHandle(newNodeManifest.nodeType, newNodeHandleType, nodeItem.data.version) : void 0;
67
83
  const newNodeHandleId = newNodeDefaultHandle?.id;
68
84
  const edgeSourceTargetData = connectionInfoItem.addNewNodeAsSource ? {
69
85
  source: newNode.id,
@@ -80,7 +96,12 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
80
96
  newEdges.push({
81
97
  id: newEdgeId,
82
98
  ...edgeSourceTargetData,
83
- type: 'default'
99
+ type: 'default',
100
+ ...currentPreviewNode.parentId ? {
101
+ data: {
102
+ parentId: currentPreviewNode.parentId
103
+ }
104
+ } : {}
84
105
  });
85
106
  previewEdgeIds.push(connectionInfoItem.previewEdgeId);
86
107
  }
@@ -96,9 +117,7 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
96
117
  })),
97
118
  finalNode
98
119
  ];
99
- return resolveCollisions(newNodes, {
100
- ignoredNodeTypes
101
- });
120
+ return resolveNodePlacement(newNodes, finalNode, ignoredNodeTypes);
102
121
  });
103
122
  reactFlowInstance.setEdges((edges)=>[
104
123
  ...edges.filter((e)=>!previewEdgeIds.includes(e.id)),
@@ -106,7 +125,7 @@ const AddNodeManager = ({ initializing, customPanel: CustomPanel, createNodeData
106
125
  ]);
107
126
  const [firstConnection] = previewNodeConnectionInfo;
108
127
  if (firstConnection) {
109
- const firstEdgeSourceHandle = firstConnection.addNewNodeAsSource ? newNodeManifest && registry?.getDefaultHandle(newNodeManifest.nodeType, 'source')?.id : firstConnection.existingHandleId;
128
+ const firstEdgeSourceHandle = firstConnection.addNewNodeAsSource ? newNodeManifest && registry?.getDefaultHandle(newNodeManifest.nodeType, 'source', nodeItem.data.version)?.id : firstConnection.existingHandleId;
110
129
  const firstEdgeData = firstConnection.addNewNodeAsSource ? {
111
130
  source: finalNode.id,
112
131
  sourceHandle: firstEdgeSourceHandle ?? 'output'
@@ -28,8 +28,8 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  });
29
29
  const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
30
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);
31
+ function createAddNodePreview(sourceNodeId, sourceHandleId, reactFlowInstance, handlePosition = react_cjs_namespaceObject.Position.Right, sourceHandleType = 'source', ignoredNodeTypes = [], options = {}) {
32
+ const preview = (0, createPreviewNode_cjs_namespaceObject.createPreviewNode)(sourceNodeId, sourceHandleId, reactFlowInstance, options.position, options.data, sourceHandleType, void 0, handlePosition, ignoredNodeTypes);
33
33
  if (preview) (0, createPreviewNode_cjs_namespaceObject.applyPreviewToReactFlow)(preview, reactFlowInstance);
34
34
  }
35
35
  exports.createAddNodePreview = __webpack_exports__.createAddNodePreview;
@@ -1,3 +1,10 @@
1
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;
2
+ export interface CreateAddNodePreviewOptions {
3
+ position?: {
4
+ x: number;
5
+ y: number;
6
+ };
7
+ data?: Record<string, unknown>;
8
+ }
9
+ export declare function createAddNodePreview(sourceNodeId: string, sourceHandleId: string, reactFlowInstance: ReactFlowInstance, handlePosition?: Position, sourceHandleType?: 'source' | 'target', ignoredNodeTypes?: string[], options?: CreateAddNodePreviewOptions): void;
3
10
  //# sourceMappingURL=createAddNodePreview.d.ts.map
@@ -1 +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"}
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;AAG5F,MAAM,WAAW,2BAA2B;IAE1C,QAAQ,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEpC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAcD,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,EAC/B,OAAO,GAAE,2BAAgC,GACxC,IAAI,CAiBN"}
@@ -1,7 +1,7 @@
1
1
  import { Position } from "../../xyflow/react.js";
2
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);
3
+ function createAddNodePreview(sourceNodeId, sourceHandleId, reactFlowInstance, handlePosition = Position.Right, sourceHandleType = 'source', ignoredNodeTypes = [], options = {}) {
4
+ const preview = createPreviewNode(sourceNodeId, sourceHandleId, reactFlowInstance, options.position, options.data, sourceHandleType, void 0, handlePosition, ignoredNodeTypes);
5
5
  if (preview) applyPreviewToReactFlow(preview, reactFlowInstance);
6
6
  }
7
7
  export { createAddNodePreview };
@@ -77,6 +77,7 @@ export declare const agentFlowManifest: {
77
77
  } | undefined;
78
78
  isDefaultForType?: boolean | undefined;
79
79
  }[];
80
+ boundary?: "outer" | "inner" | undefined;
80
81
  customPositionAndOffsets?: {
81
82
  height?: number | undefined;
82
83
  width?: number | undefined;
@@ -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,MAAM,8BAA8B,CAAC;AAMnF,eAAO,MAAM,mBAAmB,EAAE,gBAAgB,EAmBjD,CAAC;AAMF,eAAO,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAa7B,CAAC"}
@@ -24,6 +24,7 @@ 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,
27
28
  BaseNode: ()=>BaseNode
28
29
  });
29
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
@@ -70,6 +71,7 @@ const getContainerHeight = (height, hasFooter, footerVariant)=>{
70
71
  };
71
72
  const BaseNodeComponent = (props)=>{
72
73
  const { type, data, selected, id, dragging, width, height } = props;
74
+ const nodeVersion = 'string' == typeof data?.version ? data.version : void 0;
73
75
  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)();
74
76
  const updateNodeInternals = (0, react_cjs_namespaceObject.useUpdateNodeInternals)();
75
77
  const { updateNodeData, updateNode } = (0, react_cjs_namespaceObject.useReactFlow)();
@@ -87,9 +89,10 @@ const BaseNodeComponent = (props)=>{
87
89
  const isConnecting = (0, react_cjs_namespaceObject.useStore)(selectIsConnecting);
88
90
  const { multipleNodesSelected } = (0, SelectionStateContext_cjs_namespaceObject.useSelectionState)();
89
91
  const { isDarkMode } = (0, CanvasThemeContext_cjs_namespaceObject.useCanvasTheme)();
90
- const manifest = (0, external_react_namespaceObject.useMemo)(()=>nodeTypeRegistry.getManifest(type), [
92
+ const manifest = (0, external_react_namespaceObject.useMemo)(()=>nodeTypeRegistry.getManifest(type, nodeVersion), [
91
93
  type,
92
- nodeTypeRegistry
94
+ nodeTypeRegistry,
95
+ nodeVersion
93
96
  ]);
94
97
  const statusContext = (0, external_react_namespaceObject.useMemo)(()=>({
95
98
  nodeId: id,
@@ -473,8 +476,10 @@ const BaseNodeComponent = (props)=>{
473
476
  };
474
477
  const BaseNode = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(BaseNodeComponent);
475
478
  exports.BaseNode = __webpack_exports__.BaseNode;
479
+ exports.selectIsConnecting = __webpack_exports__.selectIsConnecting;
476
480
  for(var __rspack_i in __webpack_exports__)if (-1 === [
477
- "BaseNode"
481
+ "BaseNode",
482
+ "selectIsConnecting"
478
483
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
479
484
  Object.defineProperty(exports, '__esModule', {
480
485
  value: true
@@ -1,4 +1,5 @@
1
- import type { Node, NodeProps } from '../../xyflow/react.ts';
1
+ import type { Node, NodeProps, ReactFlowState } from '../../xyflow/react.ts';
2
2
  import type { BaseNodeData } from './BaseNode.types';
3
+ export declare const selectIsConnecting: (state: ReactFlowState) => boolean;
3
4
  export declare const BaseNode: import("react").MemoExoticComponent<(props: NodeProps<Node<BaseNodeData>>) => import("react/jsx-runtime").JSX.Element>;
4
5
  //# 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,EAAkB,MAAM,0CAA0C,CAAC;AAsChG,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,CAAC;AA6mB1B,eAAO,MAAM,QAAQ,8CAhkBa,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,6CAgkBhB,CAAC"}
1
+ {"version":3,"file":"BaseNode.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/BaseNode/BaseNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAsChG,OAAO,KAAK,EACV,YAAY,EAIb,MAAM,kBAAkB,CAAC;AAa1B,eAAO,MAAM,kBAAkB,GAAI,OAAO,cAAc,YAAkC,CAAC;AAomB3F,eAAO,MAAM,QAAQ,8CApkBa,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,6CAokBhB,CAAC"}
@@ -42,6 +42,7 @@ 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;
45
46
  const { onHandleAction: onHandleActionProp, shouldShowAddButtonFn: shouldShowAddButtonFnProp, shouldShowButtonHandleNotchesFn: shouldShowButtonHandleNotchesFnProp, toolbarConfig: toolbarConfigProp, handleConfigurations: handleConfigurationsProp, adornments: adornmentsProp, suggestionType, disabled, executionStatusOverride, labelTooltip, labelBackgroundColor, footerVariant, footerComponent, subLabelComponent, iconComponent } = useBaseNodeOverrideConfig();
46
47
  const updateNodeInternals = useUpdateNodeInternals();
47
48
  const { updateNodeData, updateNode } = useReactFlow();
@@ -59,9 +60,10 @@ const BaseNodeComponent = (props)=>{
59
60
  const isConnecting = useStore(selectIsConnecting);
60
61
  const { multipleNodesSelected } = useSelectionState();
61
62
  const { isDarkMode } = useCanvasTheme();
62
- const manifest = useMemo(()=>nodeTypeRegistry.getManifest(type), [
63
+ const manifest = useMemo(()=>nodeTypeRegistry.getManifest(type, nodeVersion), [
63
64
  type,
64
- nodeTypeRegistry
65
+ nodeTypeRegistry,
66
+ nodeVersion
65
67
  ]);
66
68
  const statusContext = useMemo(()=>({
67
69
  nodeId: id,
@@ -444,4 +446,4 @@ const BaseNodeComponent = (props)=>{
444
446
  return nodeContent;
445
447
  };
446
448
  const BaseNode = /*#__PURE__*/ memo(BaseNodeComponent);
447
- export { BaseNode };
449
+ export { BaseNode, selectIsConnecting };
@@ -28,6 +28,7 @@ __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");
31
32
  const react_cjs_namespaceObject = require("../../xyflow/react.cjs");
32
33
  const external_react_namespaceObject = require("react");
33
34
  const CanvasEventBus_cjs_namespaceObject = require("../../utils/CanvasEventBus.cjs");
@@ -37,7 +38,7 @@ const external_HandleButton_cjs_namespaceObject = require("./HandleButton.cjs");
37
38
  const external_HandleLabel_cjs_namespaceObject = require("./HandleLabel.cjs");
38
39
  const external_HandleNotch_cjs_namespaceObject = require("./HandleNotch.cjs");
39
40
  const external_useButtonHandleSizeAndPosition_cjs_namespaceObject = require("./useButtonHandleSizeAndPosition.cjs");
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 })=>{
41
+ const ButtonHandleBase = ({ id, nodeId, type, position, connectionPosition = 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 })=>{
41
42
  const handleRef = (0, external_react_namespaceObject.useRef)(null);
42
43
  const [isHovered, setIsHovered] = (0, external_react_namespaceObject.useState)(false);
43
44
  const isVertical = position === react_cjs_namespaceObject.Position.Top || position === react_cjs_namespaceObject.Position.Bottom;
@@ -62,7 +63,7 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
62
63
  handleId: id,
63
64
  nodeId,
64
65
  handleType,
65
- position,
66
+ position: connectionPosition,
66
67
  originalEvent: event
67
68
  };
68
69
  onAction?.(actionEvent);
@@ -70,13 +71,13 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
70
71
  handleId: id,
71
72
  nodeId,
72
73
  handleType,
73
- position
74
+ position: connectionPosition
74
75
  });
75
76
  }, [
77
+ connectionPosition,
76
78
  id,
77
79
  nodeId,
78
80
  handleType,
79
- position,
80
81
  onAction
81
82
  ]);
82
83
  const markAsHovered = (0, external_react_namespaceObject.useCallback)(()=>setIsHovered(true), []);
@@ -87,52 +88,91 @@ const ButtonHandleBase = ({ id, nodeId, type, position, handleType, label, label
87
88
  numHandles: total,
88
89
  customPositionAndOffsets
89
90
  });
90
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(react_cjs_namespaceObject.Handle, {
91
+ const hasInwardLabel = Boolean(label && connectionPosition !== position);
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, {
91
102
  ref: handleRef,
92
103
  type: type,
93
- position: position,
104
+ position: connectionPosition,
94
105
  id: id,
95
106
  onMouseEnter: markAsHovered,
96
107
  onMouseLeave: unmarkAsHovered,
97
108
  onMouseDown: unmarkAsHovered,
98
109
  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'),
99
110
  style: {
100
- width: handleWidth,
101
- height: handleHeight,
111
+ width: rootWidth,
112
+ height: rootHeight,
102
113
  top,
103
114
  bottom,
104
115
  left,
105
116
  right,
106
- transform
117
+ transform: rootTransform
107
118
  },
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
- ]
119
+ children: hasInwardLabel ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
120
+ children: [
121
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
122
+ className: (0, CssUtil_cjs_namespaceObject.cx)('flex h-full w-full items-center', (0, external_ButtonHandleStyleUtils_cjs_namespaceObject.getInwardNotchLayout)(position)),
123
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleNotch_cjs_namespaceObject.HandleNotch, {
124
+ handleType: handleType,
125
+ isVertical: isVertical,
126
+ selected: selected,
127
+ hovered: isHovered,
128
+ showNotch: showNotches
129
+ })
130
+ }),
131
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ButtonHandle_InwardHandleLabel, {
132
+ ref: inwardLabelRef,
133
+ connectionPosition: connectionPosition,
134
+ label: label,
135
+ labelIcon: labelIcon,
136
+ backgroundColor: labelBackgroundColor
137
+ }),
138
+ onAction && 'source' === type && showButton ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_HandleButton_cjs_namespaceObject.HandleButton, {
139
+ visible: showButton,
140
+ labelVisible: visible,
141
+ position: position,
142
+ onAction: handleButtonClick,
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
+ })
132
172
  });
133
173
  };
134
174
  const ButtonHandle = /*#__PURE__*/ (0, external_react_namespaceObject.memo)(ButtonHandleBase);
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 })=>{
175
+ const ButtonHandlesBase = ({ nodeId, handles, position, connectionPosition = position, selected = false, hovered = false, visible = true, showAddButton = true, showNotches = true, customPositionAndOffsets, shouldShowAddButtonFn = ({ showAddButton, selected, hovered })=>showAddButton && (selected || hovered), nodeWidth, nodeHeight })=>{
136
176
  const finalSelected = shouldShowAddButtonFn({
137
177
  showAddButton,
138
178
  selected,
@@ -151,6 +191,7 @@ const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovere
151
191
  nodeId: nodeId,
152
192
  type: handle.type,
153
193
  position: position,
194
+ connectionPosition: connectionPosition,
154
195
  handleType: handle.handleType,
155
196
  label: handle.label,
156
197
  labelIcon: handle.labelIcon,
@@ -170,6 +211,46 @@ const ButtonHandlesBase = ({ nodeId, handles, position, selected = false, hovere
170
211
  });
171
212
  };
172
213
  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
+ });
173
254
  exports.ButtonHandle = __webpack_exports__.ButtonHandle;
174
255
  exports.ButtonHandles = __webpack_exports__.ButtonHandles;
175
256
  for(var __rspack_i in __webpack_exports__)if (-1 === [
@@ -12,6 +12,7 @@ type ButtonHandleProps = {
12
12
  nodeId: string;
13
13
  type: 'source' | 'target';
14
14
  position: Position;
15
+ connectionPosition?: Position;
15
16
  handleType: 'artifact' | 'input' | 'output';
16
17
  label?: string;
17
18
  labelIcon?: React.ReactNode;
@@ -27,7 +28,7 @@ type ButtonHandleProps = {
27
28
  nodeWidth?: number;
28
29
  nodeHeight?: number;
29
30
  };
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>;
31
+ export declare const ButtonHandle: import("react").MemoExoticComponent<({ id, nodeId, type, position, connectionPosition, handleType, label, labelIcon, labelBackgroundColor, visible, showButton, selected, index, total, onAction, showNotches, customPositionAndOffsets, nodeWidth, nodeHeight, }: ButtonHandleProps) => import("react/jsx-runtime").JSX.Element>;
31
32
  export interface ButtonHandleConfig {
32
33
  id: string;
33
34
  type: 'source' | 'target';
@@ -41,10 +42,11 @@ export interface ButtonHandleConfig {
41
42
  onAction?: (event: HandleActionEvent) => void;
42
43
  customPositionAndOffsets?: HandleConfigurationSpecificPosition;
43
44
  }
44
- export declare const ButtonHandles: import("react").MemoExoticComponent<({ nodeId, handles, position, selected, hovered, visible, showAddButton, showNotches, customPositionAndOffsets, shouldShowAddButtonFn, nodeWidth, nodeHeight, }: {
45
+ export declare const ButtonHandles: import("react").MemoExoticComponent<({ nodeId, handles, position, connectionPosition, selected, hovered, visible, showAddButton, showNotches, customPositionAndOffsets, shouldShowAddButtonFn, nodeWidth, nodeHeight, }: {
45
46
  nodeId: string;
46
47
  handles: ButtonHandleConfig[];
47
48
  position: Position;
49
+ connectionPosition?: Position;
48
50
  selected?: boolean;
49
51
  hovered?: boolean;
50
52
  visible?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonHandle.d.ts","sourceRoot":"","sources":["../../../../src/canvas/components/ButtonHandle/ButtonHandle.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,MAAM,0CAA0C,CAAC;AAE5E,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,qCAAqC,CAAC;AAS/F,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,QAAQ,EAAE,QAAQ,CAAC;IACnB,aAAa,EAAE,KAAK,CAAC,UAAU,CAAC;CACjC;AAED,KAAK,iBAAiB,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,oBAAoB,CAAC,EA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