@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.
@@ -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: 0px 2px 8px 0px rgba(38, 36, 76, 0.3);
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: 0px 4px 36px 0px rgba(60, 52, 197, 0.08);
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
  }
@@ -1,10 +1,12 @@
1
1
  @import '../../index.less';
2
+
2
3
  .spark-flow-variable-select {
3
4
  .@{ant-prefix}-popover-content {
4
5
  max-height: 300px;
5
6
  overflow-y: auto;
6
7
  }
7
8
  }
9
+
8
10
  .spark-flow-variable-from-select {
9
11
  .@{ant-prefix}-select-selection-item {
10
12
  height: 30px;
@@ -15,13 +15,14 @@
15
15
  }
16
16
 
17
17
  .spark-flow-animate-gradient-edge {
18
- animation: gradientAnimation 2s linear infinite;
18
+ animation: gradient-animation 2s linear infinite;
19
19
  }
20
20
 
21
- @keyframes gradientAnimation {
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
  });
@@ -58,6 +58,7 @@
58
58
  flex-direction: column;
59
59
  gap: 20px;
60
60
  padding: 20px;
61
+
61
62
  &:not(:last-of-type){
62
63
  border-bottom: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
63
64
  }
@@ -1,4 +1,8 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
- declare const _default: React.NamedExoticComponent<object>;
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
- export default /*#__PURE__*/memo(function FlowTools() {
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, {
@@ -1,4 +1,5 @@
1
1
  @import '../../index.less';
2
+
2
3
  .spark-flow-tools {
3
4
  box-shadow:
4
5
  0 12px 24px -16px rgb(54 54 73 / 4%),
@@ -1,4 +1,5 @@
1
1
  @import '../../index.less';
2
+
2
3
  .spark-flow-short-key-container {
3
4
  min-width: 224px;
4
5
 
@@ -72,6 +72,7 @@
72
72
  color: e('var(--@{ant-prefix}-color-info)');
73
73
  }
74
74
  }
75
+
75
76
  &.spark-flow-node-result-panel-skip,
76
77
  &.spark-flow-node-result-panel-wait,
77
78
  &.spark-flow-node-result-panel-stop {
@@ -1,4 +1,5 @@
1
1
  @import '../../index.less';
2
+
2
3
  .spark-flow-output-params-tree-node {
3
4
  display: flex;
4
5
  flex-direction: column;
@@ -3,7 +3,7 @@
3
3
  .spark-flow-script-edit-modal {
4
4
  margin: 8px!important;
5
5
  max-width: 100vw!important;
6
- top: 0px!important;
6
+ top: 0!important;
7
7
  .@{ant-prefix}-modal-header {
8
8
  position: relative;
9
9
 
@@ -23,6 +23,7 @@
23
23
  display: inline-flex !important;
24
24
  align-items: center;
25
25
  gap: 2px;
26
+
26
27
  > span {
27
28
  margin-inline-start: 0 !important;
28
29
  }
@@ -52,6 +52,7 @@
52
52
  .spark-flow-var-input-var-tag-icon {
53
53
  font-size: 12px !important;
54
54
  }
55
+
55
56
  .spark-flow-var-input-var-tag-key {
56
57
  color: e('var(--@{ant-prefix}-color-primary)');
57
58
  font-weight: 500;
@@ -1,4 +1,5 @@
1
1
  @import '../../index.less';
2
+
2
3
  .variable-input-container {
3
4
  display: flex;
4
5
  align-items: stretch;
@@ -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 = 24;
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: (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.position.x) + (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.width) + NEW_NODE_PADDING.x,
374
- y: (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.position.y) || 0
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 = 8;
405
+ _context2.prev = 10;
400
406
  if (!nodeInfo.customAdd) {
401
- _context2.next = 13;
407
+ _context2.next = 15;
402
408
  break;
403
409
  }
404
- _context2.next = 12;
410
+ _context2.next = 14;
405
411
  return onAddCustomNode(newNode);
406
- case 12:
412
+ case 14:
407
413
  newNode = _context2.sent;
408
- case 13:
409
- _context2.next = 17;
410
- break;
411
414
  case 15:
412
- _context2.prev = 15;
413
- _context2.t0 = _context2["catch"](8);
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 = 19;
422
+ _context2.next = 21;
417
423
  break;
418
424
  }
419
425
  return _context2.abrupt("return");
420
- case 19:
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 = 54;
438
+ _context2.next = 56;
433
439
  break;
434
- case 24:
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 = 27;
445
+ _context2.next = 29;
440
446
  break;
441
447
  }
442
448
  return _context2.abrupt("return");
443
- case 27:
444
- x = (targetNode.position.x - (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.position.x)) / 2 + (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.position.x);
445
- y = (targetNode.position.y - (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.position.y)) / 2 + (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.position.y);
446
- if (x <= (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.position.x) + (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.width) + NEW_NODE_PADDING.x) {
447
- x = (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.position.x) + (sourceNode === null || sourceNode === void 0 ? void 0 : sourceNode.width) + NEW_NODE_PADDING.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 = 31;
463
+ _context2.prev = 33;
458
464
  if (!nodeInfo.customAdd) {
459
- _context2.next = 36;
465
+ _context2.next = 38;
460
466
  break;
461
467
  }
462
- _context2.next = 35;
468
+ _context2.next = 37;
463
469
  return onAddCustomNode(_newNode);
464
- case 35:
470
+ case 37:
465
471
  _newNode = _context2.sent;
466
- case 36:
467
- _context2.next = 40;
468
- break;
469
472
  case 38:
470
- _context2.prev = 38;
471
- _context2.t1 = _context2["catch"](31);
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 54:
565
+ case 56:
560
566
  handleSaveFlowDraft();
561
- case 55:
567
+ case 57:
562
568
  case "end":
563
569
  return _context2.stop();
564
570
  }
565
- }, _callee2, null, [[8, 15], [31, 38]]);
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
- filteredItem && filtered.push(filteredItem);
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.6",
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",