@agentscope-ai/flow 0.0.1

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 (176) hide show
  1. package/README.zh-CN.md +67 -0
  2. package/dist/components/base-node/index.d.ts +27 -0
  3. package/dist/components/base-node/index.js +320 -0
  4. package/dist/components/base-node/index.less +258 -0
  5. package/dist/components/branch-title-header/index.d.ts +12 -0
  6. package/dist/components/branch-title-header/index.js +176 -0
  7. package/dist/components/branch-title-header/index.less +28 -0
  8. package/dist/components/check-list-btn/index.d.ts +4 -0
  9. package/dist/components/check-list-btn/index.js +144 -0
  10. package/dist/components/check-list-btn/index.less +113 -0
  11. package/dist/components/code-input/index.d.ts +24 -0
  12. package/dist/components/code-input/index.js +356 -0
  13. package/dist/components/code-input/index.less +87 -0
  14. package/dist/components/condition-item/index.d.ts +13 -0
  15. package/dist/components/condition-item/index.js +185 -0
  16. package/dist/components/condition-item/index.less +23 -0
  17. package/dist/components/custom-connection-line/index.d.ts +4 -0
  18. package/dist/components/custom-connection-line/index.js +28 -0
  19. package/dist/components/custom-handle/source-handle.d.ts +10 -0
  20. package/dist/components/custom-handle/source-handle.js +45 -0
  21. package/dist/components/custom-handle/target-handle.d.ts +6 -0
  22. package/dist/components/custom-handle/target-handle.js +21 -0
  23. package/dist/components/custom-inputs-control/index.d.ts +56 -0
  24. package/dist/components/custom-inputs-control/index.js +366 -0
  25. package/dist/components/custom-inputs-control/index.less +28 -0
  26. package/dist/components/custom-outputs-form/index.d.ts +24 -0
  27. package/dist/components/custom-outputs-form/index.js +346 -0
  28. package/dist/components/custom-outputs-form/index.less +51 -0
  29. package/dist/components/drag-panel/index.d.ts +10 -0
  30. package/dist/components/drag-panel/index.js +79 -0
  31. package/dist/components/drag-panel/index.less +23 -0
  32. package/dist/components/draggable-with-handle/index.d.ts +13 -0
  33. package/dist/components/draggable-with-handle/index.js +81 -0
  34. package/dist/components/draggable-with-handle/index.less +23 -0
  35. package/dist/components/flow-aside/index.d.ts +4 -0
  36. package/dist/components/flow-aside/index.js +62 -0
  37. package/dist/components/flow-aside/index.less +84 -0
  38. package/dist/components/flow-base-edge/index.d.ts +5 -0
  39. package/dist/components/flow-base-edge/index.js +226 -0
  40. package/dist/components/flow-base-edge/index.less +28 -0
  41. package/dist/components/flow-base-edge/linear-gradient-svg.d.ts +21 -0
  42. package/dist/components/flow-base-edge/linear-gradient-svg.js +32 -0
  43. package/dist/components/flow-icon/index.d.ts +9 -0
  44. package/dist/components/flow-icon/index.js +30 -0
  45. package/dist/components/flow-icon/index.less +20 -0
  46. package/dist/components/flow-mini-map/index.d.ts +4 -0
  47. package/dist/components/flow-mini-map/index.js +26 -0
  48. package/dist/components/flow-mini-map/index.less +22 -0
  49. package/dist/components/flow-panel/config-panel.d.ts +15 -0
  50. package/dist/components/flow-panel/config-panel.js +303 -0
  51. package/dist/components/flow-panel/index.d.ts +7 -0
  52. package/dist/components/flow-panel/index.js +7 -0
  53. package/dist/components/flow-panel/index.less +85 -0
  54. package/dist/components/flow-panel/panel-container.d.ts +12 -0
  55. package/dist/components/flow-panel/panel-container.js +25 -0
  56. package/dist/components/flow-tools/add-node-btn.d.ts +3 -0
  57. package/dist/components/flow-tools/add-node-btn.js +26 -0
  58. package/dist/components/flow-tools/history-btn.d.ts +3 -0
  59. package/dist/components/flow-tools/history-btn.js +59 -0
  60. package/dist/components/flow-tools/index.d.ts +4 -0
  61. package/dist/components/flow-tools/index.js +29 -0
  62. package/dist/components/flow-tools/index.less +82 -0
  63. package/dist/components/flow-tools/layout-btn.d.ts +3 -0
  64. package/dist/components/flow-tools/layout-btn.js +27 -0
  65. package/dist/components/flow-tools/mini-map-btn.d.ts +3 -0
  66. package/dist/components/flow-tools/mini-map-btn.js +32 -0
  67. package/dist/components/flow-tools/scale-btn.d.ts +3 -0
  68. package/dist/components/flow-tools/scale-btn.js +101 -0
  69. package/dist/components/flow-tools/short-key-btn.d.ts +3 -0
  70. package/dist/components/flow-tools/short-key-btn.js +38 -0
  71. package/dist/components/flow-tools/short-key-content.d.ts +4 -0
  72. package/dist/components/flow-tools/short-key-content.js +153 -0
  73. package/dist/components/flow-tools/short-key-content.less +38 -0
  74. package/dist/components/flow-tools/touch-mode-btn.d.ts +3 -0
  75. package/dist/components/flow-tools/touch-mode-btn.js +89 -0
  76. package/dist/components/input-text-area/index.d.ts +16 -0
  77. package/dist/components/input-text-area/index.js +74 -0
  78. package/dist/components/input-text-area/index.less +30 -0
  79. package/dist/components/judge-form/index.d.ts +13 -0
  80. package/dist/components/judge-form/index.js +182 -0
  81. package/dist/components/judge-form/index.less +11 -0
  82. package/dist/components/node-menu/index.d.ts +35 -0
  83. package/dist/components/node-menu/index.js +266 -0
  84. package/dist/components/node-menu/index.less +79 -0
  85. package/dist/components/node-resizer/index.d.ts +11 -0
  86. package/dist/components/node-resizer/index.js +46 -0
  87. package/dist/components/node-resizer/index.less +12 -0
  88. package/dist/components/node-result-panel/index.d.ts +9 -0
  89. package/dist/components/node-result-panel/index.js +155 -0
  90. package/dist/components/node-result-panel/index.less +132 -0
  91. package/dist/components/node-tree/index.d.ts +4 -0
  92. package/dist/components/node-tree/index.js +213 -0
  93. package/dist/components/node-tree/index.less +51 -0
  94. package/dist/components/output-params-tree/index.d.ts +10 -0
  95. package/dist/components/output-params-tree/index.js +34 -0
  96. package/dist/components/output-params-tree/index.less +27 -0
  97. package/dist/components/script-code-mirror/index.d.ts +14 -0
  98. package/dist/components/script-code-mirror/index.js +162 -0
  99. package/dist/components/script-code-mirror/index.less +11 -0
  100. package/dist/components/script-edit-modal/index.d.ts +30 -0
  101. package/dist/components/script-edit-modal/index.js +84 -0
  102. package/dist/components/script-edit-modal/index.less +24 -0
  103. package/dist/components/select-with-desc/index.d.ts +5 -0
  104. package/dist/components/select-with-desc/index.js +20 -0
  105. package/dist/components/select-with-desc/index.less +11 -0
  106. package/dist/components/task-status/index.d.ts +4 -0
  107. package/dist/components/task-status/index.js +209 -0
  108. package/dist/components/task-status/index.less +65 -0
  109. package/dist/components/var-input-text-area/index.d.ts +17 -0
  110. package/dist/components/var-input-text-area/index.js +211 -0
  111. package/dist/components/var-input-text-area/index.less +64 -0
  112. package/dist/components/var-type-prefix/index.d.ts +17 -0
  113. package/dist/components/var-type-prefix/index.js +21 -0
  114. package/dist/components/variable-input/index.d.ts +24 -0
  115. package/dist/components/variable-input/index.js +163 -0
  116. package/dist/components/variable-input/index.less +13 -0
  117. package/dist/components/variable-tree-select/index.d.ts +33 -0
  118. package/dist/components/variable-tree-select/index.js +160 -0
  119. package/dist/components/variable-tree-select/index.less +61 -0
  120. package/dist/constant/index.d.ts +61 -0
  121. package/dist/constant/index.js +515 -0
  122. package/dist/flow/animate.css +5 -0
  123. package/dist/flow/context.d.ts +12 -0
  124. package/dist/flow/context.js +44 -0
  125. package/dist/flow/index.d.ts +13 -0
  126. package/dist/flow/index.js +162 -0
  127. package/dist/flow/index.less +72 -0
  128. package/dist/hooks/index.d.ts +10 -0
  129. package/dist/hooks/index.js +10 -0
  130. package/dist/hooks/use-edges-interaction.d.ts +11 -0
  131. package/dist/hooks/use-edges-interaction.js +125 -0
  132. package/dist/hooks/use-flow-debug-interaction.d.ts +5 -0
  133. package/dist/hooks/use-flow-debug-interaction.js +23 -0
  134. package/dist/hooks/use-flow-interaction.d.ts +12 -0
  135. package/dist/hooks/use-flow-interaction.js +173 -0
  136. package/dist/hooks/use-flow-key-press.d.ts +1 -0
  137. package/dist/hooks/use-flow-key-press.js +32 -0
  138. package/dist/hooks/use-flow-save.d.ts +5 -0
  139. package/dist/hooks/use-flow-save.js +47 -0
  140. package/dist/hooks/use-flow-view-port.d.ts +7 -0
  141. package/dist/hooks/use-flow-view-port.js +46 -0
  142. package/dist/hooks/use-history.d.ts +21 -0
  143. package/dist/hooks/use-history.js +80 -0
  144. package/dist/hooks/use-nodes-interaction.d.ts +34 -0
  145. package/dist/hooks/use-nodes-interaction.js +777 -0
  146. package/dist/hooks/use-nodes-output-params.d.ts +31 -0
  147. package/dist/hooks/use-nodes-output-params.js +300 -0
  148. package/dist/hooks/use-nodes-update.d.ts +9 -0
  149. package/dist/hooks/use-nodes-update.js +38 -0
  150. package/dist/hooks/use-work-flow.d.ts +4 -0
  151. package/dist/hooks/use-work-flow.js +21 -0
  152. package/dist/i18n/i18n.d.ts +62 -0
  153. package/dist/i18n/i18n.js +111 -0
  154. package/dist/i18n/index.d.ts +3 -0
  155. package/dist/i18n/index.js +12 -0
  156. package/dist/i18n/locales/en-us.json +327 -0
  157. package/dist/i18n/locales/ja-jp.json +300 -0
  158. package/dist/i18n/locales/zh-cn.json +327 -0
  159. package/dist/index.css +1 -0
  160. package/dist/index.d.ts +47 -0
  161. package/dist/index.js +47 -0
  162. package/dist/index.less +1 -0
  163. package/dist/store/index.d.ts +70 -0
  164. package/dist/store/index.js +146 -0
  165. package/dist/tailwind.css +28 -0
  166. package/dist/types/work-flow.d.ts +188 -0
  167. package/dist/types/work-flow.js +1 -0
  168. package/dist/utils/default-values.d.ts +2 -0
  169. package/dist/utils/default-values.js +16 -0
  170. package/dist/utils/index.d.ts +39 -0
  171. package/dist/utils/index.js +273 -0
  172. package/dist/utils/unique-id.d.ts +2 -0
  173. package/dist/utils/unique-id.js +39 -0
  174. package/dist/utils/work-flow.d.ts +17 -0
  175. package/dist/utils/work-flow.js +44 -0
  176. package/package.json +78 -0
@@ -0,0 +1,62 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ import { useStore } from "../../flow/context";
6
+ import $i18n from "../../i18n";
7
+ import { Tabs } from '@agentscope-ai/design';
8
+ import { SparkOperateLeftLine, SparkOperateRightLine } from '@agentscope-ai/icons';
9
+ import classNames from 'classnames';
10
+ import React, { memo } from 'react';
11
+ import NodeMenu from "../node-menu";
12
+ import NodeTree from "../node-tree";
13
+ import "./index.less";
14
+ export default /*#__PURE__*/memo(function FlowAside() {
15
+ var hiddenMenu = useStore(function (state) {
16
+ return state.hiddenMenu;
17
+ });
18
+ var setHiddenMenu = useStore(function (state) {
19
+ return state.setHiddenMenu;
20
+ });
21
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
22
+ className: classNames('spark-flow-aside flex flex-col', _defineProperty({}, 'menu-hidden', hiddenMenu))
23
+ }, /*#__PURE__*/React.createElement("div", {
24
+ className: "spark-flow-aside-header flex-justify-between flex-shrink-0"
25
+ }, /*#__PURE__*/React.createElement("span", {
26
+ className: "spark-flow-aside-header-title"
27
+ }, $i18n.get({
28
+ id: 'spark-flow.components.FlowAside.index.nodeManagement',
29
+ dm: '节点管理'
30
+ })), /*#__PURE__*/React.createElement(SparkOperateLeftLine, {
31
+ onClick: function onClick() {
32
+ return setHiddenMenu(true);
33
+ },
34
+ className: "spark-flow-aside-header-fold-icon cursor-pointer"
35
+ })), /*#__PURE__*/React.createElement(Tabs, {
36
+ className: "spark-flow-aside-tabs flex-1 h-[1px]",
37
+ items: [{
38
+ label: $i18n.get({
39
+ id: 'spark-flow.components.FlowAside.index.nodeLibrary',
40
+ dm: '节点库'
41
+ }),
42
+ key: 'node-library',
43
+ children: /*#__PURE__*/React.createElement(NodeMenu, null)
44
+ }, {
45
+ label: $i18n.get({
46
+ id: 'spark-flow.components.FlowAside.index.current',
47
+ dm: '当前'
48
+ }),
49
+ key: 'current',
50
+ children: /*#__PURE__*/React.createElement(NodeTree, null)
51
+ }]
52
+ })), /*#__PURE__*/React.createElement("div", {
53
+ className: classNames('spark-flow-aside-header-expand-btn absolute cursor-pointer', _defineProperty({}, 'menu-hidden', hiddenMenu)),
54
+ onClick: function onClick() {
55
+ return setHiddenMenu(false);
56
+ }
57
+ }, hiddenMenu ? /*#__PURE__*/React.createElement(SparkOperateRightLine, {
58
+ className: "spark-flow-aside-header-expand-btn-icon"
59
+ }) : /*#__PURE__*/React.createElement(SparkOperateLeftLine, {
60
+ className: "spark-flow-aside-header-expand-btn-icon"
61
+ })));
62
+ });
@@ -0,0 +1,84 @@
1
+ @import '../../index.less';
2
+
3
+ .spark-flow-aside {
4
+ width: 240px;
5
+ box-shadow:
6
+ 0 0 0 0 rgb(0 0 0 / 4%),
7
+ 0 4px 16px 0 rgb(0 0 0 / 4%),
8
+ 0 2px 8px -1px rgb(0 0 0 / 2%),
9
+ 0 2px 4px 0 rgb(0 0 0 / 2%);
10
+ border-right: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
11
+ background: e('var(--@{ant-prefix}-color-bg-base)');
12
+ transition: all 0.3s ease-in-out;
13
+ opacity: 1;
14
+ visibility: visible;
15
+
16
+ &-tabs {
17
+ .@{ant-prefix}-tabs-nav {
18
+ margin: 0;
19
+ padding: 0 24px;
20
+
21
+ .@{ant-prefix}-tabs-tab {
22
+ padding: 4px 0;
23
+ line-height: 24px;
24
+ }
25
+ }
26
+
27
+ .@{ant-prefix}-tabs-content,
28
+ .@{ant-prefix}-tabs-tabpane {
29
+ height: 100%;
30
+ }
31
+ }
32
+
33
+ &-header {
34
+ height: 56px;
35
+ padding: 0 24px;
36
+
37
+ &-title {
38
+ font-size: 16px;
39
+ font-weight: 600;
40
+ line-height: 24px;
41
+ }
42
+ }
43
+
44
+ > * {
45
+ width: 240px;
46
+ }
47
+
48
+ &-header-fold-icon {
49
+ font-size: 20px;
50
+ }
51
+
52
+ &-header-expand-btn {
53
+ width: 32px;
54
+ height: 32px;
55
+ display: flex;
56
+ justify-content: center;
57
+ align-items: center;
58
+ font-size: 20px;
59
+ border: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
60
+ z-index: -1;
61
+ pointer-events: none;
62
+ left: 16px;
63
+ top: 16px;
64
+ transition: all 0.3s ease-in-out;
65
+ border-radius: 6px;
66
+
67
+ &.menu-hidden {
68
+ transition-duration: 0;
69
+ z-index: 1;
70
+ pointer-events: initial;
71
+ box-shadow: e('var(--@{ant-prefix}-box-shadow)');
72
+ background: e('var(--@{ant-prefix}-color-bg-base)');
73
+ }
74
+ }
75
+
76
+ &.menu-hidden {
77
+ width: 0;
78
+ overflow: hidden;
79
+ border: none;
80
+ box-shadow: none;
81
+ opacity: 0;
82
+ visibility: hidden;
83
+ }
84
+ }
@@ -0,0 +1,5 @@
1
+ import { EdgeProps } from '@xyflow/react';
2
+ import React from 'react';
3
+ import './index.less';
4
+ declare const _default: React.NamedExoticComponent<EdgeProps>;
5
+ export default _default;
@@ -0,0 +1,226 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
6
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
7
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
8
+ import { useNodesReadOnly } from "../../hooks";
9
+ import { getTypeFromId } from "../../utils";
10
+ import { getCommonConfig } from '@agentscope-ai/design';
11
+ import { SparkPlusLine } from '@agentscope-ai/icons';
12
+ import { BaseEdge, EdgeLabelRenderer, getBezierPath } from '@xyflow/react';
13
+ import React, { memo, useMemo, useState } from 'react';
14
+ import { PopoverNodeMenu } from "../node-menu";
15
+ import "./index.less";
16
+ import LinearGradientSvg from "./linear-gradient-svg";
17
+ export default /*#__PURE__*/memo(function FlowBaseEdge(_ref) {
18
+ var id = _ref.id,
19
+ animated = _ref.animated,
20
+ sourceX = _ref.sourceX,
21
+ sourceY = _ref.sourceY,
22
+ targetX = _ref.targetX,
23
+ targetY = _ref.targetY,
24
+ sourcePosition = _ref.sourcePosition,
25
+ targetPosition = _ref.targetPosition,
26
+ source = _ref.source,
27
+ sourceHandleId = _ref.sourceHandleId,
28
+ target = _ref.target,
29
+ targetHandleId = _ref.targetHandleId,
30
+ data = _ref.data,
31
+ selected = _ref.selected;
32
+ var edgeData = data || {};
33
+ var _useNodesReadOnly = useNodesReadOnly(),
34
+ nodesReadOnly = _useNodesReadOnly.nodesReadOnly;
35
+ var _useState = useState(false),
36
+ _useState2 = _slicedToArray(_useState, 2),
37
+ open = _useState2[0],
38
+ setOpen = _useState2[1];
39
+
40
+ /* Check coordinate values, set to 0 if NaN */
41
+ var safeSourceX = isNaN(sourceX) ? 0 : sourceX;
42
+ var safeSourceY = isNaN(sourceY) ? 0 : sourceY;
43
+ var safeTargetX = isNaN(targetX) ? 0 : targetX;
44
+ var safeTargetY = isNaN(targetY) ? 0 : targetY;
45
+ var _getBezierPath = getBezierPath({
46
+ sourceX: safeSourceX + 2,
47
+ sourceY: safeSourceY,
48
+ sourcePosition: sourcePosition,
49
+ targetX: safeTargetX - 2,
50
+ targetY: safeTargetY,
51
+ targetPosition: targetPosition
52
+ }),
53
+ _getBezierPath2 = _slicedToArray(_getBezierPath, 3),
54
+ edgePath = _getBezierPath2[0],
55
+ labelX = _getBezierPath2[1],
56
+ labelY = _getBezierPath2[2];
57
+ var sourceType = useMemo(function () {
58
+ return getTypeFromId(source);
59
+ }, [source]);
60
+ var targetType = useMemo(function () {
61
+ return getTypeFromId(target);
62
+ }, [target]);
63
+ var _getCommonConfig = getCommonConfig(),
64
+ antPrefix = _getCommonConfig.antPrefix;
65
+ var colorList = useMemo(function () {
66
+ if (edgeData._source_node_status && edgeData._target_node_status) {
67
+ if (edgeData._source_node_status === 'success' && edgeData._target_node_status === 'success') {
68
+ return [{
69
+ color: '#30A46C',
70
+ opacity: 0.5,
71
+ offset: 0
72
+ }, {
73
+ color: '#30A46C',
74
+ opacity: 0,
75
+ offset: 100
76
+ }];
77
+ }
78
+ if (edgeData._source_node_status === 'success' && edgeData._target_node_status === 'fail') {
79
+ return [{
80
+ color: '#30A46C',
81
+ opacity: 1,
82
+ offset: 0
83
+ }, {
84
+ color: '#E8D207',
85
+ opacity: 1,
86
+ offset: 64
87
+ }, {
88
+ color: '#F23139',
89
+ opacity: 1,
90
+ offset: 100
91
+ }];
92
+ }
93
+ if (edgeData._source_node_status === 'success' || edgeData._source_node_status === 'executing' && edgeData._target_node_status === 'executing') {
94
+ return [{
95
+ color: '#30A46C',
96
+ opacity: 1,
97
+ offset: 0
98
+ }, {
99
+ color: '#87B0F7',
100
+ opacity: 1,
101
+ offset: 50
102
+ }, {
103
+ color: '#615CED',
104
+ opacity: 1,
105
+ offset: 100
106
+ }];
107
+ }
108
+ }
109
+ if (edgeData._hover) {
110
+ return [{
111
+ color: '#8977FE',
112
+ opacity: 0.3,
113
+ offset: 0
114
+ }, {
115
+ color: '#8977FE',
116
+ opacity: 0.9,
117
+ offset: 100
118
+ }];
119
+ }
120
+ if (selected) return [{
121
+ color: '#624AFF',
122
+ offset: 0,
123
+ opacity: 0.5
124
+ }, {
125
+ color: '#624AFF',
126
+ offset: 100
127
+ }];
128
+ return [{
129
+ color: "var(--".concat(antPrefix, "-color-mauve)"),
130
+ offset: 0
131
+ }, {
132
+ color: "var(--".concat(antPrefix, "-color-mauve)"),
133
+ offset: 100
134
+ }];
135
+ }, [edgeData, selected]);
136
+ var isAnimated = useMemo(function () {
137
+ var _ref2;
138
+ if (edgeData._source_node_status === 'executing' && edgeData._target_node_status === 'executing') return true;
139
+ return edgeData._source_node_status === 'success' && !((_ref2 = ['fail', 'success']) !== null && _ref2 !== void 0 && _ref2.includes(edgeData._target_node_status || ''));
140
+ }, [edgeData]);
141
+ var markerEndColor = useMemo(function () {
142
+ if (edgeData._source_node_status && edgeData._target_node_status) {
143
+ if (edgeData._source_node_status === 'success' && edgeData._target_node_status === 'success') {
144
+ return {
145
+ stroke: '#30A46C'
146
+ };
147
+ }
148
+ if (edgeData._source_node_status === 'success' && edgeData._target_node_status === 'fail') {
149
+ return {
150
+ stroke: '#F23139'
151
+ };
152
+ }
153
+ if (edgeData._source_node_status === 'success') {
154
+ return {
155
+ stroke: '#615CED'
156
+ };
157
+ }
158
+ }
159
+ if (edgeData._hover) {
160
+ return {
161
+ stroke: '#8977FE',
162
+ opacity: '0.9'
163
+ };
164
+ }
165
+ if (selected) return {
166
+ stroke: '#615CED'
167
+ };
168
+ return {
169
+ stroke: "var(--".concat(antPrefix, "-color-mauve)")
170
+ };
171
+ }, [edgeData._hover, selected, getCommonConfig, edgeData._source_node_status, edgeData._target_node_status]);
172
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !animated && /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("marker", {
173
+ id: "".concat(id, "-arrow"),
174
+ markerWidth: "20",
175
+ markerHeight: "20",
176
+ viewBox: "-10 -10 20 20",
177
+ markerUnits: "strokeWidth",
178
+ orient: "auto-start-reverse",
179
+ refX: "0",
180
+ refY: "0"
181
+ }, /*#__PURE__*/React.createElement("polyline", _extends({
182
+ strokeLinecap: "round",
183
+ strokeLinejoin: "round",
184
+ fill: "none",
185
+ points: "-5,-4 0,0 -5,4",
186
+ strokeWidth: 1
187
+ }, markerEndColor)))), /*#__PURE__*/React.createElement(LinearGradientSvg, {
188
+ id: id,
189
+ startColor: "red",
190
+ stopColor: "blue",
191
+ colorList: colorList,
192
+ position: {
193
+ sourceX: safeSourceX,
194
+ sourceY: safeSourceY,
195
+ targetX: safeTargetX,
196
+ targetY: safeTargetY
197
+ },
198
+ animated: isAnimated
199
+ }), /*#__PURE__*/React.createElement(BaseEdge, {
200
+ id: id,
201
+ path: edgePath,
202
+ style: {
203
+ stroke: "url(#".concat(id, ")"),
204
+ strokeWidth: 1.5
205
+ },
206
+ markerEnd: "url(#".concat(id, "-arrow)")
207
+ }), (edgeData._hover || open) && !nodesReadOnly && /*#__PURE__*/React.createElement(EdgeLabelRenderer, null, /*#__PURE__*/React.createElement(PopoverNodeMenu, {
208
+ onOpenChange: setOpen,
209
+ source: {
210
+ id: source,
211
+ type: sourceType,
212
+ handleId: sourceHandleId || ''
213
+ },
214
+ target: {
215
+ id: target,
216
+ type: targetType,
217
+ handleId: targetHandleId || ''
218
+ }
219
+ }, /*#__PURE__*/React.createElement("div", {
220
+ style: {
221
+ transform: "translate(-50%, -50%) translate(".concat(labelX, "px,").concat(labelY, "px)"),
222
+ zIndex: edgeData._hover ? 1000 : 0
223
+ },
224
+ className: "spark-flow-edge-btn nodrag nopan flex-center"
225
+ }, /*#__PURE__*/React.createElement(SparkPlusLine, null)))));
226
+ });
@@ -0,0 +1,28 @@
1
+ @import '../../index.less';
2
+
3
+ .spark-flow-edge-btn {
4
+ width: 20px;
5
+ height: 20px;
6
+ border-radius: 50%;
7
+ background: e('var(--@{ant-prefix}-color-bg-base)');
8
+ box-shadow: 0 4px 24px 0 rgb(0 0 0 / 15%);
9
+ color: e('var(--@{ant-prefix}-color-primary)');
10
+ position: absolute;
11
+ pointer-events: all;
12
+ transform-origin: center;
13
+ cursor: pointer;
14
+ z-index: 1003 !important;
15
+ }
16
+
17
+ .spark-flow-animate-gradient-edge {
18
+ animation: gradientAnimation 2s linear infinite;
19
+ }
20
+
21
+ @keyframes gradientAnimation {
22
+ 0% {
23
+ transform: translateX(0);
24
+ }
25
+ 100% {
26
+ transform: translateX(100%);
27
+ }
28
+ }
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ export type ILinearGradientSvgProps = {
4
+ id: string;
5
+ startColor: string;
6
+ stopColor: string;
7
+ position: {
8
+ sourceX: number;
9
+ sourceY: number;
10
+ targetX: number;
11
+ targetY: number;
12
+ };
13
+ colorList: Array<{
14
+ color: string;
15
+ opacity?: number;
16
+ offset: number;
17
+ }>;
18
+ animated?: boolean;
19
+ };
20
+ declare const _default: React.MemoExoticComponent<({ id, position, colorList, animated, }: ILinearGradientSvgProps) => React.JSX.Element>;
21
+ export default _default;
@@ -0,0 +1,32 @@
1
+ import React, { memo } from 'react';
2
+ import "./index.less";
3
+ var LinearGradientSvg = function LinearGradientSvg(_ref) {
4
+ var id = _ref.id,
5
+ position = _ref.position,
6
+ colorList = _ref.colorList,
7
+ _ref$animated = _ref.animated,
8
+ animated = _ref$animated === void 0 ? false : _ref$animated;
9
+ var sourceX = position.sourceX,
10
+ sourceY = position.sourceY,
11
+ targetX = position.targetX,
12
+ targetY = position.targetY;
13
+ return /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
14
+ className: animated ? 'spark-flow-animate-gradient-edge' : '',
15
+ id: id,
16
+ gradientUnits: "userSpaceOnUse",
17
+ x1: sourceX,
18
+ y1: sourceY,
19
+ x2: targetX,
20
+ y2: targetY
21
+ }, colorList.map(function (item, index) {
22
+ return /*#__PURE__*/React.createElement("stop", {
23
+ key: index,
24
+ offset: "".concat(item.offset, "%"),
25
+ style: {
26
+ stopColor: item.color,
27
+ stopOpacity: item.opacity || 1
28
+ }
29
+ });
30
+ })));
31
+ };
32
+ export default /*#__PURE__*/memo(LinearGradientSvg);
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare const _default: React.NamedExoticComponent<{
4
+ nodeType: string;
5
+ size?: "small" | "default" | undefined;
6
+ showBg?: boolean | undefined;
7
+ noWidth?: boolean | undefined;
8
+ }>;
9
+ export default _default;
@@ -0,0 +1,30 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ import { useStore } from "../../flow/context";
6
+ import classNames from 'classnames';
7
+ import React, { memo } from 'react';
8
+ import "./index.less";
9
+ export default /*#__PURE__*/memo(function FlowIcon(_ref) {
10
+ var _nodeSchemaMap$nodeTy, _nodeSchemaMap$nodeTy2;
11
+ var nodeType = _ref.nodeType,
12
+ _ref$size = _ref.size,
13
+ size = _ref$size === void 0 ? 'default' : _ref$size,
14
+ _ref$showBg = _ref.showBg,
15
+ showBg = _ref$showBg === void 0 ? true : _ref$showBg,
16
+ _ref$noWidth = _ref.noWidth,
17
+ noWidth = _ref$noWidth === void 0 ? false : _ref$noWidth;
18
+ var nodeSchemaMap = useStore(function (store) {
19
+ return store.nodeSchemaMap;
20
+ });
21
+ return /*#__PURE__*/React.createElement("div", {
22
+ style: {
23
+ backgroundColor: showBg ? (_nodeSchemaMap$nodeTy = nodeSchemaMap[nodeType]) === null || _nodeSchemaMap$nodeTy === void 0 ? void 0 : _nodeSchemaMap$nodeTy.bgColor : 'transparent'
24
+ },
25
+ className: classNames('spark-flow-node-icon-wrap', _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, 'size-[24px]', size === 'default' && !noWidth), 'size-[16px]', size === 'small' && !noWidth), 'spark-node-icon-small', size === 'small' && !noWidth), 'spark-flow-node-icon-no-bg', !showBg))
26
+ }, (_nodeSchemaMap$nodeTy2 = nodeSchemaMap[nodeType]) === null || _nodeSchemaMap$nodeTy2 === void 0 ? void 0 : _nodeSchemaMap$nodeTy2.iconType({
27
+ className: 'spark-flow-type-icon',
28
+ size: 16
29
+ }));
30
+ });
@@ -0,0 +1,20 @@
1
+ @import '../../index.less';
2
+
3
+ .spark-flow-node-icon-wrap {
4
+ border-radius: 4px;
5
+ background: e('var(--@{ant-prefix}-color-primary)');
6
+ display: flex;
7
+ align-items: center;
8
+ justify-content: center;
9
+ color: e('var(--@{ant-prefix}-color-text-white)');
10
+
11
+ &.spark-node-icon-small {
12
+ .spark-flow-type-icon {
13
+ font-size: 12px !important;
14
+ }
15
+ }
16
+
17
+ &.spark-flow-node-icon-no-bg {
18
+ color: e('var(--@{ant-prefix}-color-text)');
19
+ }
20
+ }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ declare const _default: React.NamedExoticComponent<object>;
4
+ export default _default;
@@ -0,0 +1,26 @@
1
+ import { useStore } from "../../flow/context";
2
+ import { MiniMap } from '@xyflow/react';
3
+ import { useMemoizedFn } from 'ahooks';
4
+ import classNames from 'classnames';
5
+ import React, { memo } from 'react';
6
+ import "./index.less";
7
+ export default /*#__PURE__*/memo(function FlowMiniMap() {
8
+ var showMiniMap = useStore(function (state) {
9
+ return state.showMiniMap;
10
+ });
11
+ var getNodeClassName = useMemoizedFn(function (node) {
12
+ return classNames('spark-flow-mini-map-node', node.type && "spark-flow-mini-map-node_".concat(node.type));
13
+ });
14
+ return showMiniMap && /*#__PURE__*/React.createElement(MiniMap, {
15
+ ariaLabel: null,
16
+ pannable: true,
17
+ draggable: true,
18
+ zoomable: true,
19
+ style: {
20
+ width: 220,
21
+ height: 120
22
+ },
23
+ className: "spark-flow-mini-map",
24
+ nodeClassName: getNodeClassName
25
+ });
26
+ });
@@ -0,0 +1,22 @@
1
+ @import '../../index.less';
2
+
3
+ .spark-flow-mini-map {
4
+ bottom: 66px !important;
5
+ left: 16px;
6
+ right: initial !important;
7
+ top: initial;
8
+ margin: 0 !important;
9
+ border-radius: 6px;
10
+ border: 1px solid e('var(--@{ant-prefix}-color-border-secondary)');
11
+ .react-flow__minimap-node{
12
+ fill: e('var(--@{ant-prefix}-color-primary-border-hover)');
13
+ }
14
+ > svg {
15
+ width: 100%;
16
+ height: 100%;
17
+ }
18
+
19
+ .spark-flow-mini-map-node {
20
+ fill: e('var(--@{ant-prefix}-color-primary-border-hover)');
21
+ }
22
+ }
@@ -0,0 +1,15 @@
1
+ import { IWorkFlowNode } from "../../types/work-flow";
2
+ import React from 'react';
3
+ export interface ISingleTestPanel {
4
+ selectedNodeData: IWorkFlowNode;
5
+ onClose: () => void;
6
+ disabled?: boolean;
7
+ }
8
+ export declare const ConfigPanel: React.MemoExoticComponent<({ selectedNode, singleTestPanel, }: {
9
+ selectedNode: IWorkFlowNode;
10
+ singleTestPanel?: React.ComponentType<ISingleTestPanel> | undefined;
11
+ }) => React.JSX.Element | null>;
12
+ declare const ConfigPanelWrap: React.MemoExoticComponent<(props: {
13
+ singleTestPanel?: React.ComponentType<ISingleTestPanel>;
14
+ }) => React.JSX.Element | null>;
15
+ export default ConfigPanelWrap;