@invect/ui 0.0.1 → 0.0.2
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 +0 -4
- package/dist/{Invect-CWpIwZ5F.js → Invect-CJSKm2Aq.js} +28086 -27414
- package/dist/Invect.d.ts +16 -4
- package/dist/api/node-data.api.d.ts +1 -1
- package/dist/components/flow-editor/FlowCommandPalette.d.ts +19 -0
- package/dist/components/flow-editor/ShortcutsHelpDialog.d.ts +6 -0
- package/dist/components/flow-editor/keyboard-shortcuts.d.ts +161 -0
- package/dist/components/flow-editor/serialize-to-sdk.d.ts +12 -12
- package/dist/components/flow-editor/use-keyboard-shortcuts.d.ts +14 -0
- package/dist/demo.js +159 -145
- package/dist/index.css +1 -1
- package/dist/index.js +175 -175
- package/package.json +4 -3
- package/src/Invect.tsx +24 -6
- package/src/components/flow-editor/FlowCommandPalette.tsx +136 -0
- package/src/components/flow-editor/FlowEditor.tsx +18 -0
- package/src/components/flow-editor/ShortcutsHelpDialog.tsx +68 -0
- package/src/components/flow-editor/keyboard-shortcuts.ts +203 -0
- package/src/components/flow-editor/serialize-to-sdk.ts +20 -19
- package/src/components/flow-editor/use-keyboard-shortcuts.ts +280 -0
- package/src/demo/DemoInvect.tsx +10 -1
- package/src/demo/demo-api-client.ts +1 -0
package/dist/Invect.d.ts
CHANGED
|
@@ -4,13 +4,25 @@ import { InvectFrontendPlugin } from './types/plugin.types';
|
|
|
4
4
|
import { ApiClient } from './api/client';
|
|
5
5
|
export interface InvectProps {
|
|
6
6
|
reactQueryClient?: QueryClient;
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
apiPath?: string;
|
|
8
|
+
frontendPath?: string;
|
|
9
9
|
useMemoryRouter?: boolean;
|
|
10
10
|
/** Frontend plugins that contribute sidebar items, routes, panel tabs, header actions, etc. */
|
|
11
11
|
plugins?: InvectFrontendPlugin[];
|
|
12
|
-
/** Pre-configured API client instance (e.g. for demo mode). When provided,
|
|
12
|
+
/** Pre-configured API client instance (e.g. for demo mode). When provided, apiPath is ignored. */
|
|
13
13
|
apiClient?: ApiClient;
|
|
14
|
+
/**
|
|
15
|
+
* Invect configuration object (from defineConfig).
|
|
16
|
+
* When provided, `apiPath` and `frontendPath` are read from the config
|
|
17
|
+
* unless explicitly overridden by the individual props.
|
|
18
|
+
*/
|
|
19
|
+
config?: {
|
|
20
|
+
apiPath?: string;
|
|
21
|
+
frontendPath?: string;
|
|
22
|
+
plugins?: Array<{
|
|
23
|
+
frontend?: InvectFrontendPlugin;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
14
26
|
}
|
|
15
27
|
/**
|
|
16
28
|
* Complete Invect component with internal routing
|
|
@@ -22,4 +34,4 @@ export interface InvectProps {
|
|
|
22
34
|
*
|
|
23
35
|
* For integration into existing React Router apps, use createInvectRoutes instead
|
|
24
36
|
*/
|
|
25
|
-
export declare const Invect: React.MemoExoticComponent<({ reactQueryClient,
|
|
37
|
+
export declare const Invect: React.MemoExoticComponent<({ reactQueryClient, apiPath: apiPathProp, frontendPath: frontendPathProp, useMemoryRouter, plugins, apiClient, config, }: InvectProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SubmitSQLQueryRequest } from '@invect/core/types';
|
|
2
2
|
export declare function useListQueryDatabases(): import('@tanstack/react-query').UseQueryResult<{
|
|
3
3
|
connectionString: string;
|
|
4
|
-
type: "
|
|
4
|
+
type: "sqlite" | "mysql" | "postgresql";
|
|
5
5
|
name?: string | undefined;
|
|
6
6
|
driver?: "pg" | "postgres" | "neon-serverless" | "better-sqlite3" | "libsql" | "mysql2" | undefined;
|
|
7
7
|
}[], Error>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ShortcutCategory } from './keyboard-shortcuts';
|
|
3
|
+
export interface CommandPaletteAction {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
category: ShortcutCategory;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
shortcutDisplay?: string;
|
|
10
|
+
onSelect: () => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface FlowCommandPaletteProps {
|
|
14
|
+
open: boolean;
|
|
15
|
+
onOpenChange: (open: boolean) => void;
|
|
16
|
+
actions: CommandPaletteAction[];
|
|
17
|
+
}
|
|
18
|
+
export declare function FlowCommandPalette({ open, onOpenChange, actions }: FlowCommandPaletteProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
export interface KeyboardShortcut {
|
|
2
|
+
/** Unique identifier */
|
|
3
|
+
id: string;
|
|
4
|
+
/** Human-readable label shown in command palette and help overlay */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Key combo in react-hotkeys-hook format (e.g. "mod+k", "shift+a") */
|
|
7
|
+
keys: string;
|
|
8
|
+
/** Display string for macOS (e.g. "⌘K") */
|
|
9
|
+
macDisplay: string;
|
|
10
|
+
/** Display string for Windows/Linux (e.g. "Ctrl+K") */
|
|
11
|
+
winDisplay: string;
|
|
12
|
+
/** Category for grouping in the command palette */
|
|
13
|
+
category: ShortcutCategory;
|
|
14
|
+
/** Optional description for the command palette */
|
|
15
|
+
description?: string;
|
|
16
|
+
/** If true, this shortcut is also available when editing text inputs */
|
|
17
|
+
enableOnFormTags?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export type ShortcutCategory = 'general' | 'editing' | 'navigation' | 'view';
|
|
20
|
+
/** Get the platform-appropriate display string for a shortcut */
|
|
21
|
+
export declare function getShortcutDisplay(shortcut: KeyboardShortcut): string;
|
|
22
|
+
export declare const SHORTCUTS: {
|
|
23
|
+
readonly commandPalette: {
|
|
24
|
+
readonly id: "command-palette";
|
|
25
|
+
readonly label: "Open Command Palette";
|
|
26
|
+
readonly keys: "mod+k";
|
|
27
|
+
readonly macDisplay: "⌘K";
|
|
28
|
+
readonly winDisplay: "Ctrl+K";
|
|
29
|
+
readonly category: "general";
|
|
30
|
+
readonly enableOnFormTags: true;
|
|
31
|
+
};
|
|
32
|
+
readonly save: {
|
|
33
|
+
readonly id: "save";
|
|
34
|
+
readonly label: "Save Flow";
|
|
35
|
+
readonly keys: "mod+s";
|
|
36
|
+
readonly macDisplay: "⌘S";
|
|
37
|
+
readonly winDisplay: "Ctrl+S";
|
|
38
|
+
readonly category: "general";
|
|
39
|
+
readonly enableOnFormTags: true;
|
|
40
|
+
};
|
|
41
|
+
readonly executeFlow: {
|
|
42
|
+
readonly id: "execute-flow";
|
|
43
|
+
readonly label: "Run Flow";
|
|
44
|
+
readonly keys: "mod+enter";
|
|
45
|
+
readonly macDisplay: "⌘↵";
|
|
46
|
+
readonly winDisplay: "Ctrl+Enter";
|
|
47
|
+
readonly category: "general";
|
|
48
|
+
readonly enableOnFormTags: true;
|
|
49
|
+
};
|
|
50
|
+
readonly showShortcuts: {
|
|
51
|
+
readonly id: "show-shortcuts";
|
|
52
|
+
readonly label: "Show Keyboard Shortcuts";
|
|
53
|
+
readonly keys: "shift+/";
|
|
54
|
+
readonly macDisplay: "?";
|
|
55
|
+
readonly winDisplay: "?";
|
|
56
|
+
readonly category: "general";
|
|
57
|
+
};
|
|
58
|
+
readonly copy: {
|
|
59
|
+
readonly id: "copy";
|
|
60
|
+
readonly label: "Copy Selected Nodes";
|
|
61
|
+
readonly keys: "mod+c";
|
|
62
|
+
readonly macDisplay: "⌘C";
|
|
63
|
+
readonly winDisplay: "Ctrl+C";
|
|
64
|
+
readonly category: "editing";
|
|
65
|
+
};
|
|
66
|
+
readonly cut: {
|
|
67
|
+
readonly id: "cut";
|
|
68
|
+
readonly label: "Cut Selected Nodes";
|
|
69
|
+
readonly keys: "mod+x";
|
|
70
|
+
readonly macDisplay: "⌘X";
|
|
71
|
+
readonly winDisplay: "Ctrl+X";
|
|
72
|
+
readonly category: "editing";
|
|
73
|
+
};
|
|
74
|
+
readonly paste: {
|
|
75
|
+
readonly id: "paste";
|
|
76
|
+
readonly label: "Paste Nodes";
|
|
77
|
+
readonly keys: "mod+v";
|
|
78
|
+
readonly macDisplay: "⌘V";
|
|
79
|
+
readonly winDisplay: "Ctrl+V";
|
|
80
|
+
readonly category: "editing";
|
|
81
|
+
};
|
|
82
|
+
readonly duplicate: {
|
|
83
|
+
readonly id: "duplicate";
|
|
84
|
+
readonly label: "Duplicate Selected Nodes";
|
|
85
|
+
readonly keys: "mod+d";
|
|
86
|
+
readonly macDisplay: "⌘D";
|
|
87
|
+
readonly winDisplay: "Ctrl+D";
|
|
88
|
+
readonly category: "editing";
|
|
89
|
+
};
|
|
90
|
+
readonly deleteSelection: {
|
|
91
|
+
readonly id: "delete-selection";
|
|
92
|
+
readonly label: "Delete Selected Nodes";
|
|
93
|
+
readonly keys: "backspace";
|
|
94
|
+
readonly macDisplay: "⌫";
|
|
95
|
+
readonly winDisplay: "Delete";
|
|
96
|
+
readonly category: "editing";
|
|
97
|
+
};
|
|
98
|
+
readonly selectAll: {
|
|
99
|
+
readonly id: "select-all";
|
|
100
|
+
readonly label: "Select All Nodes";
|
|
101
|
+
readonly keys: "mod+a";
|
|
102
|
+
readonly macDisplay: "⌘A";
|
|
103
|
+
readonly winDisplay: "Ctrl+A";
|
|
104
|
+
readonly category: "editing";
|
|
105
|
+
};
|
|
106
|
+
readonly fitView: {
|
|
107
|
+
readonly id: "fit-view";
|
|
108
|
+
readonly label: "Fit View";
|
|
109
|
+
readonly keys: "mod+shift+f";
|
|
110
|
+
readonly macDisplay: "⌘⇧F";
|
|
111
|
+
readonly winDisplay: "Ctrl+Shift+F";
|
|
112
|
+
readonly category: "navigation";
|
|
113
|
+
};
|
|
114
|
+
readonly zoomIn: {
|
|
115
|
+
readonly id: "zoom-in";
|
|
116
|
+
readonly label: "Zoom In";
|
|
117
|
+
readonly keys: "mod+=";
|
|
118
|
+
readonly macDisplay: "⌘+";
|
|
119
|
+
readonly winDisplay: "Ctrl++";
|
|
120
|
+
readonly category: "navigation";
|
|
121
|
+
};
|
|
122
|
+
readonly zoomOut: {
|
|
123
|
+
readonly id: "zoom-out";
|
|
124
|
+
readonly label: "Zoom Out";
|
|
125
|
+
readonly keys: "mod+-";
|
|
126
|
+
readonly macDisplay: "⌘−";
|
|
127
|
+
readonly winDisplay: "Ctrl+-";
|
|
128
|
+
readonly category: "navigation";
|
|
129
|
+
};
|
|
130
|
+
readonly toggleSidebar: {
|
|
131
|
+
readonly id: "toggle-sidebar";
|
|
132
|
+
readonly label: "Toggle Node Sidebar";
|
|
133
|
+
readonly keys: "mod+b";
|
|
134
|
+
readonly macDisplay: "⌘B";
|
|
135
|
+
readonly winDisplay: "Ctrl+B";
|
|
136
|
+
readonly category: "view";
|
|
137
|
+
};
|
|
138
|
+
readonly toggleTheme: {
|
|
139
|
+
readonly id: "toggle-theme";
|
|
140
|
+
readonly label: "Toggle Dark/Light Mode";
|
|
141
|
+
readonly keys: "mod+shift+l";
|
|
142
|
+
readonly macDisplay: "⌘⇧L";
|
|
143
|
+
readonly winDisplay: "Ctrl+Shift+L";
|
|
144
|
+
readonly category: "view";
|
|
145
|
+
};
|
|
146
|
+
readonly toggleChat: {
|
|
147
|
+
readonly id: "toggle-chat";
|
|
148
|
+
readonly label: "Toggle AI Chat Assistant";
|
|
149
|
+
readonly keys: "mod+shift+a";
|
|
150
|
+
readonly macDisplay: "⌘⇧A";
|
|
151
|
+
readonly winDisplay: "Ctrl+Shift+A";
|
|
152
|
+
readonly category: "view";
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
export type ShortcutId = keyof typeof SHORTCUTS;
|
|
156
|
+
/** All shortcuts as a flat array, for iteration */
|
|
157
|
+
export declare const ALL_SHORTCUTS: KeyboardShortcut[];
|
|
158
|
+
/** Shortcuts grouped by category */
|
|
159
|
+
export declare function getShortcutsByCategory(): Record<ShortcutCategory, KeyboardShortcut[]>;
|
|
160
|
+
/** Human-readable category labels */
|
|
161
|
+
export declare const CATEGORY_LABELS: Record<ShortcutCategory, string>;
|
|
@@ -2,19 +2,19 @@ import { ClipboardNode, ClipboardEdge } from './use-copy-paste.types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Convert clipboard nodes and edges into SDK source code text.
|
|
4
4
|
*
|
|
5
|
-
* Returns a string like:
|
|
5
|
+
* Returns a string shaped like a `defineFlow()` body:
|
|
6
6
|
* ```
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
7
|
+
* nodes: [
|
|
8
|
+
* input('query', { variableName: 'query' }),
|
|
9
|
+
* model('answer', {
|
|
10
|
+
* credentialId: 'cred-abc',
|
|
11
|
+
* model: 'gpt-4o-mini',
|
|
12
|
+
* prompt: '{{ query }}',
|
|
13
|
+
* }),
|
|
14
|
+
* ],
|
|
15
|
+
* edges: [
|
|
16
|
+
* ['query', 'answer'],
|
|
17
|
+
* ],
|
|
18
18
|
* ```
|
|
19
19
|
*/
|
|
20
20
|
export declare function serializeToSDK(nodes: ClipboardNode[], edges: ClipboardEdge[]): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CommandPaletteAction } from './FlowCommandPalette';
|
|
2
|
+
/** Options to control which canvas-level shortcuts to skip (handled elsewhere) */
|
|
3
|
+
interface UseKeyboardShortcutsOptions {
|
|
4
|
+
/** Whether copy/paste shortcuts are handled by useCopyPaste (avoid double-binding) */
|
|
5
|
+
copyPasteHandledExternally?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function useKeyboardShortcuts(opts?: UseKeyboardShortcutsOptions): {
|
|
8
|
+
commandPaletteOpen: boolean;
|
|
9
|
+
setCommandPaletteOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
10
|
+
shortcutsHelpOpen: boolean;
|
|
11
|
+
setShortcutsHelpOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
12
|
+
commandPaletteActions: CommandPaletteAction[];
|
|
13
|
+
};
|
|
14
|
+
export {};
|