@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.
Files changed (86) hide show
  1. package/dist/canvas.d.mts +27 -0
  2. package/dist/canvas.d.ts +27 -0
  3. package/dist/canvas.js +45 -0
  4. package/dist/canvas.mjs +16 -0
  5. package/dist/chunk-22PDGHNQ.mjs +737 -0
  6. package/dist/chunk-3SPPKCWR.js +458 -0
  7. package/dist/chunk-3YFFDHC5.js +300 -0
  8. package/dist/chunk-5HJFQVUR.js +61 -0
  9. package/dist/chunk-5LQ4QBR5.js +2 -0
  10. package/dist/chunk-6DOEUDD5.js +254 -0
  11. package/dist/chunk-7SKSRSS7.mjs +57 -0
  12. package/dist/chunk-AC6TWLRT.mjs +27 -0
  13. package/dist/chunk-ADWNF7V3.js +120 -0
  14. package/dist/chunk-BJ3R5R32.mjs +2163 -0
  15. package/dist/chunk-CETJJ73S.js +1555 -0
  16. package/dist/chunk-CSUBLSKZ.mjs +1002 -0
  17. package/dist/chunk-CV4M7CNU.mjs +251 -0
  18. package/dist/chunk-E323WAZG.mjs +272 -0
  19. package/dist/chunk-E544XUBL.js +378 -0
  20. package/dist/chunk-EC2ZIWOK.js +1007 -0
  21. package/dist/chunk-EFXQT23N.mjs +99 -0
  22. package/dist/chunk-EMUMKW5C.js +107 -0
  23. package/dist/chunk-FOMOOERN.js +2 -0
  24. package/dist/chunk-FT33LFII.mjs +21 -0
  25. package/dist/chunk-FT64PCUP.mjs +533 -0
  26. package/dist/chunk-H6LZKSLY.js +5678 -0
  27. package/dist/chunk-HPQT36RR.js +543 -0
  28. package/dist/chunk-JLWKW3G5.js +2 -0
  29. package/dist/chunk-L5TF4EHW.mjs +1 -0
  30. package/dist/chunk-LAJ34AH2.mjs +374 -0
  31. package/dist/chunk-LDN7IX4Y.mjs +1 -0
  32. package/dist/chunk-MLJJBBTB.mjs +1 -0
  33. package/dist/chunk-NSDLGLAQ.js +2166 -0
  34. package/dist/chunk-RJ262NXS.js +24 -0
  35. package/dist/chunk-RXNEDWK2.js +141 -0
  36. package/dist/chunk-SW7QNEZU.js +744 -0
  37. package/dist/chunk-UQQUWGHW.mjs +118 -0
  38. package/dist/chunk-VOGL2WCE.mjs +1542 -0
  39. package/dist/chunk-VRN3UWE5.mjs +138 -0
  40. package/dist/chunk-XV5Z5XYR.mjs +5640 -0
  41. package/dist/chunk-Z7PWFZG5.js +30 -0
  42. package/dist/chunk-ZJD5WMR3.mjs +418 -0
  43. package/dist/hooks.d.mts +255 -0
  44. package/dist/hooks.d.ts +255 -0
  45. package/dist/hooks.js +56 -0
  46. package/dist/hooks.mjs +11 -0
  47. package/dist/index.d.mts +29 -0
  48. package/dist/index.d.ts +29 -0
  49. package/dist/index.js +180 -0
  50. package/dist/index.mjs +19 -0
  51. package/dist/lib.d.mts +164 -0
  52. package/dist/lib.d.ts +164 -0
  53. package/dist/lib.js +144 -0
  54. package/dist/lib.mjs +3 -0
  55. package/dist/nodes.d.mts +128 -0
  56. package/dist/nodes.d.ts +128 -0
  57. package/dist/nodes.js +151 -0
  58. package/dist/nodes.mjs +14 -0
  59. package/dist/panels.d.mts +22 -0
  60. package/dist/panels.d.ts +22 -0
  61. package/dist/panels.js +21 -0
  62. package/dist/panels.mjs +4 -0
  63. package/dist/promptLibraryStore-BZnfmEkc.d.ts +464 -0
  64. package/dist/promptLibraryStore-zqb59nsu.d.mts +464 -0
  65. package/dist/provider.d.mts +29 -0
  66. package/dist/provider.d.ts +29 -0
  67. package/dist/provider.js +17 -0
  68. package/dist/provider.mjs +4 -0
  69. package/dist/stores.d.mts +96 -0
  70. package/dist/stores.d.ts +96 -0
  71. package/dist/stores.js +113 -0
  72. package/dist/stores.mjs +43 -0
  73. package/dist/toolbar.d.mts +73 -0
  74. package/dist/toolbar.d.ts +73 -0
  75. package/dist/toolbar.js +34 -0
  76. package/dist/toolbar.mjs +5 -0
  77. package/dist/types-ipAnBzAJ.d.mts +46 -0
  78. package/dist/types-ipAnBzAJ.d.ts +46 -0
  79. package/dist/ui.d.mts +67 -0
  80. package/dist/ui.d.ts +67 -0
  81. package/dist/ui.js +84 -0
  82. package/dist/ui.mjs +3 -0
  83. package/dist/workflowStore-4EGKJLYK.mjs +3 -0
  84. package/dist/workflowStore-KM32FDL7.js +12 -0
  85. package/package.json +117 -0
  86. package/src/styles/workflow-ui.css +186 -0
@@ -0,0 +1,138 @@
1
+ import { create } from 'zustand';
2
+
3
+ var _promptApi = null;
4
+ function configurePromptLibrary(api) {
5
+ _promptApi = api;
6
+ }
7
+ var usePromptLibraryStore = create((set, get) => ({
8
+ // Initial state
9
+ items: [],
10
+ featuredItems: [],
11
+ selectedItem: null,
12
+ isLoading: false,
13
+ error: null,
14
+ searchQuery: "",
15
+ categoryFilter: null,
16
+ isPickerOpen: false,
17
+ isCreateModalOpen: false,
18
+ editingItem: null,
19
+ // UI Actions
20
+ setSearchQuery: (query) => set({ searchQuery: query }),
21
+ setCategoryFilter: (category) => set({ categoryFilter: category }),
22
+ setSelectedItem: (item) => set({ selectedItem: item }),
23
+ openPicker: () => set({ isPickerOpen: true }),
24
+ closePicker: () => set({ isPickerOpen: false }),
25
+ openCreateModal: (editItem) => set({
26
+ isCreateModalOpen: true,
27
+ editingItem: editItem ?? null
28
+ }),
29
+ closeCreateModal: () => set({
30
+ isCreateModalOpen: false,
31
+ editingItem: null
32
+ }),
33
+ // API Actions — all no-op if _promptApi is not configured
34
+ loadItems: async (query, signal) => {
35
+ if (!_promptApi) return;
36
+ set({ isLoading: true, error: null });
37
+ try {
38
+ const { searchQuery, categoryFilter } = get();
39
+ const finalQuery = {
40
+ ...query,
41
+ search: query?.search ?? (searchQuery || void 0),
42
+ category: query?.category ?? categoryFilter ?? void 0
43
+ };
44
+ const items = await _promptApi.getAll(finalQuery, signal);
45
+ set({ items, isLoading: false });
46
+ } catch (error) {
47
+ if (error.name !== "AbortError") {
48
+ set({ error: error.message, isLoading: false });
49
+ }
50
+ }
51
+ },
52
+ loadFeatured: async (signal) => {
53
+ if (!_promptApi) return;
54
+ try {
55
+ const featuredItems = await _promptApi.getFeatured(10, signal);
56
+ set({ featuredItems });
57
+ } catch (error) {
58
+ if (error.name !== "AbortError") ;
59
+ }
60
+ },
61
+ createItem: async (data, signal) => {
62
+ if (!_promptApi) throw new Error("Prompt library not configured");
63
+ set({ isLoading: true, error: null });
64
+ try {
65
+ const item = await _promptApi.create(data, signal);
66
+ set((state) => ({
67
+ items: [item, ...state.items],
68
+ isLoading: false,
69
+ isCreateModalOpen: false,
70
+ editingItem: null
71
+ }));
72
+ return item;
73
+ } catch (error) {
74
+ set({ error: error.message, isLoading: false });
75
+ throw error;
76
+ }
77
+ },
78
+ updateItem: async (id, data, signal) => {
79
+ if (!_promptApi) throw new Error("Prompt library not configured");
80
+ set({ isLoading: true, error: null });
81
+ try {
82
+ const item = await _promptApi.update(id, data, signal);
83
+ set((state) => ({
84
+ items: state.items.map((i) => i._id === id ? item : i),
85
+ selectedItem: state.selectedItem?._id === id ? item : state.selectedItem,
86
+ isLoading: false,
87
+ isCreateModalOpen: false,
88
+ editingItem: null
89
+ }));
90
+ return item;
91
+ } catch (error) {
92
+ set({ error: error.message, isLoading: false });
93
+ throw error;
94
+ }
95
+ },
96
+ deleteItem: async (id, signal) => {
97
+ if (!_promptApi) throw new Error("Prompt library not configured");
98
+ try {
99
+ await _promptApi.delete(id, signal);
100
+ set((state) => ({
101
+ items: state.items.filter((i) => i._id !== id),
102
+ selectedItem: state.selectedItem?._id === id ? null : state.selectedItem
103
+ }));
104
+ } catch (error) {
105
+ set({ error: error.message });
106
+ throw error;
107
+ }
108
+ },
109
+ duplicateItem: async (id, signal) => {
110
+ if (!_promptApi) throw new Error("Prompt library not configured");
111
+ try {
112
+ const item = await _promptApi.duplicate(id, signal);
113
+ set((state) => ({
114
+ items: [item, ...state.items]
115
+ }));
116
+ return item;
117
+ } catch (error) {
118
+ set({ error: error.message });
119
+ throw error;
120
+ }
121
+ },
122
+ recordItemUsage: async (id, signal) => {
123
+ if (!_promptApi) throw new Error("Prompt library not configured");
124
+ try {
125
+ const item = await _promptApi.use(id, signal);
126
+ set((state) => ({
127
+ items: state.items.map((i) => i._id === id ? item : i),
128
+ isPickerOpen: false
129
+ }));
130
+ return item;
131
+ } catch (error) {
132
+ set({ error: error.message });
133
+ throw error;
134
+ }
135
+ }
136
+ }));
137
+
138
+ export { configurePromptLibrary, usePromptLibraryStore };