use-vibes 0.5.7 → 0.11.0-dev-preview1
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 -7
- package/components/ControlsBar.d.ts +20 -0
- package/components/ControlsBar.js +80 -0
- package/components/ControlsBar.js.map +1 -0
- package/{dist/components → components}/ImgGen.css +21 -13
- package/components/ImgGen.d.ts +25 -0
- package/{dist/components → components}/ImgGen.js +25 -119
- package/components/ImgGen.js.map +1 -0
- package/{dist/components → components}/ImgGenUtils/ImgGenDisplay.d.ts +2 -2
- package/components/ImgGenUtils/ImgGenDisplay.js +192 -0
- package/components/ImgGenUtils/ImgGenDisplay.js.map +1 -0
- package/components/ImgGenUtils/ImgGenDisplayPlaceholder.d.ts +3 -0
- package/components/ImgGenUtils/ImgGenDisplayPlaceholder.js +107 -0
- package/components/ImgGenUtils/ImgGenDisplayPlaceholder.js.map +1 -0
- package/components/ImgGenUtils/ImgGenDisplayUtils.d.ts +27 -0
- package/{dist/components → components}/ImgGenUtils/ImgGenDisplayUtils.js +4 -36
- package/components/ImgGenUtils/ImgGenDisplayUtils.js.map +1 -0
- package/components/ImgGenUtils/ImgGenError.d.ts +3 -0
- package/components/ImgGenUtils/ImgGenError.js +6 -0
- package/components/ImgGenUtils/ImgGenError.js.map +1 -0
- package/components/ImgGenUtils/ImgGenFileDrop.d.ts +12 -0
- package/{dist/components → components}/ImgGenUtils/ImgGenFileDrop.js +2 -9
- package/components/ImgGenUtils/ImgGenFileDrop.js.map +1 -0
- package/components/ImgGenUtils/ImgGenModal.d.ts +24 -0
- package/components/ImgGenUtils/ImgGenModal.js +28 -0
- package/components/ImgGenUtils/ImgGenModal.js.map +1 -0
- package/components/ImgGenUtils/ImgGenModeUtils.d.ts +9 -0
- package/{dist/components → components}/ImgGenUtils/ImgGenModeUtils.js +0 -15
- package/components/ImgGenUtils/ImgGenModeUtils.js.map +1 -0
- package/components/ImgGenUtils/ImgGenPromptWaiting.d.ts +12 -0
- package/{dist/components → components}/ImgGenUtils/ImgGenPromptWaiting.js +3 -15
- package/components/ImgGenUtils/ImgGenPromptWaiting.js.map +1 -0
- package/components/ImgGenUtils/ImgGenUploadWaiting.d.ts +17 -0
- package/{dist/components → components}/ImgGenUtils/ImgGenUploadWaiting.js +3 -52
- package/components/ImgGenUtils/ImgGenUploadWaiting.js.map +1 -0
- package/components/ImgGenUtils/index.d.ts +6 -0
- package/components/ImgGenUtils/index.js +7 -0
- package/components/ImgGenUtils/index.js.map +1 -0
- package/components/ImgGenUtils/overlays/DeleteConfirmationOverlay.d.ts +9 -0
- package/{dist/components → components}/ImgGenUtils/overlays/DeleteConfirmationOverlay.js +8 -10
- package/components/ImgGenUtils/overlays/DeleteConfirmationOverlay.js.map +1 -0
- package/components/ImgGenUtils/overlays/ImageOverlay.d.ts +22 -0
- package/components/ImgGenUtils/overlays/ImageOverlay.js +8 -0
- package/components/ImgGenUtils/overlays/ImageOverlay.js.map +1 -0
- package/components/ImgGenUtils/types.d.ts +29 -0
- package/components/ImgGenUtils/types.js.map +1 -0
- package/components/ImgGenUtils.d.ts +2 -0
- package/components/ImgGenUtils.js +3 -0
- package/components/ImgGenUtils.js.map +1 -0
- package/components/PromptBar.d.ts +11 -0
- package/components/PromptBar.js +16 -0
- package/components/PromptBar.js.map +1 -0
- package/hooks/image-gen/image-generator.d.ts +11 -0
- package/{dist/hooks → hooks}/image-gen/image-generator.js +2 -42
- package/hooks/image-gen/image-generator.js.map +1 -0
- package/hooks/image-gen/index.d.ts +7 -0
- package/hooks/image-gen/index.js +6 -0
- package/hooks/image-gen/index.js.map +1 -0
- package/hooks/image-gen/types.d.ts +66 -0
- package/{dist/hooks → hooks}/image-gen/types.js.map +1 -1
- package/hooks/image-gen/use-image-gen.d.ts +4 -0
- package/hooks/image-gen/use-image-gen.js +544 -0
- package/hooks/image-gen/use-image-gen.js.map +1 -0
- package/hooks/image-gen/utils.d.ts +20 -0
- package/{dist/hooks → hooks}/image-gen/utils.js +11 -93
- package/hooks/image-gen/utils.js.map +1 -0
- package/hooks/use-image-gen.d.ts +1 -0
- package/hooks/use-image-gen.js +2 -0
- package/hooks/use-image-gen.js.map +1 -0
- package/index.d.ts +20 -0
- package/index.js +21 -0
- package/index.js.map +1 -0
- package/package.json +23 -24
- package/style-loader.d.ts +1 -0
- package/style-loader.js +23 -0
- package/style-loader.js.map +1 -0
- package/tsconfig.json +18 -0
- package/{dist/utils → utils}/base64.js +0 -4
- package/utils/base64.js.map +1 -0
- package/{dist/utils → utils}/debug.js +0 -1
- package/utils/debug.js.map +1 -0
- package/utils/style-utils.d.ts +17 -0
- package/utils/style-utils.js +15 -0
- package/utils/style-utils.js.map +1 -0
- package/dist/components/ControlsBar.d.ts +0 -32
- package/dist/components/ControlsBar.js +0 -109
- package/dist/components/ControlsBar.js.map +0 -1
- package/dist/components/ImgGen.d.ts +0 -42
- package/dist/components/ImgGen.js.map +0 -1
- package/dist/components/ImgGenUtils/ImgGenDisplay.js +0 -264
- package/dist/components/ImgGenUtils/ImgGenDisplay.js.map +0 -1
- package/dist/components/ImgGenUtils/ImgGenDisplayPlaceholder.d.ts +0 -3
- package/dist/components/ImgGenUtils/ImgGenDisplayPlaceholder.js +0 -125
- package/dist/components/ImgGenUtils/ImgGenDisplayPlaceholder.js.map +0 -1
- package/dist/components/ImgGenUtils/ImgGenDisplayUtils.d.ts +0 -44
- package/dist/components/ImgGenUtils/ImgGenDisplayUtils.js.map +0 -1
- package/dist/components/ImgGenUtils/ImgGenError.d.ts +0 -3
- package/dist/components/ImgGenUtils/ImgGenError.js +0 -9
- package/dist/components/ImgGenUtils/ImgGenError.js.map +0 -1
- package/dist/components/ImgGenUtils/ImgGenFileDrop.d.ts +0 -21
- package/dist/components/ImgGenUtils/ImgGenFileDrop.js.map +0 -1
- package/dist/components/ImgGenUtils/ImgGenModal.d.ts +0 -31
- package/dist/components/ImgGenUtils/ImgGenModal.js +0 -34
- package/dist/components/ImgGenUtils/ImgGenModal.js.map +0 -1
- package/dist/components/ImgGenUtils/ImgGenModeUtils.d.ts +0 -16
- package/dist/components/ImgGenUtils/ImgGenModeUtils.js.map +0 -1
- package/dist/components/ImgGenUtils/ImgGenPromptWaiting.d.ts +0 -17
- package/dist/components/ImgGenUtils/ImgGenPromptWaiting.js.map +0 -1
- package/dist/components/ImgGenUtils/ImgGenUploadWaiting.d.ts +0 -30
- package/dist/components/ImgGenUtils/ImgGenUploadWaiting.js.map +0 -1
- package/dist/components/ImgGenUtils/index.d.ts +0 -6
- package/dist/components/ImgGenUtils/index.js +0 -9
- package/dist/components/ImgGenUtils/index.js.map +0 -1
- package/dist/components/ImgGenUtils/overlays/DeleteConfirmationOverlay.d.ts +0 -10
- package/dist/components/ImgGenUtils/overlays/DeleteConfirmationOverlay.js.map +0 -1
- package/dist/components/ImgGenUtils/overlays/ImageOverlay.d.ts +0 -29
- package/dist/components/ImgGenUtils/overlays/ImageOverlay.js +0 -11
- package/dist/components/ImgGenUtils/overlays/ImageOverlay.js.map +0 -1
- package/dist/components/ImgGenUtils/types.d.ts +0 -43
- package/dist/components/ImgGenUtils/types.js.map +0 -1
- package/dist/components/ImgGenUtils.d.ts +0 -6
- package/dist/components/ImgGenUtils.js +0 -7
- package/dist/components/ImgGenUtils.js.map +0 -1
- package/dist/components/PromptBar.d.ts +0 -15
- package/dist/components/PromptBar.js +0 -23
- package/dist/components/PromptBar.js.map +0 -1
- package/dist/hooks/image-gen/image-generator.d.ts +0 -18
- package/dist/hooks/image-gen/image-generator.js.map +0 -1
- package/dist/hooks/image-gen/index.d.ts +0 -6
- package/dist/hooks/image-gen/index.js +0 -6
- package/dist/hooks/image-gen/index.js.map +0 -1
- package/dist/hooks/image-gen/types.d.ts +0 -75
- package/dist/hooks/image-gen/use-image-gen.d.ts +0 -12
- package/dist/hooks/image-gen/use-image-gen.js +0 -675
- package/dist/hooks/image-gen/use-image-gen.js.map +0 -1
- package/dist/hooks/image-gen/utils.d.ts +0 -61
- package/dist/hooks/image-gen/utils.js.map +0 -1
- package/dist/hooks/use-image-gen.d.ts +0 -5
- package/dist/hooks/use-image-gen.js +0 -7
- package/dist/hooks/use-image-gen.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -8
- package/dist/index.js.map +0 -1
- package/dist/style-loader.d.ts +0 -16
- package/dist/style-loader.js +0 -43
- package/dist/style-loader.js.map +0 -1
- package/dist/utils/base64.js.map +0 -1
- package/dist/utils/debug.js.map +0 -1
- package/dist/utils/style-utils.d.ts +0 -55
- package/dist/utils/style-utils.js +0 -42
- package/dist/utils/style-utils.js.map +0 -1
- /package/{dist/components → components}/ImgGenUtils/types.js +0 -0
- /package/{dist/hooks → hooks}/image-gen/types.js +0 -0
- /package/{dist/utils → utils}/base64.d.ts +0 -0
- /package/{dist/utils → utils}/debug.d.ts +0 -0
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// Module-level state for tracking and preventing duplicate calls
|
|
2
1
|
export const MODULE_STATE = {
|
|
3
2
|
pendingImageGenCalls: new Map(),
|
|
4
3
|
pendingPrompts: new Set(),
|
|
@@ -6,66 +5,38 @@ export const MODULE_STATE = {
|
|
|
6
5
|
requestTimestamps: new Map(),
|
|
7
6
|
requestCounter: 0,
|
|
8
7
|
createdDocuments: new Map(), // Track document IDs created for each generation request
|
|
9
|
-
pendingDocumentCreations: new Map(),
|
|
8
|
+
pendingDocumentCreations: new Map(),
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
export const cleanupRequestKey = (key) => {
|
|
10
|
+
export function cleanupRequestKey(key) {
|
|
13
11
|
MODULE_STATE.pendingImageGenCalls.delete(key);
|
|
14
12
|
MODULE_STATE.processingRequests.delete(key);
|
|
15
13
|
MODULE_STATE.pendingPrompts.delete(key);
|
|
16
|
-
// We also clean up the document creation promise to prevent memory leaks
|
|
17
14
|
MODULE_STATE.pendingDocumentCreations.delete(key);
|
|
18
|
-
// Keep the createdDocuments entry as it's the actual deduplication map
|
|
19
|
-
// But do clean up the timestamp to prevent memory leaks
|
|
20
15
|
MODULE_STATE.requestTimestamps.delete(key);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
setInterval(() => {
|
|
16
|
+
}
|
|
17
|
+
export const cleanupInterval = setInterval(() => {
|
|
24
18
|
const now = Date.now();
|
|
25
19
|
for (const [key, timestamp] of MODULE_STATE.requestTimestamps.entries()) {
|
|
26
20
|
if (now - timestamp > 5 * 60 * 1000) {
|
|
27
|
-
// For stale requests that are over 5 minutes old,
|
|
28
|
-
// also remove them from createdDocuments tracking
|
|
29
21
|
MODULE_STATE.createdDocuments.delete(key);
|
|
30
|
-
// Clean up all other state
|
|
31
22
|
cleanupRequestKey(key);
|
|
32
23
|
}
|
|
33
24
|
}
|
|
34
|
-
}, 60000);
|
|
35
|
-
/**
|
|
36
|
-
* Synchronous hash function to create a key from the prompt string and options
|
|
37
|
-
* @param prompt The prompt string to hash
|
|
38
|
-
* @param options Optional image generation options
|
|
39
|
-
* @returns A hash string for the input
|
|
40
|
-
*/
|
|
25
|
+
}, 60000);
|
|
41
26
|
export function hashInput(prompt, options) {
|
|
42
|
-
// Create a string that includes both prompt and relevant options
|
|
43
27
|
const inputString = JSON.stringify({
|
|
44
28
|
prompt,
|
|
45
|
-
|
|
46
|
-
options: options
|
|
47
|
-
? {
|
|
48
|
-
size: options.size,
|
|
49
|
-
quality: options.quality,
|
|
50
|
-
model: options.model,
|
|
51
|
-
style: options.style,
|
|
52
|
-
}
|
|
53
|
-
: undefined,
|
|
29
|
+
options,
|
|
54
30
|
});
|
|
55
|
-
|
|
56
|
-
let hash = 2166136261; // FNV offset basis
|
|
31
|
+
let hash = 2166136261;
|
|
57
32
|
for (let i = 0; i < inputString.length; i++) {
|
|
58
33
|
hash ^= inputString.charCodeAt(i);
|
|
59
|
-
// Multiply by the FNV prime (32-bit)
|
|
60
34
|
hash = Math.imul(hash, 16777619);
|
|
61
35
|
}
|
|
62
|
-
// Convert to hex string and take first 12 chars
|
|
63
36
|
const hashHex = (hash >>> 0).toString(16).padStart(8, '0');
|
|
64
37
|
const requestId = hashHex.slice(0, 12);
|
|
65
|
-
// Add a timestamp to make the ID unique even for identical requests
|
|
66
38
|
return `${requestId}-${Date.now().toString(36)}`;
|
|
67
39
|
}
|
|
68
|
-
// Convert base64 to File object
|
|
69
40
|
export function base64ToFile(base64Data, filename) {
|
|
70
41
|
const byteString = atob(base64Data);
|
|
71
42
|
const ab = new ArrayBuffer(byteString.length);
|
|
@@ -76,59 +47,34 @@ export function base64ToFile(base64Data, filename) {
|
|
|
76
47
|
const blob = new Blob([ab], { type: 'image/png' });
|
|
77
48
|
return new File([blob], filename, { type: 'image/png' });
|
|
78
49
|
}
|
|
79
|
-
/**
|
|
80
|
-
* Generate a version ID for the file namespace
|
|
81
|
-
* @param versionNumber - The numeric version (1-based)
|
|
82
|
-
* @returns A formatted version string like "v1", "v2", etc.
|
|
83
|
-
*/
|
|
84
50
|
export function generateVersionId(versionNumber) {
|
|
85
51
|
return `v${versionNumber}`;
|
|
86
52
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Get all version information from a document, or create a default if none exists
|
|
89
|
-
* @param document - The image document
|
|
90
|
-
* @returns Array of version info objects
|
|
91
|
-
*/
|
|
92
53
|
export function getVersionsFromDocument(document) {
|
|
93
|
-
// Check if document has proper version structure
|
|
94
54
|
if (document?.versions && document.versions.length > 0) {
|
|
95
55
|
return {
|
|
96
56
|
versions: document.versions,
|
|
97
57
|
currentVersion: document.currentVersion ?? document.versions.length,
|
|
98
58
|
};
|
|
99
59
|
}
|
|
100
|
-
// Legacy document with just an 'image' file - convert to version format
|
|
101
60
|
if (document?._files?.image) {
|
|
102
61
|
return {
|
|
103
62
|
versions: [{ id: 'v1', created: document.created || Date.now() }],
|
|
104
63
|
currentVersion: 1,
|
|
105
64
|
};
|
|
106
65
|
}
|
|
107
|
-
// No versions found
|
|
108
66
|
return { versions: [], currentVersion: 0 };
|
|
109
67
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Generate a prompt key for the prompts namespace
|
|
112
|
-
* @param promptNumber - The numeric prompt (1-based)
|
|
113
|
-
* @returns A formatted prompt string like "p1", "p2", etc.
|
|
114
|
-
*/
|
|
115
68
|
export function generatePromptKey(promptNumber) {
|
|
116
69
|
return `p${promptNumber}`;
|
|
117
70
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Get all prompt information from a document, or create a default if none exists
|
|
120
|
-
* @param document - The image document
|
|
121
|
-
* @returns Object with prompts record and currentPromptKey
|
|
122
|
-
*/
|
|
123
71
|
export function getPromptsFromDocument(document) {
|
|
124
|
-
// Check if document has proper prompts structure
|
|
125
72
|
if (document?.prompts && document?.currentPromptKey) {
|
|
126
73
|
return {
|
|
127
74
|
prompts: document.prompts,
|
|
128
75
|
currentPromptKey: document.currentPromptKey,
|
|
129
76
|
};
|
|
130
77
|
}
|
|
131
|
-
// Legacy document with just a 'prompt' string - convert to prompts format
|
|
132
78
|
if (document?.prompt) {
|
|
133
79
|
return {
|
|
134
80
|
prompts: {
|
|
@@ -137,27 +83,15 @@ export function getPromptsFromDocument(document) {
|
|
|
137
83
|
currentPromptKey: 'p1',
|
|
138
84
|
};
|
|
139
85
|
}
|
|
140
|
-
// No prompts found
|
|
141
86
|
return { prompts: {}, currentPromptKey: '' };
|
|
142
87
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Add a new version to an image document
|
|
145
|
-
* @param document - The existing image document
|
|
146
|
-
* @param newImageFile - The new image file to add as a version
|
|
147
|
-
* @param newPrompt - Optional new prompt to use for this version
|
|
148
|
-
* @returns Updated document with the new version added
|
|
149
|
-
*/
|
|
150
88
|
export function addNewVersion(document, newImageFile, newPrompt) {
|
|
151
|
-
// Get existing versions or initialize
|
|
152
89
|
const { versions } = getVersionsFromDocument(document);
|
|
153
90
|
const versionCount = versions.length + 1;
|
|
154
91
|
const newVersionId = generateVersionId(versionCount);
|
|
155
|
-
// Get existing prompts or initialize
|
|
156
92
|
const { prompts, currentPromptKey } = getPromptsFromDocument(document);
|
|
157
|
-
// Handle prompt versioning
|
|
158
93
|
const updatedPrompts = { ...prompts };
|
|
159
94
|
let updatedCurrentPromptKey = currentPromptKey;
|
|
160
|
-
// If a new prompt is provided and it's different from the current one, create a new prompt version
|
|
161
95
|
if (newPrompt && (!currentPromptKey || newPrompt !== prompts[currentPromptKey]?.text)) {
|
|
162
96
|
const promptCount = Object.keys(updatedPrompts).length + 1;
|
|
163
97
|
updatedCurrentPromptKey = generatePromptKey(promptCount);
|
|
@@ -167,17 +101,14 @@ export function addNewVersion(document, newImageFile, newPrompt) {
|
|
|
167
101
|
};
|
|
168
102
|
}
|
|
169
103
|
else if (!updatedCurrentPromptKey && document.prompt) {
|
|
170
|
-
// Legacy migration - create p1 from document.prompt
|
|
171
104
|
updatedCurrentPromptKey = 'p1';
|
|
172
105
|
updatedPrompts['p1'] = {
|
|
173
106
|
text: document.prompt,
|
|
174
107
|
created: document.created || Date.now(),
|
|
175
108
|
};
|
|
176
109
|
}
|
|
177
|
-
// Copy existing files and add the new version
|
|
178
110
|
const updatedFiles = { ...(document._files || {}) };
|
|
179
111
|
updatedFiles[newVersionId] = newImageFile;
|
|
180
|
-
// Handle legacy documents by migrating 'image' to 'v1' if needed
|
|
181
112
|
if (versionCount === 1 && document._files?.image) {
|
|
182
113
|
updatedFiles['v1'] = document._files.image;
|
|
183
114
|
delete updatedFiles.image;
|
|
@@ -198,10 +129,6 @@ export function addNewVersion(document, newImageFile, newPrompt) {
|
|
|
198
129
|
_files: updatedFiles,
|
|
199
130
|
};
|
|
200
131
|
}
|
|
201
|
-
/**
|
|
202
|
-
* Extract only the options properties that matter for image generation
|
|
203
|
-
* to avoid unnecessary re-renders or regenerations
|
|
204
|
-
*/
|
|
205
132
|
export function getRelevantOptions(options) {
|
|
206
133
|
if (!options)
|
|
207
134
|
return {};
|
|
@@ -216,26 +143,17 @@ export function getRelevantOptions(options) {
|
|
|
216
143
|
relevantOptions.style = options.style;
|
|
217
144
|
return relevantOptions;
|
|
218
145
|
}
|
|
219
|
-
/**
|
|
220
|
-
* Generate a safe filename based on prompt text and timestamp
|
|
221
|
-
* @param promptText - The prompt text to include in the filename
|
|
222
|
-
* @returns A formatted filename like "prompt-text-20250518-2117.png"
|
|
223
|
-
*/
|
|
224
146
|
export function generateSafeFilename(promptText) {
|
|
225
|
-
// Limit prompt length to avoid extremely long filenames
|
|
226
147
|
const maxPromptChars = 40;
|
|
227
|
-
// Clean the prompt by removing special characters and converting to lowercase
|
|
228
148
|
const cleanedPrompt = promptText
|
|
229
149
|
.toLowerCase()
|
|
230
|
-
.replace(/[^a-z0-9\s-]/g, '')
|
|
231
|
-
.replace(/\s+/g, '-')
|
|
232
|
-
.substring(0, maxPromptChars)
|
|
233
|
-
.replace(/-+$/g, '');
|
|
234
|
-
// Generate date part in format YYYYMMDD-HHMM
|
|
150
|
+
.replace(/[^a-z0-9\s-]/g, '')
|
|
151
|
+
.replace(/\s+/g, '-')
|
|
152
|
+
.substring(0, maxPromptChars)
|
|
153
|
+
.replace(/-+$/g, '');
|
|
235
154
|
const now = new Date();
|
|
236
155
|
const datePart = `${now.getFullYear()}${String(now.getMonth() + 1).padStart(2, '0')}${String(now.getDate()).padStart(2, '0')}`;
|
|
237
156
|
const timePart = `${String(now.getHours()).padStart(2, '0')}${String(now.getMinutes()).padStart(2, '0')}`;
|
|
238
|
-
// Construct filename
|
|
239
157
|
return `${cleanedPrompt}-${datePart}-${timePart}.png`;
|
|
240
158
|
}
|
|
241
159
|
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../jsr/hooks/image-gen/utils.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,YAAY,GAAgB;IACvC,oBAAoB,EAAE,IAAI,GAAG,EAAE;IAC/B,cAAc,EAAE,IAAI,GAAG,EAAE;IACzB,kBAAkB,EAAE,IAAI,GAAG,EAAE;IAC7B,iBAAiB,EAAE,IAAI,GAAG,EAAE;IAC5B,cAAc,EA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SAC7B,WAAW,EAAE;SACb,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC;SAC5B,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,SAAS,CAAC,CAAC,EAAE,cAAc,CAAC;SAC5B,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAGvB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,MAAM,CAC1F,GAAG,CAAC,OAAO,EAAE,CACd,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IACrB,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAC7F,CAAC,EACD,GAAG,CACJ,EAAE,CAAC;IAGJ,OAAO,GAAG,aAAa,IAAI,QAAQ,IAAI,QAAQ,MAAM,CAAC;AAAA,CACvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './image-gen/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-image-gen.js","sourceRoot":"","sources":["../../jsr/hooks/use-image-gen.ts"],"names":[],"mappings":"AAMA,cAAc,sBAAsB,CAAC"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from 'use-fireproof';
|
|
2
|
+
import { useFireproof as originalUseFireproof } from 'use-fireproof';
|
|
3
|
+
export declare const useFireproof: typeof originalUseFireproof;
|
|
4
|
+
import { imageGen, callAi, type ImageGenOptions, type ImageResponse } from 'call-ai';
|
|
5
|
+
export { imageGen, callAi, type ImageGenOptions, type ImageResponse };
|
|
6
|
+
export { default as ImgGen } from './components/ImgGen.js';
|
|
7
|
+
export type { ImgGenProps } from './components/ImgGen.js';
|
|
8
|
+
export { ControlsBar } from './components/ControlsBar.js';
|
|
9
|
+
export { useImageGen, hashInput } from './hooks/image-gen/index.js';
|
|
10
|
+
export { type ImgGenClasses, defaultClasses } from './utils/style-utils.js';
|
|
11
|
+
export { base64ToFile } from './utils/base64.js';
|
|
12
|
+
export { PromptBar } from './components/PromptBar.js';
|
|
13
|
+
export { ImageOverlay } from './components/ImgGenUtils/overlays/ImageOverlay.js';
|
|
14
|
+
export { MODULE_STATE } from './hooks/image-gen/utils.js';
|
|
15
|
+
export { type ImageDocument } from './hooks/image-gen/types.js';
|
|
16
|
+
export { addNewVersion } from './hooks/image-gen/utils.js';
|
|
17
|
+
export { ImgGenDisplay } from './components/ImgGenUtils/ImgGenDisplay.js';
|
|
18
|
+
export { ImgGenModal } from './components/ImgGenUtils/ImgGenModal.jsx';
|
|
19
|
+
export { ImgGenDisplayPlaceholder } from './components/ImgGenUtils/ImgGenDisplayPlaceholder.js';
|
|
20
|
+
export { type UseImageGenOptions, type UseImageGenResult, type PartialImageDocument, } from './hooks/image-gen/types.js';
|
package/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from 'use-fireproof';
|
|
2
|
+
import { useFireproof as originalUseFireproof } from 'use-fireproof';
|
|
3
|
+
export const useFireproof = (...args) => {
|
|
4
|
+
console.log('Using vibes-customized useFireproof');
|
|
5
|
+
return originalUseFireproof(...args);
|
|
6
|
+
};
|
|
7
|
+
import { imageGen, callAi } from 'call-ai';
|
|
8
|
+
export { imageGen, callAi };
|
|
9
|
+
export { default as ImgGen } from './components/ImgGen.js';
|
|
10
|
+
export { ControlsBar } from './components/ControlsBar.js';
|
|
11
|
+
export { useImageGen, hashInput } from './hooks/image-gen/index.js';
|
|
12
|
+
export { defaultClasses } from './utils/style-utils.js';
|
|
13
|
+
export { base64ToFile } from './utils/base64.js';
|
|
14
|
+
export { PromptBar } from './components/PromptBar.js';
|
|
15
|
+
export { ImageOverlay } from './components/ImgGenUtils/overlays/ImageOverlay.js';
|
|
16
|
+
export { MODULE_STATE } from './hooks/image-gen/utils.js';
|
|
17
|
+
export { addNewVersion } from './hooks/image-gen/utils.js';
|
|
18
|
+
export { ImgGenDisplay } from './components/ImgGenUtils/ImgGenDisplay.js';
|
|
19
|
+
export { ImgGenModal } from './components/ImgGenUtils/ImgGenModal.jsx';
|
|
20
|
+
export { ImgGenDisplayPlaceholder } from './components/ImgGenUtils/ImgGenDisplayPlaceholder.js';
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AACA,cAAc,eAAe,CAAC;AAG9B,OAAO,EAAE,YAAY,IAAI,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAIrE,MAAM,CAAC,MAAM,YAAY,GAAgC,CACvD,GAAG,IAA6C,EAChD,EAAE,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IACnD,OAAO,oBAAoB,CAAC,GAAG,IAAI,CAAC,CAAC;AAAA,CACtC,CAAC;AAGF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAA4C,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,EAA4C,CAAC;AAGtE,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAGpE,OAAO,EAAsB,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAG5E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAI1D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-vibes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0-dev-preview1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Transform any DOM element into an AI-powered micro-app",
|
|
6
|
-
"main": "dist/index.js",
|
|
7
|
-
"module": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
6
|
"exports": {
|
|
10
7
|
".": {
|
|
11
|
-
"types": "./
|
|
12
|
-
"import": "./
|
|
13
|
-
"require": "./dist/index.js"
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"import": "./index.js"
|
|
14
10
|
},
|
|
15
11
|
"./style-loader": {
|
|
16
|
-
"types": "./
|
|
17
|
-
"import": "./
|
|
18
|
-
"require": "./dist/style-loader.js"
|
|
12
|
+
"types": "./style-loader.d.ts",
|
|
13
|
+
"import": "./style-loader.js"
|
|
19
14
|
}
|
|
20
15
|
},
|
|
21
|
-
"files": [
|
|
22
|
-
"dist"
|
|
23
|
-
],
|
|
24
16
|
"keywords": [
|
|
25
17
|
"ai",
|
|
26
18
|
"dom",
|
|
@@ -30,36 +22,43 @@
|
|
|
30
22
|
"esm",
|
|
31
23
|
"typescript"
|
|
32
24
|
],
|
|
33
|
-
"
|
|
34
|
-
|
|
25
|
+
"contributors": [
|
|
26
|
+
"J Chris Anderson",
|
|
27
|
+
"Meno Abels"
|
|
28
|
+
],
|
|
29
|
+
"license": "Apache-2.0",
|
|
35
30
|
"dependencies": {
|
|
36
|
-
"call-ai": "
|
|
37
|
-
"use-fireproof": "
|
|
31
|
+
"call-ai": "0.11.0-dev-preview1",
|
|
32
|
+
"use-fireproof": "0.23.5",
|
|
38
33
|
"uuid": "^11.1.0"
|
|
39
34
|
},
|
|
40
35
|
"peerDependencies": {
|
|
41
36
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
42
37
|
},
|
|
43
38
|
"devDependencies": {
|
|
39
|
+
"@eslint/js": "^9.31.0",
|
|
40
|
+
"@fireproof/core-cli": "^0.23.6",
|
|
44
41
|
"@testing-library/jest-dom": "^6.6.3",
|
|
45
42
|
"@testing-library/react": "^16.3.0",
|
|
46
43
|
"@types/react": "^19.1.0",
|
|
47
44
|
"@types/react-dom": "^19.1.2",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^8.32.1",
|
|
49
|
-
"@typescript-eslint/parser": "^8.32.1",
|
|
50
45
|
"@vitejs/plugin-react": "^4.4.1",
|
|
51
|
-
"
|
|
46
|
+
"@vitest/browser": "^3.2.4",
|
|
47
|
+
"eslint": "^9.31.0",
|
|
52
48
|
"eslint-plugin-import": "^2.31.0",
|
|
53
49
|
"eslint-plugin-react": "^7.37.5",
|
|
54
50
|
"jsdom": "^26.1.0",
|
|
55
|
-
"
|
|
51
|
+
"playwright": "^1.54.1",
|
|
52
|
+
"playwright-chromium": "^1.54.1",
|
|
53
|
+
"prettier": "^3.6.2",
|
|
56
54
|
"react-dom": "^19.1.0",
|
|
57
55
|
"rimraf": "^5.0.5",
|
|
58
|
-
"typescript": "^5.
|
|
59
|
-
"
|
|
56
|
+
"typescript": "^5.8.2",
|
|
57
|
+
"typescript-eslint": "^8.36.0",
|
|
58
|
+
"vitest": "^3.2.4"
|
|
60
59
|
},
|
|
61
60
|
"scripts": {
|
|
62
|
-
"build": "
|
|
61
|
+
"build": "core-cli tsc",
|
|
63
62
|
"copy-css": "mkdir -p dist/components && cp src/components/ImgGen.css dist/components/",
|
|
64
63
|
"build:watch": "tsc --watch",
|
|
65
64
|
"dev:build": "tsc --watch",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function bootstrapUseVibesStyles(): boolean;
|
package/style-loader.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export function bootstrapUseVibesStyles() {
|
|
2
|
+
if (typeof document === 'undefined') {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
const cssPath = './components/ImgGen.css';
|
|
6
|
+
if (document.querySelector(`link[data-use-vibes-css]`)) {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
try {
|
|
10
|
+
const link = document.createElement('link');
|
|
11
|
+
link.rel = 'stylesheet';
|
|
12
|
+
link.href = new URL(cssPath, import.meta.url).toString();
|
|
13
|
+
link.setAttribute('data-use-vibes-css', 'true');
|
|
14
|
+
document.head.appendChild(link);
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
catch (e) {
|
|
18
|
+
console.warn('Failed to auto-load use-vibes styles:', e);
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
bootstrapUseVibesStyles();
|
|
23
|
+
//# sourceMappingURL=style-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-loader.js","sourceRoot":"","sources":["../jsr/style-loader.ts"],"names":[],"mappings":"AAgBA,MAAM,UAAU,uBAAuB,GAAY;IAEjD,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,OAAO,GAAG,yBAAyB,CAAC;IAG1C,IAAI,QAAQ,CAAC,aAAa,CAAC,0BAA0B,CAAC,EAAE,CAAC;QACvD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QAEH,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,GAAG,GAAG,YAAY,CAAC;QAExB,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;QACzD,IAAI,CAAC,YAAY,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;QAGhD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,IAAI,CAAC,uCAAuC,EAAE,CAAC,CAAC,CAAC;QACzD,OAAO,KAAK,CAAC;IACf,CAAC;AAAA,CACF;AAGD,uBAAuB,EAAE,CAAC"}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": [
|
|
3
|
+
"/home/runner/work/vibes.diy/vibes.diy/tsconfig.dist.json"
|
|
4
|
+
],
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"outDir": "../npm/",
|
|
7
|
+
"noEmit": false
|
|
8
|
+
},
|
|
9
|
+
"include": [
|
|
10
|
+
"**/*"
|
|
11
|
+
],
|
|
12
|
+
"exclude": [
|
|
13
|
+
"node_modules",
|
|
14
|
+
"dist",
|
|
15
|
+
".git",
|
|
16
|
+
".vscode"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
export function base64ToFile(base64Data, filename = 'generated-image.png', mimeType = 'image/png') {
|
|
2
|
-
// Remove data URL prefix if present
|
|
3
2
|
const base64Content = base64Data.includes('base64,')
|
|
4
3
|
? base64Data.split('base64,')[1]
|
|
5
4
|
: base64Data;
|
|
6
|
-
// Convert base64 to binary
|
|
7
5
|
const binaryStr = atob(base64Content);
|
|
8
|
-
// Create array buffer
|
|
9
6
|
const bytes = new Uint8Array(binaryStr.length);
|
|
10
7
|
for (let i = 0; i < binaryStr.length; i++) {
|
|
11
8
|
bytes[i] = binaryStr.charCodeAt(i);
|
|
12
9
|
}
|
|
13
|
-
// Create blob and file
|
|
14
10
|
const blob = new Blob([bytes], { type: mimeType });
|
|
15
11
|
return new File([blob], filename, { type: mimeType });
|
|
16
12
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../jsr/utils/base64.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY,CAC1B,UAAkB,EAClB,QAAQ,GAAG,qBAAqB,EAChC,QAAQ,GAAG,WAAW,EAChB;IAEN,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC;QAClD,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAChC,CAAC,CAAC,UAAU,CAAC;IAGf,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC;IAGtC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC;IAGD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACnD,OAAO,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;AAAA,CACvD"}
|
|
@@ -2,7 +2,6 @@ export const isDebug = () => Boolean(import.meta.env?.DEV) &&
|
|
|
2
2
|
(typeof window === 'undefined' || localStorage.getItem('debugDelete') === '1');
|
|
3
3
|
export function logDebug(...args) {
|
|
4
4
|
if (isDebug()) {
|
|
5
|
-
// eslint-disable-next-line no-console
|
|
6
5
|
console.log(...args);
|
|
7
6
|
}
|
|
8
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../jsr/utils/debug.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,GAAY,EAAE,CACnC,OAAO,CAAE,OAAO,IAA+C,CAAC,GAAG,EAAE,GAAG,CAAC;IACzE,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,YAAY,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,GAAG,CAAC,CAAC;AAEjF,MAAM,UAAU,QAAQ,CAAC,GAAG,IAAe,EAAE;IAC3C,IAAI,OAAO,EAAE,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,CAAC;AAAA,CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function combineClasses(...classes: (string | boolean | null | undefined)[]): string;
|
|
2
|
+
export interface ImgGenClasses {
|
|
3
|
+
readonly root: string;
|
|
4
|
+
readonly container: string;
|
|
5
|
+
readonly image: string;
|
|
6
|
+
readonly overlay: string;
|
|
7
|
+
readonly progress: string;
|
|
8
|
+
readonly placeholder: string;
|
|
9
|
+
readonly error: string;
|
|
10
|
+
readonly controls: string;
|
|
11
|
+
readonly button: string;
|
|
12
|
+
readonly prompt: string;
|
|
13
|
+
readonly deleteOverlay: string;
|
|
14
|
+
readonly dropZone: string;
|
|
15
|
+
readonly uploadWaiting: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const defaultClasses: Partial<ImgGenClasses>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function combineClasses(...classes) {
|
|
2
|
+
const validClasses = classes.filter(Boolean);
|
|
3
|
+
const allClasses = [...validClasses];
|
|
4
|
+
validClasses.forEach((cls) => {
|
|
5
|
+
if (cls.startsWith('imggen-')) {
|
|
6
|
+
const legacyClass = cls.replace('imggen-', 'img-gen-');
|
|
7
|
+
if (!allClasses.includes(legacyClass)) {
|
|
8
|
+
allClasses.push(legacyClass);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
return allClasses.join(' ');
|
|
13
|
+
}
|
|
14
|
+
export const defaultClasses = {};
|
|
15
|
+
//# sourceMappingURL=style-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style-utils.js","sourceRoot":"","sources":["../../jsr/utils/style-utils.ts"],"names":[],"mappings":"AAoBA,MAAM,UAAU,cAAc,CAAC,GAAG,OAAgD,EAAU;IAE1F,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAa,CAAC;IAGzD,MAAM,UAAU,GAAG,CAAC,GAAG,YAAY,CAAC,CAAC;IAGrC,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;QAC5B,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAE9B,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YAEvD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBACtC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IAAA,CACF,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAAA,CAC7B;AAqCD,MAAM,CAAC,MAAM,cAAc,GAA2B,EAAE,CAAC"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { ImgGenClasses } from '../utils/style-utils';
|
|
3
|
-
interface ControlsBarProps {
|
|
4
|
-
/** Handle delete confirmation */
|
|
5
|
-
handleDeleteConfirm: () => void;
|
|
6
|
-
handlePrevVersion: () => void;
|
|
7
|
-
handleNextVersion: () => void;
|
|
8
|
-
handleRegen: () => void;
|
|
9
|
-
versionIndex: number;
|
|
10
|
-
totalVersions: number;
|
|
11
|
-
/** Custom CSS classes for styling component parts */
|
|
12
|
-
classes?: ImgGenClasses;
|
|
13
|
-
/** Show control buttons (defaults to true) */
|
|
14
|
-
showControls?: boolean;
|
|
15
|
-
/** Edited prompt for highlighting regenerate button */
|
|
16
|
-
editedPrompt: string | null;
|
|
17
|
-
/** Original prompt text for comparison */
|
|
18
|
-
promptText: string;
|
|
19
|
-
/** Progress value for generation (0-100), shows progress bar when < 100 */
|
|
20
|
-
progress?: number;
|
|
21
|
-
/** Show delete button (defaults to true) */
|
|
22
|
-
showDelete?: boolean;
|
|
23
|
-
/** Whether to flash the version indicator when a new version is added */
|
|
24
|
-
versionFlash?: boolean;
|
|
25
|
-
/** Whether the regeneration is currently in progress */
|
|
26
|
-
isRegenerating?: boolean;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* ControlsBar component - Displays controls for deleting, navigating between versions, and regenerating
|
|
30
|
-
*/
|
|
31
|
-
export declare function ControlsBar({ handleDeleteConfirm, handlePrevVersion, handleNextVersion, handleRegen, versionIndex, totalVersions, classes, showControls, editedPrompt, promptText, progress, showDelete, versionFlash, isRegenerating, }: ControlsBarProps): React.JSX.Element;
|
|
32
|
-
export {};
|