@genfeedai/workflow-ui 0.1.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/dist/canvas.d.mts +27 -0
- package/dist/canvas.d.ts +27 -0
- package/dist/canvas.js +45 -0
- package/dist/canvas.mjs +16 -0
- package/dist/chunk-22PDGHNQ.mjs +737 -0
- package/dist/chunk-3SPPKCWR.js +458 -0
- package/dist/chunk-3YFFDHC5.js +300 -0
- package/dist/chunk-5HJFQVUR.js +61 -0
- package/dist/chunk-5LQ4QBR5.js +2 -0
- package/dist/chunk-6DOEUDD5.js +254 -0
- package/dist/chunk-7SKSRSS7.mjs +57 -0
- package/dist/chunk-AC6TWLRT.mjs +27 -0
- package/dist/chunk-ADWNF7V3.js +120 -0
- package/dist/chunk-BJ3R5R32.mjs +2163 -0
- package/dist/chunk-CETJJ73S.js +1555 -0
- package/dist/chunk-CSUBLSKZ.mjs +1002 -0
- package/dist/chunk-CV4M7CNU.mjs +251 -0
- package/dist/chunk-E323WAZG.mjs +272 -0
- package/dist/chunk-E544XUBL.js +378 -0
- package/dist/chunk-EC2ZIWOK.js +1007 -0
- package/dist/chunk-EFXQT23N.mjs +99 -0
- package/dist/chunk-EMUMKW5C.js +107 -0
- package/dist/chunk-FOMOOERN.js +2 -0
- package/dist/chunk-FT33LFII.mjs +21 -0
- package/dist/chunk-FT64PCUP.mjs +533 -0
- package/dist/chunk-H6LZKSLY.js +5678 -0
- package/dist/chunk-HPQT36RR.js +543 -0
- package/dist/chunk-JLWKW3G5.js +2 -0
- package/dist/chunk-L5TF4EHW.mjs +1 -0
- package/dist/chunk-LAJ34AH2.mjs +374 -0
- package/dist/chunk-LDN7IX4Y.mjs +1 -0
- package/dist/chunk-MLJJBBTB.mjs +1 -0
- package/dist/chunk-NSDLGLAQ.js +2166 -0
- package/dist/chunk-RJ262NXS.js +24 -0
- package/dist/chunk-RXNEDWK2.js +141 -0
- package/dist/chunk-SW7QNEZU.js +744 -0
- package/dist/chunk-UQQUWGHW.mjs +118 -0
- package/dist/chunk-VOGL2WCE.mjs +1542 -0
- package/dist/chunk-VRN3UWE5.mjs +138 -0
- package/dist/chunk-XV5Z5XYR.mjs +5640 -0
- package/dist/chunk-Z7PWFZG5.js +30 -0
- package/dist/chunk-ZJD5WMR3.mjs +418 -0
- package/dist/hooks.d.mts +255 -0
- package/dist/hooks.d.ts +255 -0
- package/dist/hooks.js +56 -0
- package/dist/hooks.mjs +11 -0
- package/dist/index.d.mts +29 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +180 -0
- package/dist/index.mjs +19 -0
- package/dist/lib.d.mts +164 -0
- package/dist/lib.d.ts +164 -0
- package/dist/lib.js +144 -0
- package/dist/lib.mjs +3 -0
- package/dist/nodes.d.mts +128 -0
- package/dist/nodes.d.ts +128 -0
- package/dist/nodes.js +151 -0
- package/dist/nodes.mjs +14 -0
- package/dist/panels.d.mts +22 -0
- package/dist/panels.d.ts +22 -0
- package/dist/panels.js +21 -0
- package/dist/panels.mjs +4 -0
- package/dist/promptLibraryStore-BZnfmEkc.d.ts +464 -0
- package/dist/promptLibraryStore-zqb59nsu.d.mts +464 -0
- package/dist/provider.d.mts +29 -0
- package/dist/provider.d.ts +29 -0
- package/dist/provider.js +17 -0
- package/dist/provider.mjs +4 -0
- package/dist/stores.d.mts +96 -0
- package/dist/stores.d.ts +96 -0
- package/dist/stores.js +113 -0
- package/dist/stores.mjs +43 -0
- package/dist/toolbar.d.mts +73 -0
- package/dist/toolbar.d.ts +73 -0
- package/dist/toolbar.js +34 -0
- package/dist/toolbar.mjs +5 -0
- package/dist/types-ipAnBzAJ.d.mts +46 -0
- package/dist/types-ipAnBzAJ.d.ts +46 -0
- package/dist/ui.d.mts +67 -0
- package/dist/ui.d.ts +67 -0
- package/dist/ui.js +84 -0
- package/dist/ui.mjs +3 -0
- package/dist/workflowStore-4EGKJLYK.mjs +3 -0
- package/dist/workflowStore-KM32FDL7.js +12 -0
- package/package.json +117 -0
- package/src/styles/workflow-ui.css +186 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useWorkflowStore } from './chunk-BJ3R5R32.mjs';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
function useCanvasKeyboardShortcuts({
|
|
5
|
+
selectedNodeIds,
|
|
6
|
+
groups,
|
|
7
|
+
nodes,
|
|
8
|
+
toggleNodeLock,
|
|
9
|
+
createGroup,
|
|
10
|
+
deleteGroup,
|
|
11
|
+
unlockAllNodes,
|
|
12
|
+
addNode,
|
|
13
|
+
togglePalette,
|
|
14
|
+
fitView,
|
|
15
|
+
openShortcutHelp,
|
|
16
|
+
openNodeSearch
|
|
17
|
+
}) {
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const handleKeyDown = (e) => {
|
|
20
|
+
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const isMod = e.ctrlKey || e.metaKey;
|
|
24
|
+
if (e.key === "m" && !isMod && !e.shiftKey) {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
togglePalette();
|
|
27
|
+
}
|
|
28
|
+
if (e.key === "f" && !isMod && !e.shiftKey) {
|
|
29
|
+
e.preventDefault();
|
|
30
|
+
if (selectedNodeIds.length > 0) {
|
|
31
|
+
const selectedNodes = nodes.filter((n) => selectedNodeIds.includes(n.id));
|
|
32
|
+
fitView({ nodes: selectedNodes, padding: 0.3, duration: 200 });
|
|
33
|
+
} else {
|
|
34
|
+
fitView({ padding: 0.2, duration: 200 });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (e.key === "?" && e.shiftKey && !isMod) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
openShortcutHelp();
|
|
40
|
+
}
|
|
41
|
+
if (e.key === "f" && isMod && !e.shiftKey) {
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
openNodeSearch();
|
|
44
|
+
}
|
|
45
|
+
if (e.key === "l" && !isMod && !e.shiftKey) {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
for (const nodeId of selectedNodeIds) {
|
|
48
|
+
toggleNodeLock(nodeId);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (e.key === "g" && isMod && !e.shiftKey) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
if (selectedNodeIds.length > 1) {
|
|
54
|
+
createGroup(selectedNodeIds);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (e.key === "g" && isMod && e.shiftKey) {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
for (const nodeId of selectedNodeIds) {
|
|
60
|
+
const group = groups.find((g) => g.nodeIds.includes(nodeId));
|
|
61
|
+
if (group) {
|
|
62
|
+
deleteGroup(group.id);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (e.key === "l" && isMod && e.shiftKey) {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
unlockAllNodes();
|
|
70
|
+
}
|
|
71
|
+
if (e.key === "I" && e.shiftKey && !isMod) {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
const position = { x: window.innerWidth / 2 - 150, y: window.innerHeight / 2 - 150 };
|
|
74
|
+
addNode("imageGen", position);
|
|
75
|
+
}
|
|
76
|
+
if (e.key === "V" && e.shiftKey && !isMod) {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
const position = { x: window.innerWidth / 2 - 150, y: window.innerHeight / 2 - 150 };
|
|
79
|
+
addNode("videoGen", position);
|
|
80
|
+
}
|
|
81
|
+
if (e.key === "P" && e.shiftKey && !isMod) {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
const position = { x: window.innerWidth / 2 - 150, y: window.innerHeight / 2 - 150 };
|
|
84
|
+
addNode("prompt", position);
|
|
85
|
+
}
|
|
86
|
+
if ((e.key === "L" || e.key === "l") && e.shiftKey && !isMod) {
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
const position = { x: window.innerWidth / 2 - 150, y: window.innerHeight / 2 - 150 };
|
|
89
|
+
addNode("llm", position);
|
|
90
|
+
}
|
|
91
|
+
if (e.key === "z" && isMod && !e.shiftKey) {
|
|
92
|
+
e.preventDefault();
|
|
93
|
+
useWorkflowStore.temporal.getState().undo();
|
|
94
|
+
}
|
|
95
|
+
if (e.key === "z" && isMod && e.shiftKey) {
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
useWorkflowStore.temporal.getState().redo();
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
101
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
102
|
+
}, [
|
|
103
|
+
selectedNodeIds,
|
|
104
|
+
toggleNodeLock,
|
|
105
|
+
createGroup,
|
|
106
|
+
deleteGroup,
|
|
107
|
+
unlockAllNodes,
|
|
108
|
+
groups,
|
|
109
|
+
nodes,
|
|
110
|
+
addNode,
|
|
111
|
+
togglePalette,
|
|
112
|
+
fitView,
|
|
113
|
+
openShortcutHelp,
|
|
114
|
+
openNodeSearch
|
|
115
|
+
]);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { useCanvasKeyboardShortcuts };
|