@digitalsee-ai/rcs 1.1.8 → 2.0.0-beta2
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/README.md +6 -38
- package/README.npm.md +37 -0
- package/dist/components/digitalsee/JsonRenderer/index.d.ts +1 -1
- package/dist/components/digitalsee/workflow/Canvas/FastOperationButtons.d.ts +5 -2
- package/dist/components/digitalsee/workflow/Canvas/FullscreenLoading.d.ts +10 -2
- package/dist/components/digitalsee/workflow/Canvas/MiniMap.d.ts +1 -1
- package/dist/components/digitalsee/workflow/Canvas/NodePlaceholder.d.ts +12 -0
- package/dist/components/digitalsee/workflow/Canvas/WorkflowCanvasHeader.d.ts +3 -6
- package/dist/components/digitalsee/workflow/Canvas/actionItemToNodeData.d.ts +1 -6
- package/dist/components/digitalsee/workflow/Canvas/constants.d.ts +6 -26
- package/dist/components/digitalsee/workflow/Canvas/hooks/{classicNodeAddConnection.d.ts → nodePackageAddConnection.d.ts} +3 -3
- package/dist/components/digitalsee/workflow/Canvas/hooks/useCanvasApi.d.ts +4 -2
- package/dist/components/digitalsee/workflow/Canvas/hooks/useDataLoading.d.ts +33 -4
- package/dist/components/digitalsee/workflow/Canvas/hooks/useNodeAddCallback.d.ts +2 -3
- package/dist/components/digitalsee/workflow/Canvas/hooks/useWorkflowCanvasState.d.ts +22 -4
- package/dist/components/digitalsee/workflow/Canvas/types.d.ts +18 -6
- package/dist/components/digitalsee/workflow/Edges/BaseEdge.d.ts +2 -0
- package/dist/components/digitalsee/workflow/Edges/EdgeFactory.d.ts +3 -8
- package/dist/components/digitalsee/workflow/Edges/edgeLayout.d.ts +73 -0
- package/dist/components/digitalsee/workflow/Handles/CustomHandle.d.ts +1 -0
- package/dist/components/digitalsee/workflow/Handles/customHandleConnectable.d.ts +19 -0
- package/dist/components/digitalsee/workflow/Nodes/DeclaredNode.d.ts +33 -0
- package/dist/components/digitalsee/workflow/Nodes/DynamicNode.d.ts +24 -0
- package/dist/components/digitalsee/workflow/Nodes/NodeFactory.d.ts +42 -4
- package/dist/components/digitalsee/workflow/Nodes/SuperBaseNode.d.ts +2 -1
- package/dist/components/digitalsee/workflow/Nodes/classicPortLayout.d.ts +51 -0
- package/dist/components/digitalsee/workflow/Nodes/components/NodeStatusBadge.d.ts +11 -0
- package/dist/components/digitalsee/workflow/Nodes/{classicNodePackagePortLayout.d.ts → nodePackagePortLayout.d.ts} +4 -4
- package/dist/components/digitalsee/workflow/Nodes/nodeTypeRegistry.d.ts +131 -0
- package/dist/components/digitalsee/workflow/Nodes/useNodePackagePorts.d.ts +35 -0
- package/dist/components/digitalsee/workflow/NodesConfig/NodePackageConfig/fieldSchemaAdapter.d.ts +14 -0
- package/dist/components/digitalsee/workflow/NodesConfig/components/FormFieldRenderer/fields/RichTagInput/help.d.ts +5 -1
- package/dist/components/digitalsee/workflow/NodesConfig/components/FormFieldRenderer/index.d.ts +1 -0
- package/dist/components/digitalsee/workflow/NodesConfig/components/NodeTest.d.ts +2 -0
- package/dist/components/digitalsee/workflow/NodesConfig/components/NodeTest.helpers.d.ts +11 -0
- package/dist/components/digitalsee/workflow/NodesConfig/components/VariableModal/tree-help.d.ts +5 -12
- package/dist/components/digitalsee/workflow/NodesConfig/submitPayload.d.ts +10 -17
- package/dist/components/digitalsee/workflow/Panels/CanvasConfigDebugger.d.ts +1 -1
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/components/CategoryItem.d.ts +1 -1
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/components/CategoryTabs.d.ts +1 -1
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/components/NodeCard.d.ts +1 -1
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/components/NodeItem.d.ts +1 -1
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/components/PanelHeader.d.ts +1 -1
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useConnectableNodeSelector.d.ts +2 -5
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/types.d.ts +10 -4
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/connectableDataSource.d.ts +6 -10
- package/dist/components/digitalsee/workflow/Panels/SimpleNodeSelectorPanel/components/NodeListItem.d.ts +1 -1
- package/dist/components/digitalsee/workflow/api/dip.types.d.ts +30 -1
- package/dist/components/digitalsee/workflow/api/index.d.ts +3 -22
- package/dist/components/digitalsee/workflow/builtin/controls/ConfigSubflow/index.d.ts +2 -2
- package/dist/components/digitalsee/workflow/builtin/globalConfig/index.d.ts +5 -1
- package/dist/components/digitalsee/workflow/config/globalConfig.d.ts +1 -5
- package/dist/components/digitalsee/workflow/config/layerConfig.d.ts +14 -0
- package/dist/components/digitalsee/workflow/config/themeConfig.d.ts +19 -23
- package/dist/components/digitalsee/workflow/constants/nodePackageHandles.d.ts +10 -0
- package/dist/components/digitalsee/workflow/context/workflowTriggerContext.d.ts +22 -0
- package/dist/components/digitalsee/workflow/coverage/acceptanceManifest.d.ts +30 -0
- package/dist/components/digitalsee/workflow/coverage/runtimeCoverage.d.ts +34 -0
- package/dist/components/digitalsee/workflow/design-system/AiFlowNodeTestPanel.d.ts +24 -0
- package/dist/components/digitalsee/workflow/design-system/AiFlowVariableTree.d.ts +34 -0
- package/dist/components/digitalsee/workflow/design-system/index.d.ts +3 -0
- package/dist/components/digitalsee/workflow/design-system/tokens.d.ts +103 -0
- package/dist/components/digitalsee/workflow/enums/canvas.d.ts +0 -12
- package/dist/components/digitalsee/workflow/enums/edge.d.ts +4 -2
- package/dist/components/digitalsee/workflow/enums/node.d.ts +5 -6
- package/dist/components/digitalsee/workflow/enums/workflow.d.ts +1 -1
- package/dist/components/digitalsee/workflow/examples/global-config-example.d.ts +1 -1
- package/dist/components/digitalsee/workflow/hooks/state.hooks.d.ts +1 -7
- package/dist/components/digitalsee/workflow/hooks/use-flow-data-operation.d.ts +1 -1
- package/dist/components/digitalsee/workflow/hooks/useCanvasLayout.d.ts +1 -1
- package/dist/components/digitalsee/workflow/hooks/useCanvasMode.d.ts +8 -0
- package/dist/components/digitalsee/workflow/hooks/useHandleConnections.d.ts +9 -1
- package/dist/components/digitalsee/workflow/hooks/useVariables.d.ts +1 -0
- package/dist/components/digitalsee/workflow/hooks/useWorkflow.d.ts +1 -1
- package/dist/components/digitalsee/workflow/index.d.ts +18 -44
- package/dist/components/digitalsee/workflow/migration/umi.d.ts +1 -2
- package/dist/components/digitalsee/workflow/store/workflowSlice.d.ts +5 -2
- package/dist/components/digitalsee/workflow/types/Node.d.ts +2 -0
- package/dist/components/digitalsee/workflow/types/Workflow.d.ts +1 -1
- package/dist/components/digitalsee/workflow/types/engine.d.ts +21 -12
- package/dist/components/digitalsee/workflow/types/flowVersion.d.ts +0 -30
- package/dist/components/digitalsee/workflow/utils/connectionCheck.d.ts +30 -0
- package/dist/components/digitalsee/workflow/utils/layoutUtils.d.ts +2 -2
- package/dist/components/digitalsee/workflow/utils/mcpCanvas.d.ts +0 -40
- package/dist/components/digitalsee/workflow/utils/mode.d.ts +18 -0
- package/dist/components/digitalsee/workflow/utils/nodeAutoConnect.d.ts +24 -0
- package/dist/components/digitalsee/workflow/utils/nodeCommon.d.ts +5 -0
- package/dist/components/digitalsee/workflow/utils/nodeHandleLayout.d.ts +83 -0
- package/dist/components/digitalsee/workflow/utils/nodePackageConnection.d.ts +28 -0
- package/dist/components/digitalsee/workflow/utils/nodePackageGraphValidation.d.ts +29 -0
- package/dist/components/digitalsee/workflow/utils/nodePackageSchemaCache.d.ts +15 -0
- package/dist/components/digitalsee/workflow/utils/onNodeRemoveHook.d.ts +13 -0
- package/dist/components/digitalsee/workflow/utils/triggerNode.d.ts +13 -0
- package/dist/components/digitalsee/workflow/utils/workflowConnectionValidator.d.ts +1 -3
- package/dist/components/digitalsee/workflow/workflow.story-fixtures.d.ts +50 -0
- package/dist/components/dynamic-form/context/VariableSelectorContext.d.ts +17 -16
- package/dist/components/dynamic-form/index.d.ts +1 -1
- package/dist/index-CBoDAvhq.mjs +285 -0
- package/dist/{index-CRdKUD0G.mjs → index-zEq02rJh.mjs} +23582 -25697
- package/dist/locales/en-US/common.d.ts +29 -52
- package/dist/locales/en-US.d.ts +29 -52
- package/dist/locales/zh-CN/common.d.ts +29 -52
- package/dist/locales/zh-CN.d.ts +29 -52
- package/dist/locales/zh-TW/common.d.ts +29 -52
- package/dist/locales/zh-TW.d.ts +29 -52
- package/dist/rcs.css +1 -1
- package/dist/rcs.es.js +65 -61
- package/dist/rcs.umd.js +132 -72
- package/package.json +38 -23
- package/dist/components/digitalsee/workflow/Canvas/FlowVersionManager.d.ts +0 -16
- package/dist/components/digitalsee/workflow/Canvas/NextConfigModalWrapper.d.ts +0 -9
- package/dist/components/digitalsee/workflow/Canvas/NextWorkflowCanvas.d.ts +0 -4
- package/dist/components/digitalsee/workflow/Canvas/NextWorkflowCanvasHeader.d.ts +0 -15
- package/dist/components/digitalsee/workflow/Canvas/hooks/createNodeAddHandlerNext.d.ts +0 -38
- package/dist/components/digitalsee/workflow/NextNodesConfigModal/index.d.ts +0 -13
- package/dist/components/digitalsee/workflow/Nodes/AISubNode.d.ts +0 -9
- package/dist/components/digitalsee/workflow/Nodes/ActionNode.d.ts +0 -13
- package/dist/components/digitalsee/workflow/Nodes/AgentNode.d.ts +0 -10
- package/dist/components/digitalsee/workflow/Nodes/BrowserNode.d.ts +0 -10
- package/dist/components/digitalsee/workflow/Nodes/BuiltinMCPNode.d.ts +0 -9
- package/dist/components/digitalsee/workflow/Nodes/ConditionNode.d.ts +0 -13
- package/dist/components/digitalsee/workflow/Nodes/CustomNode.d.ts +0 -15
- package/dist/components/digitalsee/workflow/Nodes/LoopNode.d.ts +0 -4
- package/dist/components/digitalsee/workflow/Nodes/MCPServerNode.d.ts +0 -9
- package/dist/components/digitalsee/workflow/Nodes/MCPToolNode.d.ts +0 -9
- package/dist/components/digitalsee/workflow/Nodes/NextNodeFactory.d.ts +0 -12
- package/dist/components/digitalsee/workflow/Nodes/NextNodes/NextActionNode.d.ts +0 -9
- package/dist/components/digitalsee/workflow/Nodes/NextNodes/NextBaseNode.d.ts +0 -16
- package/dist/components/digitalsee/workflow/Nodes/NextNodes/NextConditionNode.d.ts +0 -10
- package/dist/components/digitalsee/workflow/Nodes/NextNodes/NextLoopNode.d.ts +0 -10
- package/dist/components/digitalsee/workflow/Nodes/NextNodes/NextSwitchNode.d.ts +0 -10
- package/dist/components/digitalsee/workflow/Nodes/NextNodes/NextTriggerNode.d.ts +0 -9
- package/dist/components/digitalsee/workflow/Nodes/SelfLoopNode.d.ts +0 -4
- package/dist/components/digitalsee/workflow/Nodes/StartNode.d.ts +0 -1
- package/dist/components/digitalsee/workflow/Nodes/SwitchNode.d.ts +0 -13
- package/dist/components/digitalsee/workflow/Nodes/TriggerNode.d.ts +0 -10
- package/dist/components/digitalsee/workflow/Nodes/components/NextNodeDescription.d.ts +0 -16
- package/dist/components/digitalsee/workflow/Nodes/components/NextNodeOperations.d.ts +0 -11
- package/dist/components/digitalsee/workflow/Nodes/useClassicNodePackagePorts.d.ts +0 -27
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/CreateCredentialModal.d.ts +0 -13
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/CredentialSelect.d.ts +0 -17
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/ModifyCredentialModal.d.ts +0 -17
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/fieldSchemaAdapter.d.ts +0 -10
- package/dist/components/digitalsee/workflow/NodesConfig/NextNodeConfig/index.d.ts +0 -17
- package/dist/components/digitalsee/workflow/NodesConfig/components/NextNodeSettings.d.ts +0 -6
- package/dist/components/digitalsee/workflow/NodesConfig/components/NextNodeTest.d.ts +0 -6
- package/dist/components/digitalsee/workflow/NodesConfig/components/NextVariableModal/index.d.ts +0 -6
- package/dist/components/digitalsee/workflow/NodesConfig/components/NextVariableModal/variable-tree-next.d.ts +0 -49
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/components/EntryTypeSelector.d.ts +0 -8
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/components/NodeCardList.d.ts +0 -20
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useNodeActionState.d.ts +0 -28
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/hooks/useNodeSelectorPresentation.d.ts +0 -25
- package/dist/components/digitalsee/workflow/Panels/ModernNodeSelectorPanel/utils/queryParams.d.ts +0 -18
- package/dist/components/digitalsee/workflow/constants/nextHandles.d.ts +0 -1
- package/dist/components/digitalsee/workflow/utils/classicNodePackageConnection.d.ts +0 -28
- package/dist/components/digitalsee/workflow/utils/classicNodePackageGraphValidation.d.ts +0 -29
- package/dist/components/digitalsee/workflow/utils/nextNodeSchemaCache.d.ts +0 -14
- package/dist/components/digitalsee/workflow/utils/queuedNodeConfigOpen.d.ts +0 -12
- package/dist/index-CRdKUD0G.mjs.map +0 -1
- package/dist/index-rjDBrC08.mjs +0 -312
- package/dist/index-rjDBrC08.mjs.map +0 -1
- package/dist/rcs.es.js.map +0 -1
- package/dist/rcs.umd.js.map +0 -1
- /package/dist/components/digitalsee/workflow/NodesConfig/{NextNodeConfig → NodePackageConfig}/WorkflowNodeSchemaFieldProvider.d.ts +0 -0
- /package/dist/components/digitalsee/workflow/NodesConfig/{NextNodeConfig → NodePackageConfig}/fields/WorkflowCodeField.d.ts +0 -0
- /package/dist/components/digitalsee/workflow/NodesConfig/{NextNodeConfig → NodePackageConfig}/fields/WorkflowProxyField.d.ts +0 -0
- /package/dist/components/digitalsee/workflow/NodesConfig/{NextNodeConfig → NodePackageConfig}/proxyField.d.ts +0 -0
- /package/dist/components/digitalsee/workflow/NodesConfig/components/FormFieldRenderer/{next-compatible.d.ts → nodePackage-compatible.d.ts} +0 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Edge, Node, Position } from '@xyflow/react';
|
|
2
|
+
export type LayoutDirection = 'vertical' | 'horizontal';
|
|
3
|
+
export interface NodeHandlePositions {
|
|
4
|
+
sources: Position[];
|
|
5
|
+
targets: Position[];
|
|
6
|
+
}
|
|
7
|
+
interface ActionKeyHandleLayout {
|
|
8
|
+
source: Position;
|
|
9
|
+
target: Position;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* NodePackage 节点端口 position 的过渡手工映射。
|
|
13
|
+
*
|
|
14
|
+
* 字段说明:
|
|
15
|
+
* - source:source handle 在节点边框上的位置
|
|
16
|
+
* - target:target handle 在节点边框上的位置
|
|
17
|
+
*
|
|
18
|
+
* 优先级:`DipPortSchema.position` > `ACTION_KEY_HANDLE_LAYOUT` > 缺省 Left/Right。
|
|
19
|
+
* 后续 `DipPortSchema.position` 全量铺开后即可删除本表。
|
|
20
|
+
*/
|
|
21
|
+
export declare const ACTION_KEY_HANDLE_LAYOUT: Record<string, ActionKeyHandleLayout>;
|
|
22
|
+
/**
|
|
23
|
+
* 给定一个 ReactFlow 节点,返回它所有 source / target handle 的 `Position`。
|
|
24
|
+
*
|
|
25
|
+
* 数据源优先级:
|
|
26
|
+
* 1. NodePackage 节点 → `DipPortSchema.position` > `ACTION_KEY_HANDLE_LAYOUT` > 缺省 Left/Right
|
|
27
|
+
* 2. 经典节点 → `nodeTypeRegistry` 中的 legacy handles
|
|
28
|
+
* 3. 兜底:返回空数组
|
|
29
|
+
*
|
|
30
|
+
* 该函数只读、不发起网络请求;schema 缺失时按 schema 字段的 `position` → 映射表 → Left/Right 降级。
|
|
31
|
+
*/
|
|
32
|
+
export declare function getNodeHandlePositions(node: Node): NodeHandlePositions;
|
|
33
|
+
/**
|
|
34
|
+
* 节点是否参与垂直布局(子节点在父节点下方 / 上方)。
|
|
35
|
+
*
|
|
36
|
+
* 判定:节点的 source 或 target handle 中任一处于 Top/Bottom 即视为垂直。
|
|
37
|
+
*/
|
|
38
|
+
export declare function isVerticalLayoutNode(node: Node): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 节点是否参与水平布局(子节点在父节点右侧 / 左侧)。
|
|
41
|
+
*
|
|
42
|
+
* 判定:节点的 source 或 target handle 中任一处于 Left/Right 即视为水平。
|
|
43
|
+
*/
|
|
44
|
+
export declare function isHorizontalLayoutNode(node: Node): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 按边的 target handle 位置判定布局方向。
|
|
47
|
+
*
|
|
48
|
+
* 规则(与用户约定一致):
|
|
49
|
+
* - target handle 在 Bottom/Top → 'vertical'
|
|
50
|
+
* - target handle 在 Left/Right → 'horizontal'
|
|
51
|
+
* - 缺省 → null(调用方自行决定 fallback)
|
|
52
|
+
*/
|
|
53
|
+
export declare function getEdgeLayoutDirection(edge: Pick<Edge, 'source' | 'target' | 'sourceHandle' | 'targetHandle'>, sourceNode?: Node | null, targetNode?: Node | null): LayoutDirection | null;
|
|
54
|
+
/**
|
|
55
|
+
* 取边 source handle 在节点边框上的 `Position`(供连线风格 / 区间重叠判定使用)。
|
|
56
|
+
* 无 sourceHandle 时取第一个 source handle;找不到匹配时返回 undefined,调用方按水平处理。
|
|
57
|
+
*/
|
|
58
|
+
export declare function getEdgeSourcePosition(edge: Pick<Edge, 'sourceHandle'>, sourceNode: Node): Position | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* 节点是否拥有 Top 输入 handle,用于区分主流程节点与垂直子节点。
|
|
61
|
+
*
|
|
62
|
+
* 旧版用 `node.type === AI_SUB_NODE` 过滤;现在改为:节点的 target 中存在
|
|
63
|
+
* Top 入桩(典型 AI 子节点升级后通过 Bottom 入桩连接到父节点 ai_* 桩,但若
|
|
64
|
+
* 仍保留 Top 形态即可识别为"子节点")。
|
|
65
|
+
*/
|
|
66
|
+
export declare function hasTopInputHandle(node: Node): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* 节点是否拥有 Top source handle。
|
|
69
|
+
*
|
|
70
|
+
* 旧版 `calculateNodePosition` 用 `n.type !== AI_SUB_NODE` 过滤主流程节点;
|
|
71
|
+
* 现在等价语义改为:节点 source 不在 Top(说明它不向上输出,不会作为垂直子节点)。
|
|
72
|
+
*/
|
|
73
|
+
export declare function hasTopSourceHandle(node: Node): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* 节点是否属于某个父节点的垂直子布局(向上发送 → 自己即 child)。
|
|
76
|
+
*/
|
|
77
|
+
export declare function isVerticalLayoutChild(node: Node): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* 画布整体方向:按节点 source handle 的方向统计,少数服从多数。
|
|
80
|
+
* 缺省(无法判定或平票)走水平。
|
|
81
|
+
*/
|
|
82
|
+
export declare function inferCanvasDirection(nodes: Node[]): LayoutDirection;
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { DipNodeSchema } from '../api/dip';
|
|
2
|
+
import { PortConnectionEdge, PortConnectionValidationCode } from './portConnectionValidator';
|
|
3
|
+
import { Node } from '@xyflow/react';
|
|
4
|
+
export type NodePackageConnectionCode = PortConnectionValidationCode | 'NOT_APPLICABLE' | 'SCHEMA_NOT_READY';
|
|
5
|
+
export interface NodePackageConnectionResult {
|
|
6
|
+
applicable: boolean;
|
|
7
|
+
valid: boolean;
|
|
8
|
+
code: NodePackageConnectionCode;
|
|
9
|
+
reason: string;
|
|
10
|
+
missingSchemaNodeIds?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface ValidateNodePackageConnectionInput {
|
|
13
|
+
sourceNode?: Node | null;
|
|
14
|
+
targetNode?: Node | null;
|
|
15
|
+
sourceHandle?: string | null;
|
|
16
|
+
targetHandle?: string | null;
|
|
17
|
+
edges?: readonly PortConnectionEdge[];
|
|
18
|
+
}
|
|
19
|
+
/** 同步解析已预加载的 NodePackage Schema。 */
|
|
20
|
+
export declare function resolveNodePackageSchema(node?: Node | null): DipNodeSchema | null;
|
|
21
|
+
export declare function isNodePackageConnectionNode(node?: Node | null): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 校验两个 NodePackage 节点之间的端口连接。
|
|
24
|
+
*
|
|
25
|
+
* 混合 legacy/nodepackage 连接保留前端当前精确 handle 名称,并按后端虚拟端口契约
|
|
26
|
+
* 将 legacy 端口能力类型统一映射为 main。
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateNodePackageConnection({ sourceNode, targetNode, sourceHandle, targetHandle, edges, }: ValidateNodePackageConnectionInput): NodePackageConnectionResult;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PortConnectionValidationCode } from './portConnectionValidator';
|
|
2
|
+
import { Edge, Node } from '@xyflow/react';
|
|
3
|
+
export type NodePackageGraphIssueCode = PortConnectionValidationCode | 'REQUIRED_INPUT_MISSING' | 'SCHEMA_NOT_READY';
|
|
4
|
+
export interface NodePackageGraphIssue {
|
|
5
|
+
code: NodePackageGraphIssueCode;
|
|
6
|
+
reason: string;
|
|
7
|
+
blocking: boolean;
|
|
8
|
+
nodeId?: string;
|
|
9
|
+
portName?: string;
|
|
10
|
+
edgeId?: string;
|
|
11
|
+
sourceNodeId?: string;
|
|
12
|
+
targetNodeId?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface NodePackageGraphValidationResult {
|
|
15
|
+
valid: boolean;
|
|
16
|
+
issues: NodePackageGraphIssue[];
|
|
17
|
+
blockingIssues: NodePackageGraphIssue[];
|
|
18
|
+
missingSchemaNodeIds: string[];
|
|
19
|
+
}
|
|
20
|
+
interface ValidateNodePackageGraphInput {
|
|
21
|
+
nodes: readonly Node[];
|
|
22
|
+
edges: readonly Edge[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 保存前检查当前已知的 NodePackage 端口约束。
|
|
26
|
+
* Schema 尚未加载属于非阻塞 warning,最终交给 ACM 后端兜底;已知非法端口则阻止保存。
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateNodePackageGraph({ nodes, edges, }: ValidateNodePackageGraphInput): NodePackageGraphValidationResult;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DipNodeSchema, DipPortSchema } from '../api/dip';
|
|
2
|
+
export declare function clearNodePackageSchemaCache(): void;
|
|
3
|
+
export declare function setNodePackageSchemaCache(nodeKey: string, nodeVersion: number | undefined | null, schema: DipNodeSchema): void;
|
|
4
|
+
/**
|
|
5
|
+
* 同步读取已预加载的 NodePackage Schema,不触发网络请求。
|
|
6
|
+
*
|
|
7
|
+
* 手动拖线发生在 ReactFlow 的同步校验阶段,无法等待异步 Schema 请求;
|
|
8
|
+
* 因此画布加载/选择器转换阶段会先预热缓存,再由这里读取。
|
|
9
|
+
*/
|
|
10
|
+
export declare function peekNodePackageSchema(nodeKey: string, nodeVersion?: number): DipNodeSchema | null;
|
|
11
|
+
export declare function peekNodePackageSchemaByType(dynamicType: string): DipNodeSchema | null;
|
|
12
|
+
export declare function peekNodePackageSchemaHandleInfo(dynamicType: string, handleName: string): DipPortSchema | null;
|
|
13
|
+
export declare function peekSchemaHandleInfoByProtocol(dynamicType: string, protocol: string, isInput: boolean, preferredName?: string): DipPortSchema | null;
|
|
14
|
+
export declare function getNodePackageSchema(nodeKey: string, nodeVersion?: number): Promise<DipNodeSchema | null>;
|
|
15
|
+
export declare function getNodePackageSchemaByCache(nodeKey: string, nodeVersion?: number): DipNodeSchema | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Node } from '@xyflow/react';
|
|
2
|
+
/** 删除命中该列表的 Trigger 节点时,级联清空整张画布(删除所有其他节点) */
|
|
3
|
+
export declare const TRIGGER_CASCADE_CLEAR_KEYS: readonly string[];
|
|
4
|
+
/**
|
|
5
|
+
* 判断本次待删除节点中是否包含需要级联清空的 Trigger 节点。
|
|
6
|
+
* 若命中,返回画布上所有其他节点的 id,供调用方一并删除;否则返回空数组。
|
|
7
|
+
*/
|
|
8
|
+
export declare const onNodeRemoveHook: (nodes: Node[], nodeIds: string[]) => string[];
|
|
9
|
+
/**
|
|
10
|
+
* 判断本次手动删除的节点中是否包含 trigger 节点。
|
|
11
|
+
* 命中表示用户主动删除了画布触发节点,画布据此不再展示 NodePlaceholder。
|
|
12
|
+
*/
|
|
13
|
+
export declare const isManualTriggerDeletion: (nodes: Node[], nodeIds: string[]) => boolean;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Node } from '@xyflow/react';
|
|
2
|
+
type TriggerCandidate = Pick<Node, 'type'> & Partial<Pick<Node, 'data'>>;
|
|
3
|
+
/**
|
|
4
|
+
* 判断节点是否为 Trigger 节点。
|
|
5
|
+
*
|
|
6
|
+
* - 经典节点:type 固定为 StartEventNode
|
|
7
|
+
* - NodePackage 节点:判断与 nodeSchema 同级的 is_trigger 属性
|
|
8
|
+
* (is_trigger 为 true / 1 / '1' 视为触发节点,'0' / 0 / false 不视为)
|
|
9
|
+
*
|
|
10
|
+
* 一个画布最多只有一个 trigger 节点,因此画布级推导只需记录该节点信息即可。
|
|
11
|
+
*/
|
|
12
|
+
export declare const isTriggerNode: (node?: TriggerCandidate | null) => boolean;
|
|
13
|
+
export {};
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { EngineMode } from '../enums/workflow';
|
|
2
1
|
import { EdgeConfig, EdgeRulesConfig, NodeSelectorConnectableConfig } from '../types/engine';
|
|
3
2
|
import { Edge, IsValidConnection, Node } from '@xyflow/react';
|
|
4
3
|
interface ValidateWorkflowConnectionInput {
|
|
5
4
|
edge: EdgeConfig;
|
|
6
5
|
nodes: Node[];
|
|
7
6
|
edges: Edge[];
|
|
8
|
-
engineMode?: EngineMode;
|
|
9
7
|
connectable?: Pick<NodeSelectorConnectableConfig, 'enabled' | 'debug'>;
|
|
10
8
|
validators?: EdgeRulesConfig['validators'];
|
|
11
9
|
nativeIsValidConnection?: IsValidConnection;
|
|
@@ -16,5 +14,5 @@ interface ValidateWorkflowConnectionInput {
|
|
|
16
14
|
* 手动拖线与程序化新增都传入各自的节点/边快照,从而复用 NodePackage、MCP、
|
|
17
15
|
* 宿主 edgeRules 和 ReactFlow native validator。边中插入可由调用方先从快照移除旧边。
|
|
18
16
|
*/
|
|
19
|
-
export declare function validateWorkflowConnection({ edge, nodes, edges,
|
|
17
|
+
export declare function validateWorkflowConnection({ edge, nodes, edges, connectable, validators, nativeIsValidConnection, }: ValidateWorkflowConnectionInput): boolean;
|
|
20
18
|
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { WorkflowHttpClient } from './index';
|
|
2
|
+
export declare const DEMO_WORKFLOW_ID = "local-ai-flow-preview";
|
|
3
|
+
export declare const DEMO_CONFIG_NODE_ID = "send-notice";
|
|
4
|
+
export declare const DEMO_NODE_CATALOG_WORKFLOW_ID = "local-ai-flow-node-catalog";
|
|
5
|
+
export declare const DEMO_CLASSIC_FIELDS_WORKFLOW_ID = "local-ai-flow-classic-fields";
|
|
6
|
+
export declare const DEMO_CLASSIC_FIELDS_NODE_ID = "classic-fields-catalog";
|
|
7
|
+
export declare const DEMO_CONTROL_NODES_WORKFLOW_ID = "local-ai-flow-control-nodes";
|
|
8
|
+
export declare const DEMO_CONDITION_NODE_ID = "control-condition";
|
|
9
|
+
export declare const DEMO_SWITCH_NODE_ID = "control-switch";
|
|
10
|
+
export declare const DEMO_LOOP_NODE_ID = "control-loop";
|
|
11
|
+
export declare const DEMO_MCP_TOOL_NODE_ID = "control-mcp-tool";
|
|
12
|
+
export declare const DEMO_CREDENTIAL_WORKFLOW_ID = "local-ai-flow-credential";
|
|
13
|
+
export declare const DEMO_CREDENTIAL_NODE_ID = "credential-database-query";
|
|
14
|
+
type MockFlowNode = {
|
|
15
|
+
id: string;
|
|
16
|
+
n_id: string;
|
|
17
|
+
node_type: string;
|
|
18
|
+
action_name: string;
|
|
19
|
+
connector_name: string;
|
|
20
|
+
connector_id: string;
|
|
21
|
+
action_id: string;
|
|
22
|
+
description: string;
|
|
23
|
+
protocol: string;
|
|
24
|
+
status: string;
|
|
25
|
+
position: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
};
|
|
29
|
+
properties: Record<string, unknown>;
|
|
30
|
+
account_id?: string | null;
|
|
31
|
+
account_schema_id?: string | number;
|
|
32
|
+
deployment_type?: string;
|
|
33
|
+
output?: unknown;
|
|
34
|
+
branches?: Array<{
|
|
35
|
+
id: string;
|
|
36
|
+
label: string;
|
|
37
|
+
}>;
|
|
38
|
+
note?: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const RUNTIME_NODE_CATALOG: MockFlowNode[];
|
|
42
|
+
/**
|
|
43
|
+
* 为 AI FLOW 源码验收页提供稳定的本地请求响应。
|
|
44
|
+
*
|
|
45
|
+
* @param url RCS 组件请求地址。
|
|
46
|
+
* @param options 请求方法与请求体。
|
|
47
|
+
* @returns 与线上接口形状一致的模拟数据。
|
|
48
|
+
*/
|
|
49
|
+
export declare const mockAiFlowHttpClient: WorkflowHttpClient;
|
|
50
|
+
export {};
|
|
@@ -11,40 +11,34 @@ export interface VariableInfo {
|
|
|
11
11
|
/** 图标 URL 或 React 节点 */
|
|
12
12
|
icon?: string | React.ReactNode;
|
|
13
13
|
}
|
|
14
|
-
export type ValueMode = 'normal' | 'expression' | 'code' | '
|
|
14
|
+
export type ValueMode = 'normal' | 'expression' | 'code' | 'formValue';
|
|
15
15
|
interface RegisteredField {
|
|
16
16
|
id: string;
|
|
17
17
|
insertVariable: (variable: string, formatted: boolean) => void;
|
|
18
18
|
focus: () => void;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
/** 会随焦点/可见性变化的状态;仅真正需要订阅的组件应使用 */
|
|
21
|
+
export interface VariableSelectorStateValue {
|
|
22
22
|
activeFieldId: string | null;
|
|
23
|
-
/** 变量选择器是否可见 */
|
|
24
23
|
selectorVisible: boolean;
|
|
25
|
-
/** 可用变量列表 */
|
|
26
24
|
availableVariables: VariableInfo[];
|
|
27
|
-
|
|
25
|
+
}
|
|
26
|
+
/** 稳定操作接口;VariableInput 只消费这份,避免焦点切换拖垮整树 Slate 重渲染 */
|
|
27
|
+
export interface VariableSelectorActionsValue {
|
|
28
28
|
registerField: (field: RegisteredField) => void;
|
|
29
|
-
/** 注销字段 */
|
|
30
29
|
unregisterField: (id: string) => void;
|
|
31
|
-
/** 激活字段(获得焦点时调用) */
|
|
32
30
|
activateField: (id: string) => void;
|
|
33
|
-
/** 取消激活 */
|
|
34
31
|
deactivateField: () => void;
|
|
35
|
-
/** 显示/隐藏变量选择器 */
|
|
36
32
|
setSelectorVisible: (visible: boolean) => void;
|
|
37
|
-
/** 插入变量到当前激活的字段 */
|
|
38
33
|
insertVariableToActiveField: (variable: string, wrapWithBraces?: boolean) => void;
|
|
39
|
-
/** 设置可用变量列表 */
|
|
40
34
|
setAvailableVariables: (variables: VariableInfo[]) => void;
|
|
41
|
-
/** 验证变量是否有效 */
|
|
42
35
|
validateVariable: (variable: string) => boolean;
|
|
43
|
-
/** 格式化变量为 {{variable}} 格式 */
|
|
44
36
|
formatVariable: (variable: string) => string;
|
|
45
|
-
/** 从格式化字符串中提取变量 */
|
|
46
37
|
extractVariable: (formatted: string) => string | null;
|
|
38
|
+
/** 读取当前激活字段(不触发订阅,供桥接插入使用) */
|
|
39
|
+
getActiveFieldId: () => string | null;
|
|
47
40
|
}
|
|
41
|
+
export type VariableSelectorContextValue = VariableSelectorStateValue & VariableSelectorActionsValue;
|
|
48
42
|
export interface VariableSelectorProviderProps {
|
|
49
43
|
children: React.ReactNode;
|
|
50
44
|
/** 初始可用变量列表 */
|
|
@@ -57,11 +51,18 @@ export interface VariableSelectorProviderProps {
|
|
|
57
51
|
onValidateVariable?: (variable: string) => boolean;
|
|
58
52
|
}
|
|
59
53
|
export declare const VariableSelectorProvider: React.FC<VariableSelectorProviderProps>;
|
|
54
|
+
/** 完整读写(状态 + 操作)。焦点切换时会重渲染,仅桥接/面板使用 */
|
|
60
55
|
export declare const useVariableSelector: () => VariableSelectorContextValue;
|
|
56
|
+
/**
|
|
57
|
+
* 注册字段:只订阅稳定 Actions,不因 activeFieldId 变化而重渲染。
|
|
58
|
+
* 这是创建账号弹窗内多个 Slate 与节点配置表单并存时避免假死的关键路径。
|
|
59
|
+
*/
|
|
61
60
|
export declare const useRegisterVariableField: (id: string, insertVariable: (variable: string, formatted: boolean) => void, focus: () => void) => {
|
|
62
61
|
activate: () => void;
|
|
63
62
|
deactivate: () => void;
|
|
64
|
-
isActive: boolean;
|
|
65
63
|
};
|
|
64
|
+
/** 仅订阅稳定操作,不因焦点切换重渲染 */
|
|
65
|
+
export declare const useVariableSelectorActionsOptional: () => VariableSelectorActionsValue | null;
|
|
66
|
+
/** 可选订阅:同时拿状态与操作;无 Provider 时返回 null */
|
|
66
67
|
export declare const useVariableSelectorOptional: () => VariableSelectorContextValue | null;
|
|
67
68
|
export {};
|
|
@@ -4,7 +4,7 @@ export { type SelectValueMode, SelectWithExpression, type SelectWithExpressionPr
|
|
|
4
4
|
export { useValueModePolicyOptional, type ValueMode, ValueModeFieldScope, ValueModePolicyScope, ValueModeSwitch, type ValueModeSwitchProps, ValueModeWrapper, type ValueModeWrapperProps, withInheritedValueModePolicy, } from './components/ValueModeWrapper';
|
|
5
5
|
export { VariableInput, type VariableInputProps, } from './components/VariableInput';
|
|
6
6
|
export { VariableTextarea, type VariableTextareaProps, } from './components/VariableTextarea';
|
|
7
|
-
export { useRegisterVariableField, useVariableSelector, useVariableSelectorOptional, type VariableInfo, type VariableSelectorContextValue, VariableSelectorProvider, type VariableSelectorProviderProps, } from './context/VariableSelectorContext';
|
|
7
|
+
export { useRegisterVariableField, useVariableSelector, useVariableSelectorActionsOptional, useVariableSelectorOptional, type VariableInfo, type VariableSelectorActionsValue, type VariableSelectorContextValue, VariableSelectorProvider, type VariableSelectorProviderProps, type VariableSelectorStateValue, } from './context/VariableSelectorContext';
|
|
8
8
|
export * from './DynamicForm';
|
|
9
9
|
export * from './DynamicFormContext';
|
|
10
10
|
export * from './FieldRenderer';
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { jsx as t, jsxs as v } from "react/jsx-runtime";
|
|
2
|
+
import { D as T, V as L, e as x, i as P, t as l, f as R, d as O } from "./index-zEq02rJh.mjs";
|
|
3
|
+
import { useEventEmitter as B, useReactive as W, useSize as A } from "ahooks";
|
|
4
|
+
import { FormattedMessage as I } from "react-intl";
|
|
5
|
+
import { CloseCircleFilled as H, CheckCircleFilled as K } from "@ant-design/icons";
|
|
6
|
+
import { Button as M } from "antd";
|
|
7
|
+
import * as z from "monaco-editor";
|
|
8
|
+
import { useRef as k, useEffect as N } from "react";
|
|
9
|
+
import { createPortal as q } from "react-dom";
|
|
10
|
+
import J from "react-monaco-editor";
|
|
11
|
+
const G = "_modalContainer_8inkd_5", Q = "_editorContainer_8inkd_16", U = "_sider_8inkd_25", X = "_main_8inkd_34", Y = "_header_8inkd_40", Z = "_editor_8inkd_16", w = {
|
|
12
|
+
modalContainer: G,
|
|
13
|
+
editorContainer: Q,
|
|
14
|
+
sider: U,
|
|
15
|
+
main: X,
|
|
16
|
+
header: Y,
|
|
17
|
+
editor: Z
|
|
18
|
+
}, ee = "_ideWrapper_sfar6_1", ne = {
|
|
19
|
+
ideWrapper: ee
|
|
20
|
+
}, te = (e) => {
|
|
21
|
+
const { nodeId: i, onInsert: o, open: c } = e, s = B();
|
|
22
|
+
return s.useSubscription((a) => {
|
|
23
|
+
a.type === "insert" && o(a.expression);
|
|
24
|
+
}), /* @__PURE__ */ t(T.Provider, { value: { event$: s }, children: /* @__PURE__ */ t("div", { className: ne.ideWrapper, children: /* @__PURE__ */ t(L, { nodeId: i, onInsert: o, open: c }) }) });
|
|
25
|
+
}, ie = "_siderContainer_fhkbn_1", oe = {
|
|
26
|
+
siderContainer: ie
|
|
27
|
+
};
|
|
28
|
+
function re(e) {
|
|
29
|
+
return /* @__PURE__ */ v("div", { className: oe.siderContainer, children: [
|
|
30
|
+
/* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(te, { open: e.open, nodeId: e.nodeId, onInsert: e.onInsert }) }),
|
|
31
|
+
/* @__PURE__ */ t("div", { style: { textAlign: "center" } })
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
function se({ language: e = "javascript" }) {
|
|
35
|
+
return /* @__PURE__ */ v("h2", { id: "workflow-online-ide-title", className: "workflow-online-ide-title", children: [
|
|
36
|
+
/* @__PURE__ */ t(I, { id: "link.flow.code_editor" }),
|
|
37
|
+
" (Javascript)"
|
|
38
|
+
] });
|
|
39
|
+
}
|
|
40
|
+
function ae(e) {
|
|
41
|
+
return /* @__PURE__ */ v("div", { className: "workflow-online-ide-toolbar", children: [
|
|
42
|
+
/* @__PURE__ */ t(M, { size: "small", onClick: e.onCancel, icon: /* @__PURE__ */ t(H, {}), children: /* @__PURE__ */ t(I, { id: "app.common.word.cancel" }) }),
|
|
43
|
+
/* @__PURE__ */ t(M, { type: "primary", size: "small", onClick: e.onFinish, icon: /* @__PURE__ */ t(K, {}), children: /* @__PURE__ */ t(I, { id: "app.common.word.finish" }) })
|
|
44
|
+
] });
|
|
45
|
+
}
|
|
46
|
+
const le = [{ trigger: "log", content: "console.log('$1');$2", desc: "输出日志" }, { trigger: "imp", content: "import $1 from '$2';$3" }, { trigger: "loop", content: `for (let $1=0; i< $2.length;i++) {
|
|
47
|
+
|
|
48
|
+
}`, desc: "循环操作" }], de = {
|
|
49
|
+
snippets: le
|
|
50
|
+
}, ce = {
|
|
51
|
+
selectOnLineNumbers: !0,
|
|
52
|
+
automaticLayout: !0,
|
|
53
|
+
padding: {
|
|
54
|
+
top: 10
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
function ue(e) {
|
|
58
|
+
if (e.type === "global")
|
|
59
|
+
return [
|
|
60
|
+
`**${l("link.flow.variable_type_global")}**`,
|
|
61
|
+
`${l("link.flow.variable_path")}:\`${e.value}\``,
|
|
62
|
+
`${l("link.flow.variable_name")}:\`${e.path}\``
|
|
63
|
+
].filter(Boolean).join(`
|
|
64
|
+
|
|
65
|
+
`);
|
|
66
|
+
if (e.type === "builtin") {
|
|
67
|
+
const i = R.getBuiltinVariableTips(e.firstPart);
|
|
68
|
+
return [
|
|
69
|
+
`**${l("link.flow.variable_type_builtin")}**`,
|
|
70
|
+
`${l("link.flow.variable_path")}:\`${e.value}\``,
|
|
71
|
+
i
|
|
72
|
+
].filter(Boolean).join(`
|
|
73
|
+
|
|
74
|
+
`);
|
|
75
|
+
}
|
|
76
|
+
return e.type === "node" ? [
|
|
77
|
+
`**${l("link.flow.variable_type_node")}**`,
|
|
78
|
+
`${l("link.flow.variable_path")}:\`${e.value}\``,
|
|
79
|
+
e.path ? `${l("link.flow.variable_field")}:\`${e.path}\`` : ""
|
|
80
|
+
].filter(Boolean).join(`
|
|
81
|
+
|
|
82
|
+
`) : [
|
|
83
|
+
`**${l("link.flow.variable_type_platform")}**`,
|
|
84
|
+
`${l("link.flow.variable_path")}:\`${e.value}\``
|
|
85
|
+
].join(`
|
|
86
|
+
|
|
87
|
+
`);
|
|
88
|
+
}
|
|
89
|
+
const ge = (e) => ({
|
|
90
|
+
code: e.code,
|
|
91
|
+
severity: e.severity,
|
|
92
|
+
message: e.message,
|
|
93
|
+
source: e.source,
|
|
94
|
+
startLineNumber: e.startLineNumber,
|
|
95
|
+
startColumn: e.startColumn,
|
|
96
|
+
endLineNumber: e.endLineNumber,
|
|
97
|
+
endColumn: e.endColumn,
|
|
98
|
+
modelVersionId: e.modelVersionId,
|
|
99
|
+
relatedInformation: e.relatedInformation,
|
|
100
|
+
tags: e.tags
|
|
101
|
+
});
|
|
102
|
+
function V(e, i) {
|
|
103
|
+
const o = x(i.getValue());
|
|
104
|
+
if (!o.length)
|
|
105
|
+
return;
|
|
106
|
+
const c = e.editor.getModelMarkers({ resource: i.uri }), s = /* @__PURE__ */ new Map();
|
|
107
|
+
c.forEach((a) => {
|
|
108
|
+
const d = s.get(a.owner) ?? [];
|
|
109
|
+
d.push(a), s.set(a.owner, d);
|
|
110
|
+
}), s.forEach((a, d) => {
|
|
111
|
+
const u = a.filter(
|
|
112
|
+
(g) => !o.some((b) => O(b, g))
|
|
113
|
+
);
|
|
114
|
+
u.length !== a.length && e.editor.setModelMarkers(i, d, u.map(ge));
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
function fe(e, i) {
|
|
118
|
+
const o = [].map((c) => ({
|
|
119
|
+
insertText: c,
|
|
120
|
+
kind: e.languages.CompletionItemKind.Function,
|
|
121
|
+
// 对应提示图标的不同
|
|
122
|
+
label: c
|
|
123
|
+
}));
|
|
124
|
+
return e.languages.registerCompletionItemProvider(i, {
|
|
125
|
+
provideCompletionItems() {
|
|
126
|
+
return {
|
|
127
|
+
suggestions: o
|
|
128
|
+
};
|
|
129
|
+
},
|
|
130
|
+
quickSuggestions: !0,
|
|
131
|
+
// 默认提示关闭
|
|
132
|
+
triggerCharacters: ["{", ".", "=", ":"]
|
|
133
|
+
// 触发提示的字符 可以定义多个
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function pe(e) {
|
|
137
|
+
return e.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
|
|
138
|
+
noSemanticValidation: !0,
|
|
139
|
+
noSyntaxValidation: !1
|
|
140
|
+
}), e.languages.typescript.javascriptDefaults.setCompilerOptions({
|
|
141
|
+
target: e.languages.typescript.ScriptTarget.ES2015,
|
|
142
|
+
allowNonTsExtensions: !0
|
|
143
|
+
}), e.languages.registerCompletionItemProvider("javascript", {
|
|
144
|
+
provideCompletionItems: () => ({
|
|
145
|
+
suggestions: de.snippets.map((o) => ({
|
|
146
|
+
label: o.trigger,
|
|
147
|
+
kind: e.languages.CompletionItemKind.Method,
|
|
148
|
+
detail: o.desc ?? "",
|
|
149
|
+
insertText: o.content,
|
|
150
|
+
insertTextRules: e.languages.CompletionItemInsertTextRule.InsertAsSnippet
|
|
151
|
+
}))
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function Ie(e) {
|
|
156
|
+
const { open: i, nodeId: o, initialValue: c, language: s = "javascript", showVariableSidebar: a = !0 } = e, d = k(null), u = k([]), g = W({
|
|
157
|
+
code: "",
|
|
158
|
+
range: new z.Range(1, 1, 1, 1)
|
|
159
|
+
}), b = (n, r) => {
|
|
160
|
+
n.onDidChangeCursorPosition((f) => {
|
|
161
|
+
const m = f.position, { lineNumber: p = 0, column: C = 0 } = m;
|
|
162
|
+
g.range = new r.Range(p, C, p, C);
|
|
163
|
+
}), d.current = n, n.focus(), g.code = n.getValue();
|
|
164
|
+
const j = r.languages.registerHoverProvider(s, {
|
|
165
|
+
provideHover: (f, m) => new Promise((p) => {
|
|
166
|
+
const h = x(f.getValue()).find(
|
|
167
|
+
(F) => P(F, m.lineNumber, m.column)
|
|
168
|
+
);
|
|
169
|
+
if (!h) {
|
|
170
|
+
p(null);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
p({
|
|
174
|
+
range: new r.Range(
|
|
175
|
+
h.startLine,
|
|
176
|
+
h.startColumn,
|
|
177
|
+
h.endLine,
|
|
178
|
+
h.endColumn
|
|
179
|
+
),
|
|
180
|
+
contents: [{ value: ue(h) }]
|
|
181
|
+
});
|
|
182
|
+
})
|
|
183
|
+
}), _ = n.getModel();
|
|
184
|
+
if (_) {
|
|
185
|
+
let f = !1;
|
|
186
|
+
const m = r.editor.onDidChangeMarkers((p) => {
|
|
187
|
+
f || !p.some((C) => C.toString() === _.uri.toString()) || (f = !0, window.setTimeout(() => {
|
|
188
|
+
try {
|
|
189
|
+
V(r, _);
|
|
190
|
+
} finally {
|
|
191
|
+
f = !1;
|
|
192
|
+
}
|
|
193
|
+
}, 0));
|
|
194
|
+
});
|
|
195
|
+
V(r, _), n.onDidDispose(() => m.dispose());
|
|
196
|
+
}
|
|
197
|
+
n.onDidDispose(() => j.dispose());
|
|
198
|
+
}, E = (n) => {
|
|
199
|
+
u.current.forEach((r) => {
|
|
200
|
+
r.dispose();
|
|
201
|
+
}), u.current = [fe(n, s)], s === "javascript" && u.current.push(pe(n));
|
|
202
|
+
};
|
|
203
|
+
N(
|
|
204
|
+
() => () => {
|
|
205
|
+
u.current.forEach((n) => {
|
|
206
|
+
n.dispose();
|
|
207
|
+
}), u.current = [];
|
|
208
|
+
},
|
|
209
|
+
[]
|
|
210
|
+
), N(() => {
|
|
211
|
+
if (!i)
|
|
212
|
+
return;
|
|
213
|
+
const n = (r) => {
|
|
214
|
+
r.key === "Escape" && (r.preventDefault(), e.onCancel());
|
|
215
|
+
};
|
|
216
|
+
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
217
|
+
}, [i, e.onCancel]);
|
|
218
|
+
const S = (n) => {
|
|
219
|
+
const r = [
|
|
220
|
+
{
|
|
221
|
+
range: g.range,
|
|
222
|
+
text: n,
|
|
223
|
+
forceMoveMarkers: !0
|
|
224
|
+
}
|
|
225
|
+
];
|
|
226
|
+
d.current && g.range && d.current.executeEdits("my-source", r);
|
|
227
|
+
}, $ = () => {
|
|
228
|
+
var n;
|
|
229
|
+
(n = e.onFinish) == null || n.call(e, g.code);
|
|
230
|
+
}, D = k(null), y = A(D);
|
|
231
|
+
return q(
|
|
232
|
+
/* @__PURE__ */ t(
|
|
233
|
+
"div",
|
|
234
|
+
{
|
|
235
|
+
className: w.modalContainer,
|
|
236
|
+
ref: D,
|
|
237
|
+
style: { display: i ? "flex" : "none" },
|
|
238
|
+
role: "dialog",
|
|
239
|
+
"aria-modal": "true",
|
|
240
|
+
"aria-labelledby": "workflow-online-ide-title",
|
|
241
|
+
children: /* @__PURE__ */ v("div", { className: w.editorContainer, id: "javascript-code-editor", children: [
|
|
242
|
+
a ? /* @__PURE__ */ t("div", { className: w.sider, children: /* @__PURE__ */ t(
|
|
243
|
+
re,
|
|
244
|
+
{
|
|
245
|
+
onCancel: e.onCancel,
|
|
246
|
+
onFinish: $,
|
|
247
|
+
editor: d.current,
|
|
248
|
+
nodeId: o,
|
|
249
|
+
open: i,
|
|
250
|
+
onInsert: S
|
|
251
|
+
}
|
|
252
|
+
) }) : null,
|
|
253
|
+
/* @__PURE__ */ v("div", { className: w.main, children: [
|
|
254
|
+
/* @__PURE__ */ v("div", { className: w.header, children: [
|
|
255
|
+
/* @__PURE__ */ t(se, { language: s }),
|
|
256
|
+
/* @__PURE__ */ t(ae, { onCancel: e.onCancel, onFinish: $ })
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ t("div", { className: w.editor, children: /* @__PURE__ */ t(
|
|
259
|
+
J,
|
|
260
|
+
{
|
|
261
|
+
width: "100%",
|
|
262
|
+
height: ((y == null ? void 0 : y.height) ?? 0) - 40,
|
|
263
|
+
language: s,
|
|
264
|
+
theme: "vs-dark",
|
|
265
|
+
value: c,
|
|
266
|
+
options: ce,
|
|
267
|
+
onChange: (n) => {
|
|
268
|
+
g.code = n;
|
|
269
|
+
},
|
|
270
|
+
editorWillMount: E,
|
|
271
|
+
editorDidMount: b
|
|
272
|
+
},
|
|
273
|
+
o
|
|
274
|
+
) })
|
|
275
|
+
] })
|
|
276
|
+
] })
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
document.body
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
export {
|
|
283
|
+
Ie as default
|
|
284
|
+
};
|
|
285
|
+
//# sourceMappingURL=index-CBoDAvhq.mjs.map
|