@huanban/rulego-editor-core 1.3.18 → 1.4.0
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 +153 -2
- package/assets/images/discovery-dark.svg +1 -0
- package/assets/images/discovery.svg +1 -0
- package/assets/images/nacos-dark.svg +1 -0
- package/assets/images/nacos.svg +1 -0
- package/assets/theme-icons/ant-blue/discovery-dark.svg +1 -0
- package/assets/theme-icons/ant-blue/discovery.svg +1 -0
- package/assets/theme-icons/ant-blue/nacos-dark.svg +1 -0
- package/assets/theme-icons/ant-blue/nacos.svg +1 -0
- package/assets/theme-icons/apple/discovery-dark.svg +1 -0
- package/assets/theme-icons/apple/discovery.svg +1 -0
- package/assets/theme-icons/apple/nacos-dark.svg +1 -0
- package/assets/theme-icons/apple/nacos.svg +1 -0
- package/assets/theme-icons/colorful/discovery-dark.svg +1 -0
- package/assets/theme-icons/colorful/discovery.svg +1 -0
- package/assets/theme-icons/colorful/nacos-dark.svg +1 -0
- package/assets/theme-icons/colorful/nacos.svg +1 -0
- package/assets/theme-icons/dark/discovery-dark.svg +1 -0
- package/assets/theme-icons/dark/discovery.svg +1 -0
- package/assets/theme-icons/dark/nacos-dark.svg +1 -0
- package/assets/theme-icons/dark/nacos.svg +1 -0
- package/assets/theme-icons/default/discovery-dark.svg +1 -0
- package/assets/theme-icons/default/discovery.svg +1 -0
- package/assets/theme-icons/default/nacos-dark.svg +1 -0
- package/assets/theme-icons/default/nacos.svg +1 -0
- package/assets/theme-icons/elegant/discovery-dark.svg +1 -0
- package/assets/theme-icons/elegant/discovery.svg +1 -0
- package/assets/theme-icons/elegant/nacos-dark.svg +1 -0
- package/assets/theme-icons/elegant/nacos.svg +1 -0
- package/assets/theme-icons/github/discovery-dark.svg +1 -0
- package/assets/theme-icons/github/discovery.svg +1 -0
- package/assets/theme-icons/github/nacos-dark.svg +1 -0
- package/assets/theme-icons/github/nacos.svg +1 -0
- package/assets/theme-icons/icon-theme-manifest.json +30 -14
- package/assets/theme-icons/icon-theme-overview.svg +1599 -1287
- package/assets/theme-icons/material/discovery-dark.svg +1 -0
- package/assets/theme-icons/material/discovery.svg +1 -0
- package/assets/theme-icons/material/nacos-dark.svg +1 -0
- package/assets/theme-icons/material/nacos.svg +1 -0
- package/assets/theme-icons/modern/discovery-dark.svg +1 -0
- package/assets/theme-icons/modern/discovery.svg +1 -0
- package/assets/theme-icons/modern/nacos-dark.svg +1 -0
- package/assets/theme-icons/modern/nacos.svg +1 -0
- package/assets/theme-icons/nature/discovery-dark.svg +1 -0
- package/assets/theme-icons/nature/discovery.svg +1 -0
- package/assets/theme-icons/nature/nacos-dark.svg +1 -0
- package/assets/theme-icons/nature/nacos.svg +1 -0
- package/assets/theme-icons/tailwind/discovery-dark.svg +1 -0
- package/assets/theme-icons/tailwind/discovery.svg +1 -0
- package/assets/theme-icons/tailwind/nacos-dark.svg +1 -0
- package/assets/theme-icons/tailwind/nacos.svg +1 -0
- package/assets/theme-icons/tech/discovery-dark.svg +1 -0
- package/assets/theme-icons/tech/discovery.svg +1 -0
- package/assets/theme-icons/tech/nacos-dark.svg +1 -0
- package/assets/theme-icons/tech/nacos.svg +1 -0
- package/assets/theme-icons/vscode/discovery-dark.svg +1 -0
- package/assets/theme-icons/vscode/discovery.svg +1 -0
- package/assets/theme-icons/vscode/nacos-dark.svg +1 -0
- package/assets/theme-icons/vscode/nacos.svg +1 -0
- package/dist/ai/copilot-markdown.d.ts +40 -0
- package/dist/ai/copilot-transport.d.ts +39 -0
- package/dist/api/AIManager.d.ts +5 -4
- package/dist/api/ApiProvider.d.ts +17 -69
- package/dist/api/ComponentCatalogCache.d.ts +27 -0
- package/dist/api/DebugSocketClient.d.ts +18 -25
- package/dist/api/RuleChainAPI.d.ts +24 -145
- package/dist/api/StreamParser.d.ts +0 -10
- package/dist/api/index.d.ts +4 -14
- package/dist/api/response-utils.d.ts +4 -22
- package/dist/api/types.d.ts +44 -179
- package/dist/chunks/editor-core-code-editor-CRki2wA_.js +512 -0
- package/dist/chunks/editor-core-default-components-BjF65lar.js +9448 -0
- package/dist/chunks/editor-core-dialogs-CkFLaC8Q.js +17176 -0
- package/dist/chunks/editor-core-icons-BqeFofNA.js +668 -0
- package/dist/chunks/editor-core-json-diff-RHsPeX-w.js +199 -0
- package/dist/chunks/editor-core-locales-i6o28vm2.js +4159 -0
- package/dist/chunks/editor-core-node-patches-BJTT3TuX.js +8060 -0
- package/dist/chunks/editor-core-node-views-BOaPVdmN.js +1288 -0
- package/dist/chunks/editor-core-property-drawers-lLsBIoCa.js +8035 -0
- package/dist/chunks/editor-core-standalone-CHXk3ukc.js +11270 -0
- package/dist/chunks/editor-core-styles-C1TbLgCK.js +8841 -0
- package/dist/chunks/vendor-logicflow-core-runtime-Cp6IBEjB.js +217 -0
- package/dist/chunks/vendor-logicflow-shared-C7YynLDn.js +4 -0
- package/dist/chunks/xlsx-BopDBbWb.js +24176 -0
- package/dist/core/ActionRegistry.d.ts +47 -0
- package/dist/core/AutoLayout.d.ts +1 -48
- package/dist/core/ComponentDocService.d.ts +28 -0
- package/dist/core/ComponentRegistry.d.ts +1 -125
- package/dist/core/DataAdapter.d.ts +4 -89
- package/dist/core/DiagnosticService.d.ts +15 -0
- package/dist/core/EditorCore.d.ts +22 -212
- package/dist/core/EditorWorkspace.d.ts +111 -0
- package/dist/core/EventBus.d.ts +0 -86
- package/dist/core/ExplorerTreeStore.d.ts +43 -0
- package/dist/core/FieldCapabilityRegistry.d.ts +16 -0
- package/dist/core/FieldChangeRegistry.d.ts +48 -0
- package/dist/core/HistoryManager.d.ts +0 -123
- package/dist/core/I18nManager.d.ts +0 -120
- package/dist/core/Optimizations.d.ts +0 -14
- package/dist/core/OptionSourceRegistry.d.ts +38 -0
- package/dist/core/RuleChainChatManager.d.ts +0 -37
- package/dist/core/RuleChainValidator.d.ts +0 -79
- package/dist/core/StateStore.d.ts +4 -140
- package/dist/core/ThemeManager.d.ts +0 -141
- package/dist/core/ValidationEngine.d.ts +0 -103
- package/dist/core/component-palette.d.ts +20 -0
- package/dist/core/component-payload.d.ts +0 -9
- package/dist/core/connection-status.d.ts +77 -0
- package/dist/core/context-menu-position.d.ts +27 -0
- package/dist/core/cron-schedule.d.ts +85 -0
- package/dist/core/debug-panel.d.ts +6 -0
- package/dist/core/editor-capabilities.d.ts +95 -0
- package/dist/core/editor-dock.d.ts +100 -0
- package/dist/core/editor-panel.d.ts +68 -0
- package/dist/core/explorer-tree.d.ts +27 -0
- package/dist/core/field-protocol.d.ts +32 -0
- package/dist/core/foundation-tokens.d.ts +38 -0
- package/dist/core/graph-operations.d.ts +34 -0
- package/dist/core/hover-tools.d.ts +26 -0
- package/dist/core/index.d.ts +68 -16
- package/dist/core/infer-run-input.d.ts +11 -0
- package/dist/core/key-value-editor.d.ts +6 -0
- package/dist/core/overlay-layers.d.ts +28 -0
- package/dist/core/recent-components.d.ts +51 -0
- package/dist/core/run-guard.d.ts +7 -0
- package/dist/core/runtime-field-dictionary.d.ts +68 -0
- package/dist/core/runtime-limits.d.ts +0 -5
- package/dist/core/save-conflict.d.ts +4 -0
- package/dist/core/server-status.d.ts +34 -0
- package/dist/core/simple-array.d.ts +4 -0
- package/dist/core/table-protocol.d.ts +36 -0
- package/dist/core/table-spreadsheet.d.ts +3 -0
- package/dist/core/test-cases.d.ts +54 -0
- package/dist/core/toolbar-icons.d.ts +4 -0
- package/dist/core/topology-rules.d.ts +17 -0
- package/dist/core/virtual-window.d.ts +20 -0
- package/dist/core/workspace-tab-actions.d.ts +13 -0
- package/dist/defaults/components.d.ts +0 -9
- package/dist/defaults/index.d.ts +0 -15
- package/dist/defaults/locale-en-US.d.ts +0 -24
- package/dist/defaults/locale-zh-CN.d.ts +0 -39
- package/dist/defaults/official-component-fallbacks.d.ts +0 -8
- package/dist/extensions/ClipboardExtension.d.ts +0 -23
- package/dist/extensions/KeyboardExtension.d.ts +0 -17
- package/dist/extensions/MenuExtension.d.ts +0 -23
- package/dist/iconRegistry.d.ts +0 -22
- package/dist/index.cjs +11320 -0
- package/dist/index.d.ts +25 -47
- package/dist/index.esm.js +1123 -99614
- package/dist/index.umd.js +3380 -1471
- package/dist/models/BaseNodeModel.d.ts +0 -32
- package/dist/models/index.d.ts +0 -1
- package/dist/nodes/AgentOrchestrationNode.d.ts +0 -24
- package/dist/nodes/GroupNode.d.ts +0 -38
- package/dist/nodes/HeadlessHtmlNode.d.ts +0 -16
- package/dist/nodes/SwitchNode.d.ts +0 -22
- package/dist/nodes/UnknownNodeModel.d.ts +0 -19
- package/dist/standalone/HuanbanRulegoEditor.d.ts +202 -401
- package/dist/standalone/ai-model-policy.d.ts +0 -1
- package/dist/standalone/ai-providers.d.ts +0 -1
- package/dist/standalone/auth-fetch.d.ts +2 -46
- package/dist/standalone/browser-assets.d.ts +0 -8
- package/dist/standalone/canvas-view.d.ts +6 -0
- package/dist/standalone/code-editor-language-loaders.d.ts +2 -0
- package/dist/standalone/code-editor-language-loaders.legacy.d.ts +7 -0
- package/dist/standalone/code-editor.d.ts +3 -87
- package/dist/standalone/connection-status-binding.d.ts +8 -0
- package/dist/standalone/custom-nodes.d.ts +0 -26
- package/dist/standalone/drawer-unsaved-guard.d.ts +2 -9
- package/dist/standalone/edge-label-quick-editor.d.ts +2 -0
- package/dist/standalone/editor-actions.d.ts +4 -0
- package/dist/standalone/editor-chain-info.d.ts +5 -38
- package/dist/standalone/editor-context-menu.d.ts +0 -21
- package/dist/standalone/editor-debug-ws.d.ts +37 -145
- package/dist/standalone/editor-delete.d.ts +0 -1
- package/dist/standalone/editor-dialogs.d.ts +16 -66
- package/dist/standalone/editor-events.d.ts +0 -27
- package/dist/standalone/editor-overlays.d.ts +14 -0
- package/dist/standalone/editor-property-drawers.d.ts +13 -71
- package/dist/standalone/editor-route-settings.d.ts +7 -55
- package/dist/standalone/editor-sidebar.d.ts +0 -18
- package/dist/standalone/editor-styles.d.ts +0 -11
- package/dist/standalone/editor-toast.d.ts +1 -2
- package/dist/standalone/editor-toolbar.d.ts +5 -80
- package/dist/standalone/editor-tour.d.ts +7 -0
- package/dist/standalone/editor-trace-overlay.d.ts +0 -5
- package/dist/standalone/full-json-dialog.d.ts +5 -1
- package/dist/standalone/group-node.d.ts +1 -51
- package/dist/standalone/icon-utils.d.ts +0 -20
- package/dist/standalone/index.d.ts +10 -7
- package/dist/standalone/json-diff.d.ts +0 -1
- package/dist/standalone/keyboard-events.d.ts +0 -1
- package/dist/standalone/layout-scheduler.d.ts +0 -6
- package/dist/standalone/lifecycle.d.ts +0 -5
- package/dist/standalone/logger.d.ts +0 -32
- package/dist/standalone/models-dev-catalog.d.ts +0 -1
- package/dist/standalone/node-copy.d.ts +7 -4
- package/dist/standalone/node-definitions.d.ts +0 -63
- package/dist/standalone/node-identity.d.ts +0 -1
- package/dist/standalone/node-theme.d.ts +8 -0
- package/dist/standalone/node-views-data.d.ts +0 -20
- package/dist/standalone/official-node-view-patches.d.ts +1 -14
- package/dist/standalone/outline-style.d.ts +7 -0
- package/dist/standalone/run-history-format.d.ts +0 -1
- package/dist/standalone/security-utils.d.ts +1 -5
- package/dist/standalone/shared-node-manager.d.ts +31 -0
- package/dist/standalone/themes.d.ts +0 -48
- package/dist/tools/tool-editor.d.ts +0 -1
- package/dist/types/component.d.ts +105 -87
- package/dist/types/editor.d.ts +16 -169
- package/dist/types/events.d.ts +30 -107
- package/dist/types/index.d.ts +3 -10
- package/dist/types/rule-chain.d.ts +0 -90
- package/dist/utils/GraphUtils.d.ts +0 -10
- package/dist/utils/helpers.d.ts +0 -80
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/pinyin-search.d.ts +0 -57
- package/dist/utils/relation-utils.d.ts +0 -1
- package/dist/utils/textUtils.d.ts +0 -12
- package/dist/version.d.ts +2 -3
- package/dist/xlsx-qn1xoUuv.cjs +105 -0
- package/package.json +19 -5
- package/vite-chunks.d.ts +11 -0
- package/vite-chunks.mjs +120 -0
- package/dist/index.cjs.js +0 -9515
|
@@ -1,175 +1,34 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file core/ThemeManager.ts
|
|
3
|
-
* @description 主题管理器 — 支持多主题动态切换
|
|
4
|
-
*
|
|
5
|
-
* 基于 CSS 自定义属性 (CSS Variables) 实现运行时主题切换,
|
|
6
|
-
* 无需重新加载页面或重新编译样式。
|
|
7
|
-
*
|
|
8
|
-
* 核心设计:
|
|
9
|
-
* - 所有样式值都通过 CSS 变量定义 (如 --rg-bg-primary)
|
|
10
|
-
* - 切换主题 = 批量更新 CSS 变量值
|
|
11
|
-
* - 支持自定义主题注册 (只需提供变量映射)
|
|
12
|
-
* - 自动检测系统深色模式偏好
|
|
13
|
-
*
|
|
14
|
-
* 内置主题:
|
|
15
|
-
* - light: 明亮主题 (默认) — 清爽专业
|
|
16
|
-
* - dark: 暗色主题 — 护眼模式
|
|
17
|
-
* - blue: 蓝色主题 — 科技感
|
|
18
|
-
*
|
|
19
|
-
* 使用方式:
|
|
20
|
-
* ```typescript
|
|
21
|
-
* import { ThemeManager } from '@huanban/rulego-editor-core'
|
|
22
|
-
*
|
|
23
|
-
* const theme = new ThemeManager()
|
|
24
|
-
*
|
|
25
|
-
* // 切换到暗色主题
|
|
26
|
-
* theme.setTheme('dark')
|
|
27
|
-
*
|
|
28
|
-
* // 注册自定义主题
|
|
29
|
-
* theme.register('ocean', {
|
|
30
|
-
* '--rg-bg-primary': '#0a192f',
|
|
31
|
-
* '--rg-text-primary': '#ccd6f6',
|
|
32
|
-
* // ...更多变量
|
|
33
|
-
* })
|
|
34
|
-
*
|
|
35
|
-
* // 跟随系统主题
|
|
36
|
-
* theme.followSystem()
|
|
37
|
-
*
|
|
38
|
-
* // 监听主题变更
|
|
39
|
-
* theme.onChange((themeName) => {
|
|
40
|
-
* console.log('主题切换为:', themeName)
|
|
41
|
-
* })
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
44
|
-
* CSS 变量命名规范:
|
|
45
|
-
* - --rg-bg-* : 背景色
|
|
46
|
-
* - --rg-text-* : 文字色
|
|
47
|
-
* - --rg-border-*: 边框色
|
|
48
|
-
* - --rg-shadow-*: 阴影
|
|
49
|
-
* - --rg-node-* : 节点专用 (按分类)
|
|
50
|
-
* - --rg-edge-* : 连接线专用
|
|
51
|
-
* - --rg-ui-* : UI 组件 (按钮、面板等)
|
|
52
|
-
*
|
|
53
|
-
* @see styles/variables.css 完整的 CSS 变量列表
|
|
54
|
-
*/
|
|
55
|
-
/**
|
|
56
|
-
* 主题变量映射
|
|
57
|
-
* key: CSS 变量名 (如 '--rg-bg-primary')
|
|
58
|
-
* value: 对应的值 (如 '#ffffff')
|
|
59
|
-
*/
|
|
60
1
|
export type ThemeVariables = Record<string, string>;
|
|
61
|
-
/**
|
|
62
|
-
* 主题定义
|
|
63
|
-
*/
|
|
64
2
|
export interface ThemeDefinition {
|
|
65
|
-
/** 主题名称 */
|
|
66
3
|
name: string;
|
|
67
|
-
/** 显示标签 */
|
|
68
4
|
label: string;
|
|
69
|
-
/** 是否为暗色主题 (影响 data-theme 属性) */
|
|
70
5
|
isDark: boolean;
|
|
71
|
-
/** CSS 变量映射 */
|
|
72
6
|
variables: ThemeVariables;
|
|
73
7
|
}
|
|
74
|
-
/** 主题变更回调 */
|
|
75
8
|
type ThemeChangeCallback = (themeName: string, isDark: boolean) => void;
|
|
76
|
-
/**
|
|
77
|
-
* 主题管理器
|
|
78
|
-
*
|
|
79
|
-
* 通过修改容器元素的 CSS 自定义属性实现主题切换。
|
|
80
|
-
* 每套主题定义一组 CSS 变量值, 切换时批量更新。
|
|
81
|
-
*/
|
|
82
9
|
export declare class ThemeManager {
|
|
83
|
-
/** 已注册的主题 */
|
|
84
10
|
private themes;
|
|
85
|
-
/** 当前主题名 */
|
|
86
11
|
private currentTheme;
|
|
87
|
-
/** CSS 变量挂载的目标元素 (默认: document.documentElement) */
|
|
88
12
|
private targetElement;
|
|
89
|
-
/** 变更回调 */
|
|
90
13
|
private changeCallbacks;
|
|
91
|
-
/** 系统主题监听器 */
|
|
92
14
|
private systemThemeQuery;
|
|
93
|
-
/** 系统主题监听处理函数 */
|
|
94
15
|
private systemThemeHandler;
|
|
95
16
|
constructor();
|
|
96
|
-
/**
|
|
97
|
-
* 注册主题
|
|
98
|
-
*
|
|
99
|
-
* @param theme - 主题定义
|
|
100
|
-
* @param overwrite - 是否覆盖已有同名主题 (默认: true)
|
|
101
|
-
*/
|
|
102
17
|
register(theme: ThemeDefinition, overwrite?: boolean): void;
|
|
103
|
-
/**
|
|
104
|
-
* 切换主题
|
|
105
|
-
*
|
|
106
|
-
* @param name - 主题名称
|
|
107
|
-
* @param container - CSS 变量挂载的容器元素 (可选, 默认 document.documentElement)
|
|
108
|
-
*/
|
|
109
18
|
setTheme(name: string, container?: HTMLElement): void;
|
|
110
|
-
/**
|
|
111
|
-
* 获取当前主题名称
|
|
112
|
-
*/
|
|
113
19
|
getTheme(): string;
|
|
114
|
-
/**
|
|
115
|
-
* 获取当前主题定义
|
|
116
|
-
*/
|
|
117
20
|
getThemeDefinition(): ThemeDefinition | undefined;
|
|
118
|
-
/**
|
|
119
|
-
* 获取所有可用主题
|
|
120
|
-
*/
|
|
121
21
|
getAvailableThemes(): Array<{
|
|
122
22
|
name: string;
|
|
123
23
|
label: string;
|
|
124
24
|
isDark: boolean;
|
|
125
25
|
}>;
|
|
126
|
-
/**
|
|
127
|
-
* 跟随系统主题 (自动检测深色/浅色模式)
|
|
128
|
-
*
|
|
129
|
-
* - 系统为深色模式 → 使用 'dark' 主题
|
|
130
|
-
* - 系统为浅色模式 → 使用 'light' 主题
|
|
131
|
-
*
|
|
132
|
-
* @param darkTheme - 深色模式使用的主题名 (默认: 'dark')
|
|
133
|
-
* @param lightTheme - 浅色模式使用的主题名 (默认: 'light')
|
|
134
|
-
*/
|
|
135
26
|
followSystem(darkTheme?: string, lightTheme?: string): void;
|
|
136
|
-
/**
|
|
137
|
-
* 停止跟随系统主题
|
|
138
|
-
*/
|
|
139
27
|
unfollowSystem(): void;
|
|
140
|
-
/**
|
|
141
|
-
* 监听主题变更
|
|
142
|
-
*
|
|
143
|
-
* @param callback - 变更回调 (themeName, isDark)
|
|
144
|
-
* @returns 取消监听函数
|
|
145
|
-
*/
|
|
146
28
|
onChange(callback: ThemeChangeCallback): () => void;
|
|
147
|
-
/**
|
|
148
|
-
* 销毁主题管理器
|
|
149
|
-
*/
|
|
150
29
|
destroy(): void;
|
|
151
30
|
}
|
|
152
|
-
/**
|
|
153
|
-
* 基础 CSS 变量列表 (所有主题共用的变量名)
|
|
154
|
-
* 每套主题只需要覆盖这些变量的值
|
|
155
|
-
*/
|
|
156
|
-
/**
|
|
157
|
-
* 🌤 明亮主题 (默认)
|
|
158
|
-
* 设计风格: 清爽、专业、高对比度
|
|
159
|
-
* 适合: 日间使用、正式场合、打印
|
|
160
|
-
*/
|
|
161
31
|
export declare const THEME_LIGHT: ThemeDefinition;
|
|
162
|
-
/**
|
|
163
|
-
* 🌙 暗色主题
|
|
164
|
-
* 设计风格: 深邃、护眼、高级感
|
|
165
|
-
* 适合: 夜间使用、长时间工作
|
|
166
|
-
*/
|
|
167
32
|
export declare const THEME_DARK: ThemeDefinition;
|
|
168
|
-
/**
|
|
169
|
-
* 🔵 蓝色科技主题
|
|
170
|
-
* 设计风格: 科技感、IoT 风格、专业
|
|
171
|
-
* 适合: 物联网控制台、监控场景、技术演示
|
|
172
|
-
*/
|
|
173
33
|
export declare const THEME_BLUE: ThemeDefinition;
|
|
174
34
|
export {};
|
|
175
|
-
//# sourceMappingURL=ThemeManager.d.ts.map
|
|
@@ -1,139 +1,36 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file ValidationEngine.ts
|
|
3
|
-
* @description 图验证引擎 — 验证规则链的合法性
|
|
4
|
-
*
|
|
5
|
-
* 提供可扩展的验证规则系统:
|
|
6
|
-
* - 内置验证规则 (孤立节点检测、起始连接检查等)
|
|
7
|
-
* - 自定义验证规则注册
|
|
8
|
-
* - 保存前自动验证
|
|
9
|
-
*
|
|
10
|
-
* 验证结果包含错误列表,每个错误关联到具体的节点或边,
|
|
11
|
-
* 方便 UI 层高亮显示问题元素。
|
|
12
|
-
*/
|
|
13
1
|
import type { LFGraphData } from './DataAdapter';
|
|
14
|
-
/**
|
|
15
|
-
* 验证错误
|
|
16
|
-
*/
|
|
17
2
|
export interface ValidationError {
|
|
18
|
-
/** 规则名称 */
|
|
19
3
|
rule: string;
|
|
20
|
-
/** 错误级别 */
|
|
21
4
|
level: 'error' | 'warning' | 'info';
|
|
22
|
-
/** 错误消息 */
|
|
23
5
|
message: string;
|
|
24
|
-
/** 关联的元素 ID (节点或边) */
|
|
25
6
|
elementId?: string;
|
|
26
|
-
/** 关联的元素类型 */
|
|
27
7
|
elementType?: 'node' | 'edge';
|
|
28
8
|
}
|
|
29
|
-
/**
|
|
30
|
-
* 验证结果
|
|
31
|
-
*/
|
|
32
9
|
export interface ValidationResult {
|
|
33
|
-
/** 是否验证通过 (无 error 级别错误) */
|
|
34
10
|
valid: boolean;
|
|
35
|
-
/** 错误列表 */
|
|
36
11
|
errors: ValidationError[];
|
|
37
|
-
/** 警告列表 */
|
|
38
12
|
warnings: ValidationError[];
|
|
39
13
|
}
|
|
40
|
-
/**
|
|
41
|
-
* 验证规则接口
|
|
42
|
-
*/
|
|
43
14
|
export interface ValidationRule {
|
|
44
|
-
/** 规则名称 (唯一标识) */
|
|
45
15
|
name: string;
|
|
46
|
-
/** 规则描述 */
|
|
47
16
|
description?: string;
|
|
48
|
-
/** 是否启用 (默认: true) */
|
|
49
17
|
enabled?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* 验证函数
|
|
52
|
-
*
|
|
53
|
-
* @param graphData - LogicFlow 图数据
|
|
54
|
-
* @param context - 验证上下文 (包含内部配置)
|
|
55
|
-
* @returns 验证错误列表
|
|
56
|
-
*/
|
|
57
18
|
validate(graphData: LFGraphData, context: ValidationContext): ValidationError[];
|
|
58
19
|
}
|
|
59
|
-
/**
|
|
60
|
-
* 验证上下文 (传递给验证规则的额外信息)
|
|
61
|
-
*/
|
|
62
20
|
export interface ValidationContext {
|
|
63
|
-
/** 起始节点 ID */
|
|
64
21
|
startNodeId: string;
|
|
65
22
|
}
|
|
66
|
-
/**
|
|
67
|
-
* 图验证引擎
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* ```typescript
|
|
71
|
-
* const engine = new ValidationEngine()
|
|
72
|
-
*
|
|
73
|
-
* // 使用内置规则
|
|
74
|
-
* engine.registerBuiltinRules()
|
|
75
|
-
*
|
|
76
|
-
* // 添加自定义规则
|
|
77
|
-
* engine.register({
|
|
78
|
-
* name: 'max-nodes',
|
|
79
|
-
* validate(data) {
|
|
80
|
-
* if (data.nodes.length > 100) {
|
|
81
|
-
* return [{ rule: 'max-nodes', level: 'warning', message: '节点数超过100' }]
|
|
82
|
-
* }
|
|
83
|
-
* return []
|
|
84
|
-
* }
|
|
85
|
-
* })
|
|
86
|
-
*
|
|
87
|
-
* // 执行验证
|
|
88
|
-
* const result = engine.validate(graphData, { startNodeId: '$node_start_input' })
|
|
89
|
-
* if (!result.valid) {
|
|
90
|
-
* console.error('验证失败:', result.errors)
|
|
91
|
-
* }
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
23
|
export declare class ValidationEngine {
|
|
95
|
-
/** 已注册的验证规则 */
|
|
96
24
|
private rules;
|
|
97
|
-
/**
|
|
98
|
-
* 注册验证规则
|
|
99
|
-
*
|
|
100
|
-
* @param rule - 验证规则
|
|
101
|
-
* @param overwrite - 是否覆盖同名规则 (默认: true)
|
|
102
|
-
*/
|
|
103
25
|
register(rule: ValidationRule, overwrite?: boolean): void;
|
|
104
|
-
/**
|
|
105
|
-
* 注销验证规则
|
|
106
|
-
*
|
|
107
|
-
* @param name - 规则名称
|
|
108
|
-
*/
|
|
109
26
|
unregister(name: string): void;
|
|
110
|
-
/**
|
|
111
|
-
* 启用/禁用指定规则
|
|
112
|
-
*/
|
|
113
27
|
setEnabled(name: string, enabled: boolean): void;
|
|
114
|
-
/**
|
|
115
|
-
* 注册所有内置验证规则
|
|
116
|
-
*/
|
|
117
28
|
registerBuiltinRules(): void;
|
|
118
|
-
/**
|
|
119
|
-
* 执行验证
|
|
120
|
-
*
|
|
121
|
-
* @param graphData - LogicFlow 图数据
|
|
122
|
-
* @param context - 验证上下文
|
|
123
|
-
* @returns 验证结果
|
|
124
|
-
*/
|
|
125
29
|
validate(graphData: LFGraphData, context: ValidationContext): ValidationResult;
|
|
126
|
-
/**
|
|
127
|
-
* 获取所有已注册规则的信息
|
|
128
|
-
*/
|
|
129
30
|
getRules(): Array<{
|
|
130
31
|
name: string;
|
|
131
32
|
description?: string;
|
|
132
33
|
enabled: boolean;
|
|
133
34
|
}>;
|
|
134
|
-
/**
|
|
135
|
-
* 清空所有规则
|
|
136
|
-
*/
|
|
137
35
|
clear(): void;
|
|
138
36
|
}
|
|
139
|
-
//# sourceMappingURL=ValidationEngine.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ComponentDefinition, ComponentGroup } from '../types/component';
|
|
2
|
+
export declare const DEFAULT_COMPONENT_CATEGORY_ORDER: readonly string[];
|
|
3
|
+
export interface ComponentPaletteSubgroup {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
order?: number;
|
|
8
|
+
components: ComponentDefinition[];
|
|
9
|
+
}
|
|
10
|
+
export interface ComponentPaletteGroup extends ComponentGroup {
|
|
11
|
+
subgroups: ComponentPaletteSubgroup[];
|
|
12
|
+
}
|
|
13
|
+
export interface ComponentPaletteBuildOptions {
|
|
14
|
+
categoryOrder?: readonly string[];
|
|
15
|
+
categoryLabel?: (category: string, components: ComponentDefinition[]) => string | undefined;
|
|
16
|
+
subgroupLabel?: (category: string, subgroup: string, components: ComponentDefinition[]) => string | undefined;
|
|
17
|
+
componentSearchText?: (component: ComponentDefinition) => string | string[] | undefined;
|
|
18
|
+
}
|
|
19
|
+
export declare function normalizeComponentCategory(component: ComponentDefinition): ComponentDefinition;
|
|
20
|
+
export declare function buildComponentPalette(components: ComponentDefinition[], query?: string, options?: ComponentPaletteBuildOptions): ComponentPaletteGroup[];
|
|
@@ -1,12 +1,3 @@
|
|
|
1
1
|
import type { ComponentDefinition } from '../types/component';
|
|
2
|
-
/**
|
|
3
|
-
* Normalize common RuleGo /api/v1/components payload wrappers without losing
|
|
4
|
-
* builtin metadata such as builtins and skillPath.
|
|
5
|
-
*/
|
|
6
2
|
export declare function normalizeComponentsRawPayload(data: unknown): unknown;
|
|
7
|
-
/**
|
|
8
|
-
* Flatten official segmented component payloads into the component list used by
|
|
9
|
-
* the registry and sidebar. Legacy arrays are returned unchanged.
|
|
10
|
-
*/
|
|
11
3
|
export declare function normalizeComponentsPayload(data: unknown): ComponentDefinition[];
|
|
12
|
-
//# sourceMappingURL=component-payload.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export type NodeConnectionState = 'none' | 'connected' | 'reconnecting' | 'disconnected' | 'error' | 'unknown';
|
|
2
|
+
export interface NodeConnectionStatus {
|
|
3
|
+
status: NodeConnectionState;
|
|
4
|
+
message?: string;
|
|
5
|
+
}
|
|
6
|
+
export type ConnectionStatusMap = Readonly<Record<string, Readonly<NodeConnectionStatus>>>;
|
|
7
|
+
export type ConnectionStatusPhase = 'idle' | 'loading' | 'ready' | 'stale' | 'unsupported' | 'unauthorized' | 'error';
|
|
8
|
+
export interface ConnectionStatusState extends Record<string, unknown> {
|
|
9
|
+
chainId: string | null;
|
|
10
|
+
nodes: ConnectionStatusMap;
|
|
11
|
+
shared: ConnectionStatusMap;
|
|
12
|
+
chainPhase: ConnectionStatusPhase;
|
|
13
|
+
sharedPhase: ConnectionStatusPhase;
|
|
14
|
+
chainUpdatedAt: number | null;
|
|
15
|
+
sharedUpdatedAt: number | null;
|
|
16
|
+
chainError?: string;
|
|
17
|
+
sharedError?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ConnectionStatusProvider {
|
|
20
|
+
getChainStatuses(chainId: string, signal?: AbortSignal): Promise<unknown>;
|
|
21
|
+
getSharedNodeStatuses(signal?: AbortSignal): Promise<unknown>;
|
|
22
|
+
}
|
|
23
|
+
export interface ConnectionStatusControllerOptions {
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
pollIntervalMs?: number;
|
|
26
|
+
now?: () => number;
|
|
27
|
+
}
|
|
28
|
+
export type ConnectionStatusSemanticKind = 'success' | 'warning' | 'danger' | 'neutral';
|
|
29
|
+
export interface ConnectionStatusView {
|
|
30
|
+
visible: boolean;
|
|
31
|
+
state: NodeConnectionState;
|
|
32
|
+
label: string;
|
|
33
|
+
tooltip: string;
|
|
34
|
+
kind: ConnectionStatusSemanticKind;
|
|
35
|
+
stale: boolean;
|
|
36
|
+
}
|
|
37
|
+
export type ConnectionStatusTranslator = (key: string, fallback: string) => string;
|
|
38
|
+
export declare function normalizeConnectionStatusMap(raw: unknown): ConnectionStatusMap;
|
|
39
|
+
export declare class ConnectionStatusStore {
|
|
40
|
+
private readonly store;
|
|
41
|
+
private destroyed;
|
|
42
|
+
getState(): Readonly<ConnectionStatusState>;
|
|
43
|
+
subscribe(listener: (state: Readonly<ConnectionStatusState>, previous: Readonly<ConnectionStatusState>) => void): () => void;
|
|
44
|
+
update(patch: Partial<ConnectionStatusState>): void;
|
|
45
|
+
reset(): void;
|
|
46
|
+
destroy(): void;
|
|
47
|
+
}
|
|
48
|
+
export declare class ConnectionStatusController {
|
|
49
|
+
private readonly store;
|
|
50
|
+
private readonly provider;
|
|
51
|
+
private readonly pollIntervalMs;
|
|
52
|
+
private readonly now;
|
|
53
|
+
private enabled;
|
|
54
|
+
private chainTimer;
|
|
55
|
+
private sharedTimer;
|
|
56
|
+
private chainRequest;
|
|
57
|
+
private sharedRequest;
|
|
58
|
+
private chainGeneration;
|
|
59
|
+
private sharedGeneration;
|
|
60
|
+
private sharedConsumers;
|
|
61
|
+
private destroyed;
|
|
62
|
+
constructor(store: ConnectionStatusStore, provider: ConnectionStatusProvider, options?: ConnectionStatusControllerOptions);
|
|
63
|
+
setEnabled(enabled: boolean): void;
|
|
64
|
+
setChain(chainId: string | null | undefined): void;
|
|
65
|
+
restartCurrentChain(): void;
|
|
66
|
+
restartShared(): void;
|
|
67
|
+
acquireShared(): () => void;
|
|
68
|
+
releaseShared(): void;
|
|
69
|
+
private pollChain;
|
|
70
|
+
private pollShared;
|
|
71
|
+
private isCurrentChain;
|
|
72
|
+
private isCurrentShared;
|
|
73
|
+
private stopChainRequest;
|
|
74
|
+
private stopSharedRequest;
|
|
75
|
+
destroy(): void;
|
|
76
|
+
}
|
|
77
|
+
export declare function resolveConnectionStatusView(info: NodeConnectionStatus | undefined, stale?: boolean, translate?: ConnectionStatusTranslator): ConnectionStatusView | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ContextMenuViewport {
|
|
2
|
+
width: number;
|
|
3
|
+
height: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ContextMenuRect {
|
|
6
|
+
left: number;
|
|
7
|
+
right: number;
|
|
8
|
+
top: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
}
|
|
11
|
+
export interface ContextMenuSize {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
export interface ContextMenuPosition {
|
|
16
|
+
left: number;
|
|
17
|
+
top: number;
|
|
18
|
+
placement: 'left' | 'right';
|
|
19
|
+
}
|
|
20
|
+
export declare function resolveContextSubmenuPosition(parent: ContextMenuRect, menu: ContextMenuSize, viewport: ContextMenuViewport, gap?: number, viewportPadding?: number): ContextMenuPosition;
|
|
21
|
+
export declare function clampContextMenuPosition(point: {
|
|
22
|
+
left: number;
|
|
23
|
+
top: number;
|
|
24
|
+
}, menu: ContextMenuSize, viewport: ContextMenuViewport, viewportPadding?: number): {
|
|
25
|
+
left: number;
|
|
26
|
+
top: number;
|
|
27
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export type RuleGoCronPreset = {
|
|
2
|
+
kind: 'everySeconds';
|
|
3
|
+
seconds: number;
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'everyMinutes';
|
|
6
|
+
minutes: number;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'everyHour';
|
|
9
|
+
minute: number;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'daily';
|
|
12
|
+
time: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'weekdays';
|
|
15
|
+
time: string;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'weekly';
|
|
18
|
+
days: number[];
|
|
19
|
+
time: string;
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'monthly';
|
|
22
|
+
day: number;
|
|
23
|
+
time: string;
|
|
24
|
+
} | {
|
|
25
|
+
kind: 'yearly';
|
|
26
|
+
month: number;
|
|
27
|
+
day: number;
|
|
28
|
+
time: string;
|
|
29
|
+
} | {
|
|
30
|
+
kind: 'custom';
|
|
31
|
+
expression: string;
|
|
32
|
+
};
|
|
33
|
+
export type RuleGoCronErrorCode = 'empty' | 'field-count' | 'unsupported-token' | 'invalid-expression' | 'invalid-preset' | 'invalid-count' | 'invalid-timezone';
|
|
34
|
+
export interface RuleGoCronError {
|
|
35
|
+
code: RuleGoCronErrorCode;
|
|
36
|
+
message: string;
|
|
37
|
+
}
|
|
38
|
+
export type RuleGoCronValidationResult = {
|
|
39
|
+
ok: true;
|
|
40
|
+
raw: string;
|
|
41
|
+
expression: string;
|
|
42
|
+
normalizedFromDescriptor: boolean;
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
raw: string;
|
|
46
|
+
error: RuleGoCronError;
|
|
47
|
+
};
|
|
48
|
+
export type RuleGoCronBuildResult = {
|
|
49
|
+
ok: true;
|
|
50
|
+
expression: string;
|
|
51
|
+
} | {
|
|
52
|
+
ok: false;
|
|
53
|
+
error: RuleGoCronError;
|
|
54
|
+
};
|
|
55
|
+
export type RuleGoCronPresetParseResult = {
|
|
56
|
+
ok: true;
|
|
57
|
+
expression: string;
|
|
58
|
+
preset: RuleGoCronPreset;
|
|
59
|
+
} | {
|
|
60
|
+
ok: false;
|
|
61
|
+
raw: string;
|
|
62
|
+
error: RuleGoCronError;
|
|
63
|
+
};
|
|
64
|
+
export interface RuleGoCronNextRunsOptions {
|
|
65
|
+
from?: Date | string;
|
|
66
|
+
count?: number;
|
|
67
|
+
timeZone?: string;
|
|
68
|
+
}
|
|
69
|
+
export type RuleGoCronNextRunsResult = {
|
|
70
|
+
ok: true;
|
|
71
|
+
expression: string;
|
|
72
|
+
runs: Date[];
|
|
73
|
+
timeZone: string;
|
|
74
|
+
} | {
|
|
75
|
+
ok: false;
|
|
76
|
+
raw: string;
|
|
77
|
+
runs: [];
|
|
78
|
+
timeZone: string;
|
|
79
|
+
error: RuleGoCronError;
|
|
80
|
+
};
|
|
81
|
+
export declare function validateRuleGoCron(raw: unknown): RuleGoCronValidationResult;
|
|
82
|
+
export declare function normalizeRuleGoCron(raw: unknown): RuleGoCronValidationResult;
|
|
83
|
+
export declare function cronPresetToRuleGoCron(preset: RuleGoCronPreset): RuleGoCronBuildResult;
|
|
84
|
+
export declare function ruleGoCronToPreset(raw: unknown): RuleGoCronPresetParseResult;
|
|
85
|
+
export declare function nextRuleGoCronRuns(raw: unknown, options?: RuleGoCronNextRunsOptions): RuleGoCronNextRunsResult;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface DebugPanelRequestSnapshot {
|
|
2
|
+
chainId: string;
|
|
3
|
+
requestId: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function createDebugPanelRequestSnapshot(chainId: string, requestId: number): DebugPanelRequestSnapshot;
|
|
6
|
+
export declare function isDebugPanelRequestCurrent(snapshot: DebugPanelRequestSnapshot, chainId: string, requestId: number): boolean;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
export type EditorMode = 'standalone' | 'app' | 'embedded' | 'readonly';
|
|
2
|
+
export interface EditorUiCapabilities {
|
|
3
|
+
toolbar: boolean;
|
|
4
|
+
sidebar: boolean;
|
|
5
|
+
minimap: boolean;
|
|
6
|
+
commandPalette: boolean;
|
|
7
|
+
contextMenu: boolean;
|
|
8
|
+
header: boolean;
|
|
9
|
+
statusBar: boolean;
|
|
10
|
+
chat: boolean;
|
|
11
|
+
tour: boolean;
|
|
12
|
+
nodeActions: boolean;
|
|
13
|
+
nodeRunFrom: boolean;
|
|
14
|
+
runFromDock: boolean;
|
|
15
|
+
legacyNodeDrawer: boolean;
|
|
16
|
+
info: boolean;
|
|
17
|
+
debugConsole: boolean;
|
|
18
|
+
clearDebugHighlight: boolean;
|
|
19
|
+
selection: boolean;
|
|
20
|
+
diagnostics: boolean;
|
|
21
|
+
settings: boolean;
|
|
22
|
+
importExport: boolean;
|
|
23
|
+
run: boolean;
|
|
24
|
+
componentManage: boolean;
|
|
25
|
+
deploy: boolean;
|
|
26
|
+
restart: boolean;
|
|
27
|
+
reload: boolean;
|
|
28
|
+
runHistory: boolean;
|
|
29
|
+
trace: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface EditorCapabilities {
|
|
32
|
+
mode: EditorMode;
|
|
33
|
+
ui: EditorUiCapabilities;
|
|
34
|
+
editor: {
|
|
35
|
+
readOnly: boolean;
|
|
36
|
+
};
|
|
37
|
+
features: {
|
|
38
|
+
hostOwnsChainOpen: boolean;
|
|
39
|
+
};
|
|
40
|
+
persistence: {
|
|
41
|
+
saveToServer: boolean;
|
|
42
|
+
syncUrlHash: boolean;
|
|
43
|
+
warnOnUnload: boolean;
|
|
44
|
+
};
|
|
45
|
+
workspace: {
|
|
46
|
+
topBar: boolean;
|
|
47
|
+
explorer: boolean;
|
|
48
|
+
palette: boolean;
|
|
49
|
+
sharedNodes: boolean;
|
|
50
|
+
information: boolean;
|
|
51
|
+
nodeConfigPanel: boolean;
|
|
52
|
+
problems: boolean;
|
|
53
|
+
runDebug: boolean;
|
|
54
|
+
dock: boolean;
|
|
55
|
+
tabs: boolean;
|
|
56
|
+
globalSearch: boolean;
|
|
57
|
+
chainSwitcher: boolean;
|
|
58
|
+
drafts: boolean;
|
|
59
|
+
conflictDetection: boolean;
|
|
60
|
+
sessionRestore: boolean;
|
|
61
|
+
admin: boolean;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export type EditorCapabilitiesOverride = DeepPartial<EditorCapabilities>;
|
|
65
|
+
export interface EditorCapabilityInput {
|
|
66
|
+
mode?: EditorMode;
|
|
67
|
+
capabilities?: EditorCapabilitiesOverride;
|
|
68
|
+
disabled?: boolean;
|
|
69
|
+
showToolbar?: boolean;
|
|
70
|
+
showSidebar?: boolean;
|
|
71
|
+
showInfoButton?: boolean;
|
|
72
|
+
showAiChatButton?: boolean;
|
|
73
|
+
showDebugConsoleButton?: boolean;
|
|
74
|
+
showClearDebugHighlightButton?: boolean;
|
|
75
|
+
showSelectionButton?: boolean;
|
|
76
|
+
showDiagnosticsButton?: boolean;
|
|
77
|
+
showSettingsButton?: boolean;
|
|
78
|
+
showExportDialog?: boolean;
|
|
79
|
+
showRunButton?: boolean;
|
|
80
|
+
showComponentManage?: boolean;
|
|
81
|
+
showDeployButton?: boolean;
|
|
82
|
+
showRestartButton?: boolean;
|
|
83
|
+
showReloadButton?: boolean;
|
|
84
|
+
showRunHistory?: boolean;
|
|
85
|
+
showTraceButton?: boolean;
|
|
86
|
+
options?: EditorCapabilityInput;
|
|
87
|
+
}
|
|
88
|
+
type DeepPartial<T> = T extends (...args: never[]) => unknown ? T : T extends readonly (infer U)[] ? ReadonlyArray<DeepPartial<U>> : T extends object ? {
|
|
89
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
90
|
+
} : T;
|
|
91
|
+
export declare function resolveEditorCapabilities(input?: EditorCapabilityInput): EditorCapabilities;
|
|
92
|
+
export declare const CAPABILITY_BASE: Readonly<EditorCapabilities>;
|
|
93
|
+
export declare const CAPABILITY_PROFILES: Readonly<Record<EditorMode, EditorCapabilitiesOverride>>;
|
|
94
|
+
export declare const resolveCapabilities: typeof resolveEditorCapabilities;
|
|
95
|
+
export {};
|