@huanban/rulego-editor-react 1.3.18 → 1.4.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 (48) hide show
  1. package/README.md +304 -10
  2. package/dist/components/AIAssistant.d.ts +1 -7
  3. package/dist/components/ComponentSidebar.d.ts +13 -52
  4. package/dist/components/ContextMenu.d.ts +1 -59
  5. package/dist/components/CopilotChat.d.ts +27 -22
  6. package/dist/components/DataViewDialog.d.ts +0 -33
  7. package/dist/components/DebugPanel.d.ts +5 -65
  8. package/dist/components/DynamicForm.d.ts +0 -40
  9. package/dist/components/EdgePropertyDrawer.d.ts +0 -35
  10. package/dist/components/EditorConnectionStatus.d.ts +12 -0
  11. package/dist/components/EditorEdgeHoverTools.d.ts +11 -0
  12. package/dist/components/EditorIcon.d.ts +7 -0
  13. package/dist/components/EditorNodeHoverTools.d.ts +16 -0
  14. package/dist/components/EditorPanelDock.d.ts +18 -0
  15. package/dist/components/EditorStatusBar.d.ts +34 -0
  16. package/dist/components/EditorToolbar.d.ts +2 -62
  17. package/dist/components/ImportExportDialog.d.ts +1 -37
  18. package/dist/components/LogViewer.d.ts +0 -29
  19. package/dist/components/MiniMap.d.ts +0 -46
  20. package/dist/components/NodePropertyDrawer.d.ts +19 -102
  21. package/dist/components/ProblemsPanel.d.ts +21 -0
  22. package/dist/components/RuleChainSettings.d.ts +0 -45
  23. package/dist/components/RuleGoEditor.d.ts +37 -147
  24. package/dist/components/RuleMaintenancePanel.d.ts +0 -1
  25. package/dist/components/SearchPanel.d.ts +0 -39
  26. package/dist/components/SearchableSelect.d.ts +0 -1
  27. package/dist/components/ValidationPanel.d.ts +0 -39
  28. package/dist/components/WorkflowExplorer.d.ts +24 -0
  29. package/dist/components/WorkflowInfoPanel.d.ts +1 -36
  30. package/dist/components/WorkflowList.d.ts +2 -69
  31. package/dist/components/WorkspaceTabs.d.ts +17 -0
  32. package/dist/components/properties/AgentOrchestrationProperties.d.ts +2 -1
  33. package/dist/hooks/useBoundStore.d.ts +8 -0
  34. package/dist/hooks/useClipboard.d.ts +2 -63
  35. package/dist/hooks/useEditorCore.d.ts +0 -79
  36. package/dist/hooks/useEditorI18n.d.ts +0 -26
  37. package/dist/hooks/useEditorPanels.d.ts +23 -0
  38. package/dist/hooks/useEditorShell.d.ts +35 -0
  39. package/dist/hooks/useEditorTheme.d.ts +0 -30
  40. package/dist/hooks/useEditorWorkspace.d.ts +25 -0
  41. package/dist/hooks/useKeyboardShortcuts.d.ts +4 -44
  42. package/dist/i18n.d.ts +6 -4
  43. package/dist/index.cjs +17 -0
  44. package/dist/index.d.ts +28 -62
  45. package/dist/index.esm.js +6235 -104685
  46. package/dist/style.css +1 -1
  47. package/package.json +13 -8
  48. package/dist/index.cjs.js +0 -9470
@@ -1,37 +1,7 @@
1
- /**
2
- * @file hooks/useEditorTheme.ts
3
- * @description React Hook — 主题管理
4
- *
5
- * 兼容 React 16.8+, 不使用 React 18 专有 API。
6
- *
7
- * 使用方式:
8
- * ```tsx
9
- * const { currentTheme, setTheme, themes } = useEditorTheme(core)
10
- *
11
- * return (
12
- * <select value={currentTheme} onChange={e => setTheme(e.target.value)}>
13
- * {themes.map(t => <option key={t}>{t}</option>)}
14
- * </select>
15
- * )
16
- * ```
17
- */
18
1
  import type { EditorCore } from '@huanban/rulego-editor-core';
19
- /**
20
- * useEditorTheme 返回类型
21
- */
22
2
  export interface UseEditorThemeReturn {
23
- /** 当前主题名称 */
24
3
  currentTheme: string;
25
- /** 可用主题列表 */
26
4
  themes: string[];
27
- /** 切换主题 */
28
5
  setTheme: (name: string) => void;
29
6
  }
30
- /**
31
- * 主题管理 Hook
32
- *
33
- * @param core - EditorCore 实例 (可空, SSR 安全)
34
- * @returns 主题状态和操作
35
- */
36
7
  export declare function useEditorTheme(core: EditorCore | null): UseEditorThemeReturn;
37
- //# sourceMappingURL=useEditorTheme.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { EditorWorkspace } from '@huanban/rulego-editor-core';
2
+ import type { CloseWorkspaceTabOptions, CloseWorkspaceTabResult, EditorWorkspaceState, EditorWorkspaceTab, OpenWorkspaceTabInput, RuleChainData, WorkspaceConflictResolution, WorkspaceConflictResult } from '@huanban/rulego-editor-core';
3
+ export interface UseEditorWorkspaceOptions {
4
+ tabs?: OpenWorkspaceTabInput[];
5
+ activeTabId?: string | null;
6
+ workspace?: EditorWorkspace | null;
7
+ }
8
+ export interface UseEditorWorkspaceReturn {
9
+ workspace: EditorWorkspace;
10
+ state: Readonly<EditorWorkspaceState>;
11
+ tabs: EditorWorkspaceTab[];
12
+ activeTab: EditorWorkspaceTab | null;
13
+ openTab: (input?: OpenWorkspaceTabInput) => EditorWorkspaceTab;
14
+ activateTab: (tabId: string) => boolean;
15
+ renameTab: (tabId: string, title: string) => boolean;
16
+ togglePinned: (tabId: string) => boolean;
17
+ getCloseOtherTabIds: (tabId: string) => string[];
18
+ getCloseRightTabIds: (tabId: string) => string[];
19
+ setDraft: (tabId: string, data: RuleChainData | null) => EditorWorkspaceTab | null;
20
+ markSaved: (tabId: string, data?: RuleChainData | null) => EditorWorkspaceTab | null;
21
+ setLoading: (tabId: string, isLoading: boolean) => boolean;
22
+ closeTab: (tabId: string, options?: CloseWorkspaceTabOptions) => CloseWorkspaceTabResult;
23
+ resolveSaveConflict: (tabId: string, resolution: WorkspaceConflictResolution, remoteData?: RuleChainData | null) => WorkspaceConflictResult;
24
+ }
25
+ export declare function useEditorWorkspace(options?: UseEditorWorkspaceOptions): UseEditorWorkspaceReturn;
@@ -1,62 +1,19 @@
1
- /** 快捷键配置 */
2
1
  export interface ShortcutConfig {
3
- /** 按键(小写,如 's', 'z', 'delete', 'backspace') */
4
2
  key: string;
5
- /** 是否需要 Ctrl/Cmd(自动适配 Mac) */
6
3
  ctrl?: boolean;
7
- /** 是否需要 Shift */
8
4
  shift?: boolean;
9
- /** 是否需要 Alt/Option */
10
5
  alt?: boolean;
11
- /** 是否在 input/textarea/CodeMirror 焦点时也生效(默认 false) */
12
6
  enableInInput?: boolean;
13
- /** 描述文本(用于帮助界面) */
14
7
  description?: string;
15
- /** 处理函数 */
16
8
  handler: (e: KeyboardEvent) => void;
17
9
  }
18
- /** useKeyboardShortcuts 配置 */
19
10
  export interface UseKeyboardShortcutsOptions {
20
- /** 快捷键列表 */
21
11
  shortcuts: ShortcutConfig[];
22
- /** 是否启用(默认 true) */
23
12
  enabled?: boolean;
24
- /** 事件目标元素(默认 document) */
25
13
  target?: HTMLElement | null;
26
14
  }
27
- /**
28
- * useKeyboardShortcuts — 键盘快捷键 Hook
29
- *
30
- * 自动处理 Mac/Windows 快捷键差异,支持组合键。
31
- *
32
- * @param options - 快捷键配置
33
- *
34
- * @example
35
- * ```tsx
36
- * useKeyboardShortcuts({
37
- * shortcuts: [
38
- * { key: 's', ctrl: true, description: '保存', handler: () => save() },
39
- * { key: 'z', ctrl: true, description: '撤销', handler: () => undo() },
40
- * { key: 'z', ctrl: true, shift: true, description: '重做', handler: () => redo() },
41
- * { key: 'delete', description: '删除', handler: () => deleteSelected() },
42
- * ],
43
- * })
44
- * ```
45
- */
46
15
  export declare function useKeyboardShortcuts(options: UseKeyboardShortcutsOptions): void;
47
- /**
48
- * 获取快捷键显示文本
49
- *
50
- * @param config - 快捷键配置
51
- * @returns 可读的快捷键文本(如 "⌘S" 或 "Ctrl+S")
52
- */
53
16
  export declare function getShortcutLabel(config: ShortcutConfig): string;
54
- /**
55
- * 生成编辑器默认快捷键
56
- *
57
- * @param handlers - 操作回调
58
- * @returns 快捷键配置列表
59
- */
60
17
  export declare function getDefaultEditorShortcuts(handlers: {
61
18
  onSave?: () => void;
62
19
  onUndo?: () => void;
@@ -64,10 +21,13 @@ export declare function getDefaultEditorShortcuts(handlers: {
64
21
  onDelete?: () => void;
65
22
  onCopy?: () => void;
66
23
  onPaste?: () => void;
24
+ onDuplicate?: () => void;
67
25
  onSelectAll?: () => void;
26
+ onRename?: () => void;
27
+ onToggleSidebar?: () => void;
28
+ onAutoLayout?: () => void;
68
29
  onFitView?: () => void;
69
30
  onZoomIn?: () => void;
70
31
  onZoomOut?: () => void;
71
32
  onEscape?: () => void;
72
33
  }): ShortcutConfig[];
73
- //# sourceMappingURL=useKeyboardShortcuts.d.ts.map
package/dist/i18n.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import type { LocaleMessages } from '@huanban/rulego-editor-core';
2
2
  export type EditorTranslate = (key: string, params?: Record<string, string | number>) => string;
3
3
  export interface FrameworkI18nProps {
4
- /** Current locale. Supports zh-CN/zh_cn/zh and en-US/en_us/en. */
5
4
  locale?: string;
6
- /** Extra messages merged into the selected locale. */
7
5
  messages?: LocaleMessages;
8
- /** Host-provided translation function. It takes priority over built-in messages. */
9
6
  t?: EditorTranslate;
10
7
  }
8
+ type FrameworkFieldLike = {
9
+ name?: string;
10
+ label?: string;
11
+ };
11
12
  export declare function normalizeFrameworkLocale(locale?: string): 'zh-CN' | 'en-US';
12
13
  export declare function createFrameworkTranslator(options?: FrameworkI18nProps): (key: string, fallback?: string, params?: Record<string, string | number>) => string;
14
+ export declare function resolveFrameworkFieldLabel(field: FrameworkFieldLike, translate: (key: string, fallback?: string) => string, hostTranslate?: EditorTranslate, messages?: LocaleMessages): string;
13
15
  export declare function relationTypeLabel(translate: (key: string, fallback?: string, params?: Record<string, string | number>) => string, value: string): string;
14
- //# sourceMappingURL=i18n.d.ts.map
16
+ export {};