@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,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkRXNEDWK2_js = require('./chunk-RXNEDWK2.js');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
var WorkflowUIContext = react.createContext({});
|
|
8
|
+
function WorkflowUIProvider({
|
|
9
|
+
config,
|
|
10
|
+
children
|
|
11
|
+
}) {
|
|
12
|
+
react.useEffect(() => {
|
|
13
|
+
if (config.promptLibrary) {
|
|
14
|
+
chunkRXNEDWK2_js.configurePromptLibrary(config.promptLibrary);
|
|
15
|
+
}
|
|
16
|
+
}, [config.promptLibrary]);
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WorkflowUIContext.Provider, { value: config, children });
|
|
18
|
+
}
|
|
19
|
+
function useWorkflowUIConfig() {
|
|
20
|
+
return react.useContext(WorkflowUIContext);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
exports.WorkflowUIProvider = WorkflowUIProvider;
|
|
24
|
+
exports.useWorkflowUIConfig = useWorkflowUIConfig;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zustand = require('zustand');
|
|
4
|
+
|
|
5
|
+
var _promptApi = null;
|
|
6
|
+
function configurePromptLibrary(api) {
|
|
7
|
+
_promptApi = api;
|
|
8
|
+
}
|
|
9
|
+
var usePromptLibraryStore = zustand.create((set, get) => ({
|
|
10
|
+
// Initial state
|
|
11
|
+
items: [],
|
|
12
|
+
featuredItems: [],
|
|
13
|
+
selectedItem: null,
|
|
14
|
+
isLoading: false,
|
|
15
|
+
error: null,
|
|
16
|
+
searchQuery: "",
|
|
17
|
+
categoryFilter: null,
|
|
18
|
+
isPickerOpen: false,
|
|
19
|
+
isCreateModalOpen: false,
|
|
20
|
+
editingItem: null,
|
|
21
|
+
// UI Actions
|
|
22
|
+
setSearchQuery: (query) => set({ searchQuery: query }),
|
|
23
|
+
setCategoryFilter: (category) => set({ categoryFilter: category }),
|
|
24
|
+
setSelectedItem: (item) => set({ selectedItem: item }),
|
|
25
|
+
openPicker: () => set({ isPickerOpen: true }),
|
|
26
|
+
closePicker: () => set({ isPickerOpen: false }),
|
|
27
|
+
openCreateModal: (editItem) => set({
|
|
28
|
+
isCreateModalOpen: true,
|
|
29
|
+
editingItem: editItem ?? null
|
|
30
|
+
}),
|
|
31
|
+
closeCreateModal: () => set({
|
|
32
|
+
isCreateModalOpen: false,
|
|
33
|
+
editingItem: null
|
|
34
|
+
}),
|
|
35
|
+
// API Actions — all no-op if _promptApi is not configured
|
|
36
|
+
loadItems: async (query, signal) => {
|
|
37
|
+
if (!_promptApi) return;
|
|
38
|
+
set({ isLoading: true, error: null });
|
|
39
|
+
try {
|
|
40
|
+
const { searchQuery, categoryFilter } = get();
|
|
41
|
+
const finalQuery = {
|
|
42
|
+
...query,
|
|
43
|
+
search: query?.search ?? (searchQuery || void 0),
|
|
44
|
+
category: query?.category ?? categoryFilter ?? void 0
|
|
45
|
+
};
|
|
46
|
+
const items = await _promptApi.getAll(finalQuery, signal);
|
|
47
|
+
set({ items, isLoading: false });
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (error.name !== "AbortError") {
|
|
50
|
+
set({ error: error.message, isLoading: false });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
loadFeatured: async (signal) => {
|
|
55
|
+
if (!_promptApi) return;
|
|
56
|
+
try {
|
|
57
|
+
const featuredItems = await _promptApi.getFeatured(10, signal);
|
|
58
|
+
set({ featuredItems });
|
|
59
|
+
} catch (error) {
|
|
60
|
+
if (error.name !== "AbortError") ;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
createItem: async (data, signal) => {
|
|
64
|
+
if (!_promptApi) throw new Error("Prompt library not configured");
|
|
65
|
+
set({ isLoading: true, error: null });
|
|
66
|
+
try {
|
|
67
|
+
const item = await _promptApi.create(data, signal);
|
|
68
|
+
set((state) => ({
|
|
69
|
+
items: [item, ...state.items],
|
|
70
|
+
isLoading: false,
|
|
71
|
+
isCreateModalOpen: false,
|
|
72
|
+
editingItem: null
|
|
73
|
+
}));
|
|
74
|
+
return item;
|
|
75
|
+
} catch (error) {
|
|
76
|
+
set({ error: error.message, isLoading: false });
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
updateItem: async (id, data, signal) => {
|
|
81
|
+
if (!_promptApi) throw new Error("Prompt library not configured");
|
|
82
|
+
set({ isLoading: true, error: null });
|
|
83
|
+
try {
|
|
84
|
+
const item = await _promptApi.update(id, data, signal);
|
|
85
|
+
set((state) => ({
|
|
86
|
+
items: state.items.map((i) => i._id === id ? item : i),
|
|
87
|
+
selectedItem: state.selectedItem?._id === id ? item : state.selectedItem,
|
|
88
|
+
isLoading: false,
|
|
89
|
+
isCreateModalOpen: false,
|
|
90
|
+
editingItem: null
|
|
91
|
+
}));
|
|
92
|
+
return item;
|
|
93
|
+
} catch (error) {
|
|
94
|
+
set({ error: error.message, isLoading: false });
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
deleteItem: async (id, signal) => {
|
|
99
|
+
if (!_promptApi) throw new Error("Prompt library not configured");
|
|
100
|
+
try {
|
|
101
|
+
await _promptApi.delete(id, signal);
|
|
102
|
+
set((state) => ({
|
|
103
|
+
items: state.items.filter((i) => i._id !== id),
|
|
104
|
+
selectedItem: state.selectedItem?._id === id ? null : state.selectedItem
|
|
105
|
+
}));
|
|
106
|
+
} catch (error) {
|
|
107
|
+
set({ error: error.message });
|
|
108
|
+
throw error;
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
duplicateItem: async (id, signal) => {
|
|
112
|
+
if (!_promptApi) throw new Error("Prompt library not configured");
|
|
113
|
+
try {
|
|
114
|
+
const item = await _promptApi.duplicate(id, signal);
|
|
115
|
+
set((state) => ({
|
|
116
|
+
items: [item, ...state.items]
|
|
117
|
+
}));
|
|
118
|
+
return item;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
set({ error: error.message });
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
recordItemUsage: async (id, signal) => {
|
|
125
|
+
if (!_promptApi) throw new Error("Prompt library not configured");
|
|
126
|
+
try {
|
|
127
|
+
const item = await _promptApi.use(id, signal);
|
|
128
|
+
set((state) => ({
|
|
129
|
+
items: state.items.map((i) => i._id === id ? item : i),
|
|
130
|
+
isPickerOpen: false
|
|
131
|
+
}));
|
|
132
|
+
return item;
|
|
133
|
+
} catch (error) {
|
|
134
|
+
set({ error: error.message });
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}));
|
|
139
|
+
|
|
140
|
+
exports.configurePromptLibrary = configurePromptLibrary;
|
|
141
|
+
exports.usePromptLibraryStore = usePromptLibraryStore;
|