@vibes.diy/use-vibes-base 0.12.0-dev-preview
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/LICENSE.md +232 -0
- package/README.md +549 -0
- package/components/ControlsBar.d.ts +20 -0
- package/components/ControlsBar.js +84 -0
- package/components/ControlsBar.js.map +1 -0
- package/components/ImgGen.css +675 -0
- package/components/ImgGen.d.ts +24 -0
- package/components/ImgGen.js +256 -0
- package/components/ImgGen.js.map +1 -0
- package/components/ImgGenUtils/ImgGenDisplay.d.ts +3 -0
- 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 +90 -0
- package/components/ImgGenUtils/ImgGenDisplayPlaceholder.js.map +1 -0
- package/components/ImgGenUtils/ImgGenDisplayUtils.d.ts +27 -0
- package/components/ImgGenUtils/ImgGenDisplayUtils.js +95 -0
- package/components/ImgGenUtils/ImgGenDisplayUtils.js.map +1 -0
- package/components/ImgGenUtils/ImgGenError.d.ts +3 -0
- package/components/ImgGenUtils/ImgGenError.js +7 -0
- package/components/ImgGenUtils/ImgGenError.js.map +1 -0
- package/components/ImgGenUtils/ImgGenFileDrop.d.ts +11 -0
- package/components/ImgGenUtils/ImgGenFileDrop.js +49 -0
- package/components/ImgGenUtils/ImgGenFileDrop.js.map +1 -0
- package/components/ImgGenUtils/ImgGenModal.d.ts +24 -0
- package/components/ImgGenUtils/ImgGenModal.js +63 -0
- package/components/ImgGenUtils/ImgGenModal.js.map +1 -0
- package/components/ImgGenUtils/ImgGenModeUtils.d.ts +9 -0
- package/components/ImgGenUtils/ImgGenModeUtils.js +48 -0
- package/components/ImgGenUtils/ImgGenModeUtils.js.map +1 -0
- package/components/ImgGenUtils/ImgGenPromptWaiting.d.ts +11 -0
- package/components/ImgGenUtils/ImgGenPromptWaiting.js +36 -0
- package/components/ImgGenUtils/ImgGenPromptWaiting.js.map +1 -0
- package/components/ImgGenUtils/ImgGenUploadWaiting.d.ts +16 -0
- package/components/ImgGenUtils/ImgGenUploadWaiting.js +131 -0
- 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/components/ImgGenUtils/overlays/DeleteConfirmationOverlay.js +30 -0
- 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 +2 -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 +23 -0
- package/components/PromptBar.js.map +1 -0
- package/hooks/image-gen/image-generator.d.ts +11 -0
- package/hooks/image-gen/image-generator.js +136 -0
- 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/hooks/image-gen/types.js +2 -0
- package/hooks/image-gen/types.js.map +1 -0
- 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/hooks/image-gen/utils.js +159 -0
- 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 +22 -0
- package/index.js +21 -0
- package/index.js.map +1 -0
- package/package.json +30 -0
- package/tsconfig.json +22 -0
- package/utils/base64.d.ts +1 -0
- package/utils/base64.js +13 -0
- package/utils/base64.js.map +1 -0
- package/utils/debug.d.ts +2 -0
- package/utils/debug.js +8 -0
- 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/utils/styles.d.ts +227 -0
- package/utils/styles.js +230 -0
- package/utils/styles.js.map +1 -0
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
/* ImgGen Component Styling System
|
|
2
|
+
* This file contains all base styles for the ImgGen component hierarchy
|
|
3
|
+
* Uses CSS custom properties to enable easy theming without affecting layout
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* ---- CSS Custom Properties (Variables) ---- */
|
|
7
|
+
:root {
|
|
8
|
+
/* Colors */
|
|
9
|
+
--imggen-text-color: #333;
|
|
10
|
+
--imggen-background: #333333;
|
|
11
|
+
--imggen-overlay-bg: rgba(255, 255, 255, 0.5);
|
|
12
|
+
--imggen-accent: #0066cc;
|
|
13
|
+
--imggen-flash: #fe0;
|
|
14
|
+
--imggen-error-bg: rgba(0, 0, 0, 0.7);
|
|
15
|
+
--imggen-error-border: #ff6666;
|
|
16
|
+
--imggen-error-text: #ff6666;
|
|
17
|
+
--imggen-button-bg: rgba(255, 255, 255, 0.7);
|
|
18
|
+
--imggen-error-text-body: #ffffff;
|
|
19
|
+
--imggen-delete-hover-color: #ff3333;
|
|
20
|
+
|
|
21
|
+
/* Dimensions */
|
|
22
|
+
--imggen-border-radius: 8px;
|
|
23
|
+
--imggen-padding: 8px;
|
|
24
|
+
--imggen-button-size: 28px;
|
|
25
|
+
--imggen-progress-height: 8px;
|
|
26
|
+
|
|
27
|
+
/* Typography */
|
|
28
|
+
--imggen-font-size: 14px;
|
|
29
|
+
--imggen-font-weight: bold;
|
|
30
|
+
--imggen-line-height: 1.5;
|
|
31
|
+
|
|
32
|
+
/* Effects */
|
|
33
|
+
--imggen-blur-radius: 4px;
|
|
34
|
+
--imggen-transition-speed: 0.2s;
|
|
35
|
+
--imggen-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* ---- Core Components ---- */
|
|
39
|
+
|
|
40
|
+
/* Root container */
|
|
41
|
+
.imggen-root {
|
|
42
|
+
position: relative;
|
|
43
|
+
max-width: 100%;
|
|
44
|
+
/* No border-radius to allow downstream apps to set their own */
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Image container */
|
|
49
|
+
.imggen-container {
|
|
50
|
+
position: relative;
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 100%;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Image container with expand button */
|
|
56
|
+
.imggen-image-container {
|
|
57
|
+
position: relative;
|
|
58
|
+
width: 100%;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
/* No border-radius to allow downstream apps to set their own */
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Expand button in upper left corner */
|
|
64
|
+
.imggen-expand-button {
|
|
65
|
+
position: absolute;
|
|
66
|
+
top: 10px;
|
|
67
|
+
left: 10px;
|
|
68
|
+
z-index: 20;
|
|
69
|
+
background-color: var(--imggen-button-bg);
|
|
70
|
+
border-radius: 50%;
|
|
71
|
+
width: 28px;
|
|
72
|
+
height: 28px;
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
border: none;
|
|
77
|
+
cursor: pointer;
|
|
78
|
+
opacity: 0; /* Initially invisible */
|
|
79
|
+
transition:
|
|
80
|
+
opacity var(--imggen-transition-speed) ease,
|
|
81
|
+
transform var(--imggen-transition-speed) ease;
|
|
82
|
+
padding: 0;
|
|
83
|
+
color: var(--imggen-text-color);
|
|
84
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Show button on container hover */
|
|
88
|
+
.imggen-image-container:hover .imggen-expand-button {
|
|
89
|
+
opacity: 0.5;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.imggen-expand-button:hover {
|
|
93
|
+
opacity: 1 !important;
|
|
94
|
+
transform: scale(1.1);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.imggen-expand-button svg {
|
|
98
|
+
width: 20px;
|
|
99
|
+
height: 20px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@media (hover: none) {
|
|
103
|
+
/* On touch devices, always show the expand button */
|
|
104
|
+
.imggen-expand-button {
|
|
105
|
+
opacity: 0.5 !important;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* The image itself - limited styling since we can't change ImgFile */
|
|
110
|
+
.imggen-image {
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: auto;
|
|
113
|
+
display: block;
|
|
114
|
+
/* No border-radius to allow downstream apps to set their own */
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/* ---- Overlays ---- */
|
|
118
|
+
|
|
119
|
+
/* Base overlay that appears at the bottom */
|
|
120
|
+
.imggen-overlay {
|
|
121
|
+
position: absolute;
|
|
122
|
+
bottom: 0;
|
|
123
|
+
left: 0;
|
|
124
|
+
right: 0;
|
|
125
|
+
padding: var(--imggen-padding);
|
|
126
|
+
background-color: var(--imggen-overlay-bg);
|
|
127
|
+
backdrop-filter: blur(var(--imggen-blur-radius));
|
|
128
|
+
transition: opacity var(--imggen-transition-speed) ease;
|
|
129
|
+
z-index: 10;
|
|
130
|
+
display: flex;
|
|
131
|
+
flex-direction: column;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Top line row with prompt and version indicator */
|
|
135
|
+
.imggen-top-line {
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: space-between;
|
|
139
|
+
width: 100%;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/* Prompt text container */
|
|
143
|
+
.imggen-prompt {
|
|
144
|
+
width: 100%;
|
|
145
|
+
padding: 4px;
|
|
146
|
+
margin-bottom: 8px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* Prompt text styling */
|
|
150
|
+
.imggen-prompt-text {
|
|
151
|
+
color: var(--imggen-text-color);
|
|
152
|
+
width: 100%;
|
|
153
|
+
text-align: center;
|
|
154
|
+
font-weight: var(--imggen-font-weight);
|
|
155
|
+
padding: 2px;
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/* Prompt input for editing */
|
|
160
|
+
.imggen-prompt-input {
|
|
161
|
+
width: 100%;
|
|
162
|
+
box-sizing: border-box;
|
|
163
|
+
padding: 6px 8px;
|
|
164
|
+
border: 1px solid #ccc;
|
|
165
|
+
border-radius: 4px;
|
|
166
|
+
font-size: var(--imggen-font-size);
|
|
167
|
+
font-weight: var(--imggen-font-weight);
|
|
168
|
+
color: var(--imggen-text-color);
|
|
169
|
+
background-color: white;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.imggen-edit-mode {
|
|
173
|
+
border: 2px solid var(--imggen-accent);
|
|
174
|
+
padding: 6px 10px;
|
|
175
|
+
border-radius: 6px;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Controls row */
|
|
179
|
+
.imggen-controls {
|
|
180
|
+
display: flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
justify-content: space-between;
|
|
183
|
+
width: 100%;
|
|
184
|
+
padding-top: 2px;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Control button group */
|
|
188
|
+
.imggen-control-group {
|
|
189
|
+
display: flex;
|
|
190
|
+
gap: 6px;
|
|
191
|
+
align-items: center;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ---- Buttons ---- */
|
|
195
|
+
|
|
196
|
+
/* Base button styling */
|
|
197
|
+
.imggen-button {
|
|
198
|
+
background: var(--imggen-button-bg);
|
|
199
|
+
border-radius: 50%;
|
|
200
|
+
width: var(--imggen-button-size);
|
|
201
|
+
height: var(--imggen-button-size);
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
justify-content: center;
|
|
205
|
+
border: none;
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
opacity: 0.5;
|
|
208
|
+
transition: opacity var(--imggen-transition-speed) ease;
|
|
209
|
+
padding: 0;
|
|
210
|
+
font-size: var(--imggen-font-size);
|
|
211
|
+
color: var(--imggen-text-color);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.imggen-button-highlight {
|
|
215
|
+
background-color: var(--imggen-accent);
|
|
216
|
+
color: white;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.imggen-button:hover:not(:disabled) {
|
|
220
|
+
opacity: 1;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.imggen-button:disabled {
|
|
224
|
+
opacity: 0.3;
|
|
225
|
+
cursor: default;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* Info button (appears at bottom left) */
|
|
229
|
+
.imggen-info-button {
|
|
230
|
+
position: absolute;
|
|
231
|
+
bottom: 10px;
|
|
232
|
+
left: 10px;
|
|
233
|
+
background: none;
|
|
234
|
+
border: none;
|
|
235
|
+
font-size: 24px;
|
|
236
|
+
color: #fff;
|
|
237
|
+
opacity: 0.5;
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
padding: 0;
|
|
240
|
+
transition: opacity var(--imggen-transition-speed) ease;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.imggen-info-button:hover {
|
|
244
|
+
opacity: 1;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/* Delete button (top right corner) */
|
|
248
|
+
.imggen-delete-button {
|
|
249
|
+
position: absolute;
|
|
250
|
+
top: 10px;
|
|
251
|
+
right: 10px;
|
|
252
|
+
z-index: 20;
|
|
253
|
+
background-color: var(--imggen-button-bg);
|
|
254
|
+
border-radius: 50%;
|
|
255
|
+
width: 30px;
|
|
256
|
+
height: 30px;
|
|
257
|
+
display: flex;
|
|
258
|
+
align-items: center;
|
|
259
|
+
justify-content: center;
|
|
260
|
+
cursor: pointer;
|
|
261
|
+
border: none;
|
|
262
|
+
font-size: 16px;
|
|
263
|
+
opacity: 0.5;
|
|
264
|
+
transition: opacity var(--imggen-transition-speed) ease;
|
|
265
|
+
padding: 0;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.imggen-delete-button:hover {
|
|
269
|
+
opacity: 1;
|
|
270
|
+
color: var(--imggen-delete-hover-color);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/* ---- Progress Indicators ---- */
|
|
274
|
+
|
|
275
|
+
/* Progress bar container */
|
|
276
|
+
.imggen-progress-container {
|
|
277
|
+
position: absolute;
|
|
278
|
+
top: 0;
|
|
279
|
+
left: 0;
|
|
280
|
+
right: 0;
|
|
281
|
+
z-index: 50;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/* Actual progress bar */
|
|
285
|
+
.imggen-progress {
|
|
286
|
+
position: absolute;
|
|
287
|
+
top: 0;
|
|
288
|
+
left: 0;
|
|
289
|
+
height: var(--imggen-progress-height);
|
|
290
|
+
background-color: var(--imggen-accent);
|
|
291
|
+
transition: width 0.3s ease-in-out;
|
|
292
|
+
z-index: 11; /* Ensure it appears above the overlay */
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/* Version indicator text */
|
|
296
|
+
.imggen-version-indicator {
|
|
297
|
+
font-size: var(--imggen-font-size);
|
|
298
|
+
color: var(--imggen-text-color);
|
|
299
|
+
transition: all 0.3s ease-in-out;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/* Version flash animation */
|
|
303
|
+
@keyframes version-flash {
|
|
304
|
+
0% {
|
|
305
|
+
color: var(--imggen-text-color);
|
|
306
|
+
transform: scale(1);
|
|
307
|
+
}
|
|
308
|
+
30% {
|
|
309
|
+
color: var(--imggen-flash);
|
|
310
|
+
transform: scale(1.3);
|
|
311
|
+
/* font-weight: bold; */
|
|
312
|
+
}
|
|
313
|
+
70% {
|
|
314
|
+
color: var(--imggen-flash);
|
|
315
|
+
transform: scale(1.1);
|
|
316
|
+
font-weight: bold;
|
|
317
|
+
}
|
|
318
|
+
100% {
|
|
319
|
+
color: var(--imggen-text-color);
|
|
320
|
+
transform: scale(1);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.imggen-version-flash {
|
|
325
|
+
animation: version-flash 2s ease-in-out;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/* Regenerate spinner animation */
|
|
329
|
+
@keyframes regen-spin {
|
|
330
|
+
0% {
|
|
331
|
+
transform: rotate(0deg);
|
|
332
|
+
}
|
|
333
|
+
100% {
|
|
334
|
+
transform: rotate(360deg);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.imggen-regen-spinning {
|
|
339
|
+
animation: regen-spin 2s linear infinite;
|
|
340
|
+
display: inline-block;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/* Status text (e.g. Generating...) */
|
|
344
|
+
.imggen-status-text {
|
|
345
|
+
width: 100%;
|
|
346
|
+
text-align: center;
|
|
347
|
+
font-size: var(--imggen-font-size);
|
|
348
|
+
color: var(--imggen-text-color);
|
|
349
|
+
opacity: 0.7;
|
|
350
|
+
padding: 8px 0;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/* ---- Placeholders & Errors ---- */
|
|
354
|
+
|
|
355
|
+
/* Placeholder styling */
|
|
356
|
+
.imggen-placeholder {
|
|
357
|
+
width: 100%;
|
|
358
|
+
height: 100%;
|
|
359
|
+
background-color: var(--imggen-background);
|
|
360
|
+
position: relative;
|
|
361
|
+
overflow: hidden;
|
|
362
|
+
display: flex;
|
|
363
|
+
align-items: center;
|
|
364
|
+
justify-content: center;
|
|
365
|
+
box-sizing: border-box;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/* Error container wrapper to ensure consistent dark background */
|
|
369
|
+
.imggen-error-container {
|
|
370
|
+
background-color: #222;
|
|
371
|
+
aspect-ratio: 1 / 1; /* Maintain square aspect ratio like images */
|
|
372
|
+
display: flex;
|
|
373
|
+
flex-direction: column;
|
|
374
|
+
justify-content: center;
|
|
375
|
+
align-items: center;
|
|
376
|
+
padding: 1rem;
|
|
377
|
+
width: 100%;
|
|
378
|
+
border-radius: var(--imggen-border-radius);
|
|
379
|
+
overflow: hidden;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/* Error container */
|
|
383
|
+
.imggen-error {
|
|
384
|
+
background-color: #000;
|
|
385
|
+
color: var(--imggen-error-text);
|
|
386
|
+
padding: 1.5rem;
|
|
387
|
+
border-radius: var(--imggen-border-radius);
|
|
388
|
+
border: 1px solid var(--imggen-error-border);
|
|
389
|
+
box-shadow: var(--imggen-shadow);
|
|
390
|
+
max-width: 80%;
|
|
391
|
+
display: flex;
|
|
392
|
+
flex-direction: column;
|
|
393
|
+
justify-content: center;
|
|
394
|
+
align-items: center;
|
|
395
|
+
text-align: center;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/* Error title */
|
|
399
|
+
.imggen-error-title {
|
|
400
|
+
color: var(--imggen-error-text);
|
|
401
|
+
margin-top: 0;
|
|
402
|
+
font-weight: bold;
|
|
403
|
+
font-size: 18px;
|
|
404
|
+
margin-bottom: 12px;
|
|
405
|
+
text-align: center;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/* Error message */
|
|
409
|
+
.imggen-error-message {
|
|
410
|
+
white-space: pre-wrap;
|
|
411
|
+
color: var(--imggen-error-text-body);
|
|
412
|
+
font-size: var(--imggen-font-size);
|
|
413
|
+
line-height: var(--imggen-line-height);
|
|
414
|
+
text-align: left;
|
|
415
|
+
font-family: monospace, sans-serif;
|
|
416
|
+
margin-bottom: 0;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/* Error display in full-screen backdrop */
|
|
420
|
+
.imggen-backdrop-error {
|
|
421
|
+
width: 100%;
|
|
422
|
+
height: 100%;
|
|
423
|
+
display: flex;
|
|
424
|
+
align-items: center;
|
|
425
|
+
justify-content: center;
|
|
426
|
+
padding: 2rem;
|
|
427
|
+
box-sizing: border-box;
|
|
428
|
+
background-color: #222; /* Dark gray background */
|
|
429
|
+
/* aspect-ratio: 1 / 1; Maintain square aspect ratio like images */
|
|
430
|
+
border-radius: var(--imggen-border-radius);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/* Delete confirmation overlay */
|
|
434
|
+
.imggen-delete-overlay {
|
|
435
|
+
position: absolute;
|
|
436
|
+
top: 0;
|
|
437
|
+
left: 0;
|
|
438
|
+
right: 0;
|
|
439
|
+
bottom: 0;
|
|
440
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
441
|
+
display: flex;
|
|
442
|
+
flex-direction: column;
|
|
443
|
+
align-items: center;
|
|
444
|
+
justify-content: center;
|
|
445
|
+
z-index: 30;
|
|
446
|
+
padding: 20px;
|
|
447
|
+
text-align: center;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/* Delete confirmation message */
|
|
451
|
+
.imggen-delete-message {
|
|
452
|
+
color: white;
|
|
453
|
+
font-size: 16px;
|
|
454
|
+
margin-bottom: 20px;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/* Delete confirmation button group */
|
|
458
|
+
.imggen-delete-buttons {
|
|
459
|
+
display: flex;
|
|
460
|
+
gap: 10px;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
/* Delete confirmation button */
|
|
464
|
+
.imggen-delete-confirm {
|
|
465
|
+
background-color: var(--imggen-error-border);
|
|
466
|
+
color: white;
|
|
467
|
+
border: none;
|
|
468
|
+
padding: 8px 16px;
|
|
469
|
+
border-radius: 4px;
|
|
470
|
+
cursor: pointer;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/* Delete cancel button */
|
|
474
|
+
.imggen-delete-cancel {
|
|
475
|
+
background-color: #555;
|
|
476
|
+
color: white;
|
|
477
|
+
border: none;
|
|
478
|
+
padding: 8px 16px;
|
|
479
|
+
border-radius: 4px;
|
|
480
|
+
cursor: pointer;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/* Helper classes */
|
|
484
|
+
.imggen-truncate {
|
|
485
|
+
white-space: nowrap;
|
|
486
|
+
overflow: hidden;
|
|
487
|
+
text-overflow: ellipsis;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/* ---- Simple fullscreen backdrop ---- */
|
|
491
|
+
.imggen-backdrop {
|
|
492
|
+
position: fixed;
|
|
493
|
+
inset: 0;
|
|
494
|
+
background-color: rgba(0, 0, 0, 0.9);
|
|
495
|
+
display: flex;
|
|
496
|
+
flex-direction: column;
|
|
497
|
+
align-items: center;
|
|
498
|
+
justify-content: flex-start; /* anchor to top to avoid vertical jump */
|
|
499
|
+
padding-top: 5vh; /* give top breathing room */
|
|
500
|
+
z-index: 9999;
|
|
501
|
+
gap: 8px;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.imggen-backdrop-image {
|
|
505
|
+
max-width: 90vw;
|
|
506
|
+
max-height: 70vh;
|
|
507
|
+
object-fit: contain;
|
|
508
|
+
border-radius: var(--imggen-border-radius);
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.imggen-backdrop .imggen-overlay {
|
|
512
|
+
position: static;
|
|
513
|
+
width: 100%;
|
|
514
|
+
box-sizing: border-box; /* include padding in width */
|
|
515
|
+
margin: 0;
|
|
516
|
+
left: auto;
|
|
517
|
+
right: auto;
|
|
518
|
+
bottom: auto;
|
|
519
|
+
background-color: var(--imggen-overlay-bg);
|
|
520
|
+
backdrop-filter: blur(var(--imggen-blur-radius));
|
|
521
|
+
border-radius: var(--imggen-border-radius);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
/* Wrapper ensures overlay width matches image intrinsic width */
|
|
525
|
+
.imggen-full-wrapper {
|
|
526
|
+
display: inline-block; /* shrink-wrap to content width */
|
|
527
|
+
width: min(90vw, 70vh); /* Size proportional to viewport, matching backdrop-image constraints */
|
|
528
|
+
aspect-ratio: 1 / 1; /* Maintain square aspect ratio like images */
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
/* ---- File Drop Component ---- */
|
|
532
|
+
|
|
533
|
+
.imggen-file-drop {
|
|
534
|
+
padding: 1.5rem;
|
|
535
|
+
border: 2px dashed #ccc;
|
|
536
|
+
border-radius: 8px;
|
|
537
|
+
text-align: center;
|
|
538
|
+
cursor: pointer;
|
|
539
|
+
transition:
|
|
540
|
+
border-color 0.2s,
|
|
541
|
+
background-color 0.2s;
|
|
542
|
+
margin-bottom: 1rem;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.imggen-file-drop:hover {
|
|
546
|
+
border-color: #999;
|
|
547
|
+
background-color: rgba(0, 0, 0, 0.02);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
.imggen-file-drop-active {
|
|
551
|
+
border-color: #4a9df8;
|
|
552
|
+
background-color: rgba(74, 157, 248, 0.05);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
.imggen-file-drop-disabled {
|
|
556
|
+
opacity: 0.5;
|
|
557
|
+
cursor: not-allowed;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
.imggen-file-drop-message {
|
|
561
|
+
font-size: 0.95rem;
|
|
562
|
+
color: #666;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/* Upload waiting state styles */
|
|
566
|
+
.imggen-upload-waiting {
|
|
567
|
+
display: flex;
|
|
568
|
+
flex-direction: column;
|
|
569
|
+
gap: 1rem;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
.imggen-uploaded-previews {
|
|
573
|
+
margin-bottom: 0.5rem;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.imggen-upload-count {
|
|
577
|
+
font-size: 0.9rem;
|
|
578
|
+
color: #555;
|
|
579
|
+
margin-bottom: 0.5rem;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.imggen-thumbnails {
|
|
583
|
+
display: flex;
|
|
584
|
+
flex-wrap: wrap;
|
|
585
|
+
gap: 0.5rem;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.imggen-thumbnail {
|
|
589
|
+
width: 80px;
|
|
590
|
+
height: 80px;
|
|
591
|
+
border-radius: 4px;
|
|
592
|
+
overflow: hidden;
|
|
593
|
+
border: 1px solid #ddd;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.imggen-thumbnail-img {
|
|
597
|
+
width: 100%;
|
|
598
|
+
height: 100%;
|
|
599
|
+
object-fit: cover;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.imggen-thumbnail-placeholder {
|
|
603
|
+
display: flex;
|
|
604
|
+
align-items: center;
|
|
605
|
+
justify-content: center;
|
|
606
|
+
width: 100%;
|
|
607
|
+
height: 100%;
|
|
608
|
+
background-color: #f5f5f5;
|
|
609
|
+
color: #999;
|
|
610
|
+
font-size: 0.8rem;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
.imggen-more-count {
|
|
614
|
+
display: flex;
|
|
615
|
+
align-items: center;
|
|
616
|
+
justify-content: center;
|
|
617
|
+
width: 80px;
|
|
618
|
+
height: 80px;
|
|
619
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
620
|
+
border-radius: 4px;
|
|
621
|
+
color: #666;
|
|
622
|
+
font-size: 0.9rem;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.imggen-no-uploads {
|
|
626
|
+
color: #999;
|
|
627
|
+
font-style: italic;
|
|
628
|
+
font-size: 0.9rem;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
.imggen-prompt-form {
|
|
632
|
+
display: flex;
|
|
633
|
+
gap: 0.5rem;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.imggen-prompt-input {
|
|
637
|
+
flex: 1;
|
|
638
|
+
padding: 0.75rem;
|
|
639
|
+
border: 1px solid #ccc;
|
|
640
|
+
border-radius: 4px;
|
|
641
|
+
font-size: 0.95rem;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.imggen-prompt-submit {
|
|
645
|
+
/* padding: 0.75rem 1.25rem; */
|
|
646
|
+
background-color: #4a9df8;
|
|
647
|
+
color: white;
|
|
648
|
+
border: none;
|
|
649
|
+
border-radius: 4px;
|
|
650
|
+
cursor: pointer;
|
|
651
|
+
font-weight: 600;
|
|
652
|
+
transition: background-color 0.2s;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
.imggen-prompt-submit:hover {
|
|
656
|
+
background-color: #3a8de8;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
.imggen-prompt-submit:disabled {
|
|
660
|
+
background-color: #ccc;
|
|
661
|
+
cursor: not-allowed;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
.fade-transition {
|
|
665
|
+
animation: fadeOut 0.3s ease-in-out forwards;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
@keyframes fadeOut {
|
|
669
|
+
0% {
|
|
670
|
+
opacity: 1;
|
|
671
|
+
}
|
|
672
|
+
100% {
|
|
673
|
+
opacity: 0;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ImageGenOptions } from 'call-ai';
|
|
3
|
+
import { Database } from 'use-fireproof';
|
|
4
|
+
import type { UseImageGenOptions, UseImageGenResult } from '../hooks/image-gen/types.js';
|
|
5
|
+
import { ImgGenClasses } from '../utils/style-utils.js';
|
|
6
|
+
export interface ImgGenProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onError' | 'className'> {
|
|
7
|
+
readonly prompt: string;
|
|
8
|
+
readonly _id: string;
|
|
9
|
+
readonly className: string;
|
|
10
|
+
readonly alt: string;
|
|
11
|
+
readonly images: File[];
|
|
12
|
+
readonly options: ImageGenOptions;
|
|
13
|
+
readonly database: string | Database;
|
|
14
|
+
readonly useImageGen: (options: Partial<UseImageGenOptions>) => UseImageGenResult;
|
|
15
|
+
readonly onComplete: () => void;
|
|
16
|
+
readonly onError: (error: Error) => void;
|
|
17
|
+
readonly onDelete: (id: string) => void;
|
|
18
|
+
readonly onPromptEdit: (id: string, newPrompt: string) => void;
|
|
19
|
+
readonly classes: ImgGenClasses;
|
|
20
|
+
readonly onDocumentCreated: (docId: string) => void;
|
|
21
|
+
readonly debug: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function ImgGen(props: Partial<ImgGenProps>): React.ReactElement;
|
|
24
|
+
export default ImgGen;
|