@agentscope-ai/flow 0.0.6 → 0.0.7
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/components/base-node/index.less +6 -2
- package/dist/components/custom-inputs-control/index.less +2 -0
- package/dist/components/flow-base-edge/index.less +3 -2
- package/dist/components/flow-mini-map/index.less +2 -0
- package/dist/components/flow-panel/index.d.ts +2 -0
- package/dist/components/flow-panel/index.js +3 -1
- package/dist/components/flow-panel/index.less +1 -0
- package/dist/components/flow-tools/index.d.ts +5 -1
- package/dist/components/flow-tools/index.js +4 -2
- package/dist/components/flow-tools/index.less +1 -0
- package/dist/components/flow-tools/short-key-content.less +1 -0
- package/dist/components/node-result-panel/index.less +1 -0
- package/dist/components/output-params-tree/index.less +1 -0
- package/dist/components/script-edit-modal/index.less +1 -1
- package/dist/components/task-status/index.less +1 -0
- package/dist/components/var-input-text-area/index.less +1 -0
- package/dist/components/variable-input/index.less +1 -0
- package/dist/hooks/use-nodes-interaction.js +41 -35
- package/dist/hooks/use-nodes-output-params.js +3 -1
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
.spark-flow-node-container {
|
|
4
4
|
--angle: 0deg;
|
|
5
|
+
|
|
5
6
|
border: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
|
|
6
7
|
background: e('var(--@{ant-prefix}-color-bg-base)');
|
|
7
8
|
display: flex;
|
|
@@ -32,7 +33,7 @@
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
&.spark-flow-node-container-hovered {
|
|
35
|
-
box-shadow:
|
|
36
|
+
box-shadow: 0 2px 8px 0 rgba(38, 36, 76, 30%);
|
|
36
37
|
border-color: e('var(--@{ant-prefix}-color-primary)');
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -99,7 +100,8 @@
|
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
&:hover {
|
|
102
|
-
box-shadow:
|
|
103
|
+
box-shadow: 0 4px 36px 0 rgba(60, 52, 197, 8%);
|
|
104
|
+
|
|
103
105
|
.spark-flow-target-handle {
|
|
104
106
|
box-shadow: 0 0 0 2px rgb(105 83 245 / 15%);
|
|
105
107
|
width: 16px;
|
|
@@ -227,6 +229,7 @@
|
|
|
227
229
|
|
|
228
230
|
.spark-flow-status-icon {
|
|
229
231
|
font-size: 20px;
|
|
232
|
+
|
|
230
233
|
&-success {
|
|
231
234
|
color: e('var(--@{ant-prefix}-color-success)');
|
|
232
235
|
}
|
|
@@ -245,6 +248,7 @@
|
|
|
245
248
|
from {
|
|
246
249
|
transform: rotate(0deg);
|
|
247
250
|
}
|
|
251
|
+
|
|
248
252
|
to {
|
|
249
253
|
transform: rotate(360deg);
|
|
250
254
|
}
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
.spark-flow-animate-gradient-edge {
|
|
18
|
-
animation:
|
|
18
|
+
animation: gradient-animation 2s linear infinite;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
@keyframes
|
|
21
|
+
@keyframes gradient-animation {
|
|
22
22
|
0% {
|
|
23
23
|
transform: translateX(0);
|
|
24
24
|
}
|
|
25
|
+
|
|
25
26
|
100% {
|
|
26
27
|
transform: translateX(100%);
|
|
27
28
|
}
|
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
margin: 0 !important;
|
|
9
9
|
border-radius: 6px;
|
|
10
10
|
border: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
|
|
11
|
+
|
|
11
12
|
.react-flow__minimap-node{
|
|
12
13
|
fill: e('var(--@{ant-prefix}-color-primary-border-hover)');
|
|
13
14
|
}
|
|
15
|
+
|
|
14
16
|
> svg {
|
|
15
17
|
width: 100%;
|
|
16
18
|
height: 100%;
|
|
@@ -2,6 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import './index.less';
|
|
3
3
|
interface IFlowPanel {
|
|
4
4
|
children?: React.ReactNode[] | React.ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
5
7
|
}
|
|
6
8
|
declare const _default: React.NamedExoticComponent<IFlowPanel>;
|
|
7
9
|
export default _default;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import "./index.less";
|
|
3
|
+
import classNames from 'classnames';
|
|
3
4
|
export default /*#__PURE__*/memo(function FlowPanel(props) {
|
|
4
5
|
return /*#__PURE__*/React.createElement("div", {
|
|
5
|
-
className: "spark-flow-panel-group absolute flex gap-[16px] flex-nowrap"
|
|
6
|
+
className: classNames("spark-flow-panel-group absolute flex gap-[16px] flex-nowrap", props.className),
|
|
7
|
+
style: props.style
|
|
6
8
|
}, props.children);
|
|
7
9
|
});
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.less';
|
|
3
|
-
|
|
3
|
+
export interface IFlowToolsProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
6
|
+
}
|
|
7
|
+
declare const _default: React.NamedExoticComponent<IFlowToolsProps>;
|
|
4
8
|
export default _default;
|
|
@@ -8,10 +8,12 @@ import MiniMapBtn from "./mini-map-btn";
|
|
|
8
8
|
import ScaleBtn from "./scale-btn";
|
|
9
9
|
import ShortKeyBtn from "./short-key-btn";
|
|
10
10
|
import TouchModeBtn from "./touch-mode-btn";
|
|
11
|
-
|
|
11
|
+
import classNames from 'classnames';
|
|
12
|
+
export default /*#__PURE__*/memo(function FlowTools(props) {
|
|
12
13
|
return /*#__PURE__*/React.createElement("div", {
|
|
13
14
|
id: "spark-flow-bottom-tools-container",
|
|
14
|
-
className: "nopan absolute items-center flex left-[16px] bottom-[16px] gap-[12px]"
|
|
15
|
+
className: classNames("nopan absolute items-center flex left-[16px] bottom-[16px] gap-[12px]", props.className),
|
|
16
|
+
style: props.style
|
|
15
17
|
}, /*#__PURE__*/React.createElement("div", {
|
|
16
18
|
className: "spark-flow-tools gap-[8px] items-center flex"
|
|
17
19
|
}, /*#__PURE__*/React.createElement(MiniMapBtn, null), /*#__PURE__*/React.createElement(Divider, {
|
|
@@ -350,7 +350,7 @@ export var useNodesInteraction = function useNodesInteraction() {
|
|
|
350
350
|
}, [store]);
|
|
351
351
|
var onAddNewNodeWithSource = useCallback( /*#__PURE__*/function () {
|
|
352
352
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref5, source, target) {
|
|
353
|
-
var type, parentId, _store$getState5, nodes, setNodes, sourceNode, nodeInfo, newNodes, newNode, _tempNodes, targetNode, x, y, _newNode, _store$getState6, edges, setEdges, newEdges, tempNodes, sourceHandle;
|
|
353
|
+
var type, parentId, _store$getState5, nodes, setNodes, sourceNode, nodeInfo, newNodes, _sourceNode$width, newNode, _sourceNode$width2, _tempNodes, targetNode, x, y, _sourceNode$width3, _newNode, _store$getState6, edges, setEdges, newEdges, tempNodes, sourceHandle;
|
|
354
354
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
355
355
|
while (1) switch (_context2.prev = _context2.next) {
|
|
356
356
|
case 0:
|
|
@@ -359,10 +359,16 @@ export var useNodesInteraction = function useNodesInteraction() {
|
|
|
359
359
|
sourceNode = nodes.find(function (item) {
|
|
360
360
|
return item.id === source.id;
|
|
361
361
|
});
|
|
362
|
+
if (sourceNode) {
|
|
363
|
+
_context2.next = 5;
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
return _context2.abrupt("return");
|
|
367
|
+
case 5:
|
|
362
368
|
nodeInfo = nodeSchemaMap[type];
|
|
363
369
|
newNodes = [];
|
|
364
370
|
if (target) {
|
|
365
|
-
_context2.next =
|
|
371
|
+
_context2.next = 26;
|
|
366
372
|
break;
|
|
367
373
|
}
|
|
368
374
|
newNode = generateNewNode({
|
|
@@ -370,8 +376,8 @@ export var useNodesInteraction = function useNodesInteraction() {
|
|
|
370
376
|
parentId: parentId,
|
|
371
377
|
disableScreenToFlowPosition: true
|
|
372
378
|
}, {
|
|
373
|
-
x:
|
|
374
|
-
y:
|
|
379
|
+
x: sourceNode.position.x + ((_sourceNode$width = sourceNode.width) !== null && _sourceNode$width !== void 0 ? _sourceNode$width : 0) + NEW_NODE_PADDING.x,
|
|
380
|
+
y: sourceNode.position.y || 0
|
|
375
381
|
});
|
|
376
382
|
if (nodeInfo.isGroup) {
|
|
377
383
|
/* Iteration start and batch body nodes need to add loop start/end nodes by default; */
|
|
@@ -396,28 +402,28 @@ export var useNodesInteraction = function useNodesInteraction() {
|
|
|
396
402
|
y: 152
|
|
397
403
|
}));
|
|
398
404
|
}
|
|
399
|
-
_context2.prev =
|
|
405
|
+
_context2.prev = 10;
|
|
400
406
|
if (!nodeInfo.customAdd) {
|
|
401
|
-
_context2.next =
|
|
407
|
+
_context2.next = 15;
|
|
402
408
|
break;
|
|
403
409
|
}
|
|
404
|
-
_context2.next =
|
|
410
|
+
_context2.next = 14;
|
|
405
411
|
return onAddCustomNode(newNode);
|
|
406
|
-
case
|
|
412
|
+
case 14:
|
|
407
413
|
newNode = _context2.sent;
|
|
408
|
-
case 13:
|
|
409
|
-
_context2.next = 17;
|
|
410
|
-
break;
|
|
411
414
|
case 15:
|
|
412
|
-
_context2.
|
|
413
|
-
|
|
415
|
+
_context2.next = 19;
|
|
416
|
+
break;
|
|
414
417
|
case 17:
|
|
418
|
+
_context2.prev = 17;
|
|
419
|
+
_context2.t0 = _context2["catch"](10);
|
|
420
|
+
case 19:
|
|
415
421
|
if (newNode) {
|
|
416
|
-
_context2.next =
|
|
422
|
+
_context2.next = 21;
|
|
417
423
|
break;
|
|
418
424
|
}
|
|
419
425
|
return _context2.abrupt("return");
|
|
420
|
-
case
|
|
426
|
+
case 21:
|
|
421
427
|
newNode.selected = true;
|
|
422
428
|
addNewNodeCallback({
|
|
423
429
|
newNodes: [newNode].concat(newNodes),
|
|
@@ -429,22 +435,22 @@ export var useNodesInteraction = function useNodesInteraction() {
|
|
|
429
435
|
target: newNode.id,
|
|
430
436
|
targetHandle: newNode.id
|
|
431
437
|
});
|
|
432
|
-
_context2.next =
|
|
438
|
+
_context2.next = 56;
|
|
433
439
|
break;
|
|
434
|
-
case
|
|
440
|
+
case 26:
|
|
435
441
|
targetNode = nodes.find(function (item) {
|
|
436
442
|
return item.id === target.id;
|
|
437
443
|
});
|
|
438
444
|
if (targetNode) {
|
|
439
|
-
_context2.next =
|
|
445
|
+
_context2.next = 29;
|
|
440
446
|
break;
|
|
441
447
|
}
|
|
442
448
|
return _context2.abrupt("return");
|
|
443
|
-
case
|
|
444
|
-
x = (targetNode.position.x -
|
|
445
|
-
y = (targetNode.position.y -
|
|
446
|
-
if (x <=
|
|
447
|
-
x =
|
|
449
|
+
case 29:
|
|
450
|
+
x = (targetNode.position.x - sourceNode.position.x) / 2 + sourceNode.position.x;
|
|
451
|
+
y = (targetNode.position.y - sourceNode.position.y) / 2 + sourceNode.position.y;
|
|
452
|
+
if (x <= sourceNode.position.x + ((_sourceNode$width2 = sourceNode.width) !== null && _sourceNode$width2 !== void 0 ? _sourceNode$width2 : 0) + NEW_NODE_PADDING.x) {
|
|
453
|
+
x = sourceNode.position.x + ((_sourceNode$width3 = sourceNode.width) !== null && _sourceNode$width3 !== void 0 ? _sourceNode$width3 : 0) + NEW_NODE_PADDING.x;
|
|
448
454
|
}
|
|
449
455
|
_newNode = generateNewNode({
|
|
450
456
|
type: type,
|
|
@@ -454,22 +460,22 @@ export var useNodesInteraction = function useNodesInteraction() {
|
|
|
454
460
|
x: x,
|
|
455
461
|
y: y
|
|
456
462
|
});
|
|
457
|
-
_context2.prev =
|
|
463
|
+
_context2.prev = 33;
|
|
458
464
|
if (!nodeInfo.customAdd) {
|
|
459
|
-
_context2.next =
|
|
465
|
+
_context2.next = 38;
|
|
460
466
|
break;
|
|
461
467
|
}
|
|
462
|
-
_context2.next =
|
|
468
|
+
_context2.next = 37;
|
|
463
469
|
return onAddCustomNode(_newNode);
|
|
464
|
-
case
|
|
470
|
+
case 37:
|
|
465
471
|
_newNode = _context2.sent;
|
|
466
|
-
case 36:
|
|
467
|
-
_context2.next = 40;
|
|
468
|
-
break;
|
|
469
472
|
case 38:
|
|
470
|
-
_context2.
|
|
471
|
-
|
|
473
|
+
_context2.next = 42;
|
|
474
|
+
break;
|
|
472
475
|
case 40:
|
|
476
|
+
_context2.prev = 40;
|
|
477
|
+
_context2.t1 = _context2["catch"](33);
|
|
478
|
+
case 42:
|
|
473
479
|
if (nodeInfo.isGroup) {
|
|
474
480
|
/* Iteration start and batch body nodes need to add loop start/end nodes by default; */
|
|
475
481
|
newNodes.push(generateNewNode({
|
|
@@ -556,13 +562,13 @@ export var useNodesInteraction = function useNodesInteraction() {
|
|
|
556
562
|
setNodes(tempNodes);
|
|
557
563
|
setEdges(_toConsumableArray(newEdges));
|
|
558
564
|
handleNodeClick(_newNode);
|
|
559
|
-
case
|
|
565
|
+
case 56:
|
|
560
566
|
handleSaveFlowDraft();
|
|
561
|
-
case
|
|
567
|
+
case 57:
|
|
562
568
|
case "end":
|
|
563
569
|
return _context2.stop();
|
|
564
570
|
}
|
|
565
|
-
}, _callee2, null, [[
|
|
571
|
+
}, _callee2, null, [[10, 17], [33, 40]]);
|
|
566
572
|
}));
|
|
567
573
|
return function (_x3, _x4, _x5) {
|
|
568
574
|
return _ref6.apply(this, arguments);
|
|
@@ -168,7 +168,9 @@ export var filterVarItemsByType = function filterVarItemsByType(items, types) {
|
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
|
-
|
|
171
|
+
if (filteredItem) {
|
|
172
|
+
filtered.push(filteredItem);
|
|
173
|
+
}
|
|
172
174
|
return filtered;
|
|
173
175
|
}, []);
|
|
174
176
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentscope-ai/flow",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "A powerful and flexible flow canvas rendering engine designed for AI applications. Provides comprehensive workflow visualization and interaction capabilities for platforms like Bailian and AgentScope, enabling seamless creation and management of complex AI agent workflows with an intuitive drag-and-drop interface.",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|