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
package/README.md
CHANGED
|
@@ -67,7 +67,6 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, 'my-image.png');
|
|
|
67
67
|
### Prompt Management
|
|
68
68
|
|
|
69
69
|
- **Prompt Versioning**: Tracks the history of different prompts used to generate an image
|
|
70
|
-
|
|
71
70
|
- Uses a structured `prompts` object with timestamp-based keys
|
|
72
71
|
- Maintains `currentPromptKey` to reference the active prompt
|
|
73
72
|
|
|
@@ -87,7 +86,6 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, 'my-image.png');
|
|
|
87
86
|
### Image Control & Manipulation
|
|
88
87
|
|
|
89
88
|
- **Image Regeneration**: One-click regeneration with the same or edited prompt
|
|
90
|
-
|
|
91
89
|
- Preserves document history and adds new versions
|
|
92
90
|
- Uses a unique `generationId` to trigger regeneration while maintaining context
|
|
93
91
|
|
|
@@ -111,7 +109,6 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, 'my-image.png');
|
|
|
111
109
|
### User Interface Components
|
|
112
110
|
|
|
113
111
|
- **Interactive Overlay**: Toggle-able information and controls overlay
|
|
114
|
-
|
|
115
112
|
- Shows prompt text (editable)
|
|
116
113
|
- Version navigation controls
|
|
117
114
|
- Regenerate/refresh button
|
|
@@ -123,7 +120,6 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, 'my-image.png');
|
|
|
123
120
|
```
|
|
124
121
|
|
|
125
122
|
- **Progress Visualization**: Shows generation progress with visual indicators
|
|
126
|
-
|
|
127
123
|
- Progress bar updates in real-time
|
|
128
124
|
- Automatic placeholder display during generation
|
|
129
125
|
|
|
@@ -140,7 +136,6 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, 'my-image.png');
|
|
|
140
136
|
### File Management
|
|
141
137
|
|
|
142
138
|
- **File Upload Interface**: Built-in support for image uploads
|
|
143
|
-
|
|
144
139
|
- Drag-and-drop capabilities
|
|
145
140
|
- File selection dialog
|
|
146
141
|
- Preview of uploaded content
|
|
@@ -172,7 +167,6 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, 'my-image.png');
|
|
|
172
167
|
### State Management
|
|
173
168
|
|
|
174
169
|
- **Loading States**: Component handles all loading states internally
|
|
175
|
-
|
|
176
170
|
- Initial waiting state
|
|
177
171
|
- Generation in progress state
|
|
178
172
|
- Upload waiting state
|
|
@@ -186,7 +180,6 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, 'my-image.png');
|
|
|
186
180
|
### UI Customization
|
|
187
181
|
|
|
188
182
|
- **Extensive Styling Options**: Multiple ways to customize appearance
|
|
189
|
-
|
|
190
183
|
- CSS Variables for global styling
|
|
191
184
|
|
|
192
185
|
```css
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ImgGenClasses } from '../utils/style-utils.js';
|
|
3
|
+
interface ControlsBarProps {
|
|
4
|
+
readonly handleDeleteConfirm: () => void;
|
|
5
|
+
readonly handlePrevVersion: () => void;
|
|
6
|
+
readonly handleNextVersion: () => void;
|
|
7
|
+
readonly handleRegen: () => void;
|
|
8
|
+
readonly versionIndex: number;
|
|
9
|
+
readonly totalVersions: number;
|
|
10
|
+
readonly classes?: Partial<ImgGenClasses>;
|
|
11
|
+
readonly showControls?: boolean;
|
|
12
|
+
readonly editedPrompt: string | null;
|
|
13
|
+
readonly promptText: string;
|
|
14
|
+
readonly progress?: number;
|
|
15
|
+
readonly showDelete?: boolean;
|
|
16
|
+
readonly versionFlash?: boolean;
|
|
17
|
+
readonly isRegenerating?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function ControlsBar({ handleDeleteConfirm, handlePrevVersion, handleNextVersion, handleRegen, versionIndex, totalVersions, classes, showControls, editedPrompt, promptText, progress, showDelete, versionFlash, isRegenerating }: ControlsBarProps): React.JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { combineClasses, defaultClasses } from '../utils/style-utils.js';
|
|
3
|
+
import { logDebug } from '../utils/debug.js';
|
|
4
|
+
export function ControlsBar({ handleDeleteConfirm, handlePrevVersion, handleNextVersion, handleRegen, versionIndex, totalVersions, classes = defaultClasses, showControls = true, editedPrompt, promptText, progress = 100, showDelete = true, versionFlash = false, isRegenerating = false, }) {
|
|
5
|
+
const [showConfirmation, setShowConfirmation] = React.useState(false);
|
|
6
|
+
const cancelTimerRef = React.useRef(null);
|
|
7
|
+
const isConfirming = showConfirmation;
|
|
8
|
+
const onDeleteClick = () => {
|
|
9
|
+
if (isConfirming) {
|
|
10
|
+
logDebug('ControlsBar: Delete confirmed, calling handleDeleteConfirm');
|
|
11
|
+
handleDeleteConfirm();
|
|
12
|
+
setShowConfirmation(false);
|
|
13
|
+
if (cancelTimerRef.current) {
|
|
14
|
+
window.clearTimeout(cancelTimerRef.current);
|
|
15
|
+
cancelTimerRef.current = null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
logDebug('ControlsBar: Showing delete confirmation');
|
|
20
|
+
setShowConfirmation(true);
|
|
21
|
+
cancelTimerRef.current = window.setTimeout(() => {
|
|
22
|
+
setShowConfirmation(false);
|
|
23
|
+
}, 6500);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
return () => {
|
|
28
|
+
if (cancelTimerRef.current) {
|
|
29
|
+
window.clearTimeout(cancelTimerRef.current);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
return (React.createElement(React.Fragment, null, progress < 100 && (React.createElement("div", { className: "imggen-progress", style: {
|
|
34
|
+
width: `${progress}%`,
|
|
35
|
+
position: 'absolute',
|
|
36
|
+
top: 0,
|
|
37
|
+
left: 0,
|
|
38
|
+
height: 'var(--imggen-progress-height)',
|
|
39
|
+
zIndex: 20,
|
|
40
|
+
} })), React.createElement("div", { className: combineClasses('imggen-controls', classes.controls) }, showControls ? (React.createElement(React.Fragment, null, React.createElement("div", { style: { display: 'flex', gap: '6px', alignItems: 'center', flex: 1 } }, showDelete && (React.createElement("div", { style: { display: 'flex', alignItems: 'center', gap: '8px' } }, React.createElement("button", { "aria-label": "Delete image", onClick: onDeleteClick, className: combineClasses('imggen-button imggen-delete-button', classes.button), style: {
|
|
41
|
+
position: 'static',
|
|
42
|
+
width: 'var(--imggen-button-size)',
|
|
43
|
+
height: 'var(--imggen-button-size)',
|
|
44
|
+
backgroundColor: isConfirming ? 'var(--imggen-error-border)' : undefined,
|
|
45
|
+
color: isConfirming ? 'white' : undefined,
|
|
46
|
+
opacity: isConfirming ? 1 : undefined,
|
|
47
|
+
} }), isConfirming && (React.createElement("div", { className: "fade-transition", style: { animationDelay: '6s' } }, React.createElement("button", { onClick: () => {
|
|
48
|
+
handleDeleteConfirm();
|
|
49
|
+
setShowConfirmation(false);
|
|
50
|
+
}, "aria-label": "Confirm delete", style: {
|
|
51
|
+
fontSize: 'var(--imggen-font-size)',
|
|
52
|
+
fontWeight: 'bold',
|
|
53
|
+
whiteSpace: 'nowrap',
|
|
54
|
+
border: '1px solid var(--imggen-error-border, #ff3333)',
|
|
55
|
+
background: 'var(--imggen-error-border, #ff3333)',
|
|
56
|
+
color: 'white',
|
|
57
|
+
borderRadius: '4px',
|
|
58
|
+
cursor: 'pointer',
|
|
59
|
+
padding: '2px 8px',
|
|
60
|
+
} }, "Delete image"), React.createElement("button", { onClick: () => {
|
|
61
|
+
logDebug('ControlsBar: Delete canceled');
|
|
62
|
+
setShowConfirmation(false);
|
|
63
|
+
if (cancelTimerRef.current) {
|
|
64
|
+
window.clearTimeout(cancelTimerRef.current);
|
|
65
|
+
}
|
|
66
|
+
}, "aria-label": "Cancel delete", style: {
|
|
67
|
+
fontSize: 'var(--imggen-font-size)',
|
|
68
|
+
whiteSpace: 'nowrap',
|
|
69
|
+
border: 'none',
|
|
70
|
+
background: 'none',
|
|
71
|
+
color: 'var(--imggen-font-color)',
|
|
72
|
+
cursor: 'pointer',
|
|
73
|
+
padding: '0 4px',
|
|
74
|
+
} }, "Cance")))))), React.createElement("div", { className: "imggen-control-group" }, totalVersions > 1 && (React.createElement("button", { "aria-label": "Previous version", disabled: versionIndex === 0, onClick: handlePrevVersion, className: combineClasses('imggen-button', classes.button) }, "\u25C0")), totalVersions > 1 && (React.createElement("span", { className: `imggen-version-indicator version-indicator ${versionFlash ? 'imggen-version-flash' : ''}`, "aria-live": "polite" }, versionIndex + 1, " / ", totalVersions)), totalVersions > 1 && (React.createElement("button", { "aria-label": "Next version", disabled: versionIndex >= totalVersions - 1, onClick: handleNextVersion, className: combineClasses('imggen-button', classes.button) }, "\u25B6")), React.createElement("button", { "aria-label": "Regenerate image", onClick: () => {
|
|
75
|
+
handleRegen();
|
|
76
|
+
}, disabled: isRegenerating, className: combineClasses('imggen-button', classes.button, editedPrompt !== null && editedPrompt.trim() !== promptText
|
|
77
|
+
? 'imggen-button-highlight'
|
|
78
|
+
: '', isRegenerating ? 'imggen-button-disabled' : '') }, React.createElement("span", { className: isRegenerating ? 'imggen-regen-spinning' : '' }, "\u27F3"))))) : progress < 100 ? (React.createElement("div", { className: "imggen-status-text" }, "Generating...")) : null)));
|
|
79
|
+
}
|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AC,CAAC,IAAI,CACJ,CACL,CACJ,CAAC;AAAA,CACH"}
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
--imggen-button-bg: rgba(255, 255, 255, 0.7);
|
|
18
18
|
--imggen-error-text-body: #ffffff;
|
|
19
19
|
--imggen-delete-hover-color: #ff3333;
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
/* Dimensions */
|
|
22
22
|
--imggen-border-radius: 8px;
|
|
23
23
|
--imggen-padding: 8px;
|
|
24
24
|
--imggen-button-size: 28px;
|
|
25
25
|
--imggen-progress-height: 8px;
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
/* Typography */
|
|
28
28
|
--imggen-font-size: 14px;
|
|
29
29
|
--imggen-font-weight: bold;
|
|
30
30
|
--imggen-line-height: 1.5;
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
/* Effects */
|
|
33
33
|
--imggen-blur-radius: 4px;
|
|
34
34
|
--imggen-transition-speed: 0.2s;
|
|
@@ -76,7 +76,9 @@
|
|
|
76
76
|
border: none;
|
|
77
77
|
cursor: pointer;
|
|
78
78
|
opacity: 0; /* Initially invisible */
|
|
79
|
-
transition:
|
|
79
|
+
transition:
|
|
80
|
+
opacity var(--imggen-transition-speed) ease,
|
|
81
|
+
transform var(--imggen-transition-speed) ease;
|
|
80
82
|
padding: 0;
|
|
81
83
|
color: var(--imggen-text-color);
|
|
82
84
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
|
|
@@ -299,21 +301,21 @@
|
|
|
299
301
|
|
|
300
302
|
/* Version flash animation */
|
|
301
303
|
@keyframes version-flash {
|
|
302
|
-
0% {
|
|
304
|
+
0% {
|
|
303
305
|
color: var(--imggen-text-color);
|
|
304
|
-
transform: scale(1);
|
|
306
|
+
transform: scale(1);
|
|
305
307
|
}
|
|
306
|
-
30% {
|
|
308
|
+
30% {
|
|
307
309
|
color: var(--imggen-flash);
|
|
308
|
-
transform: scale(1.3);
|
|
310
|
+
transform: scale(1.3);
|
|
309
311
|
/* font-weight: bold; */
|
|
310
312
|
}
|
|
311
|
-
70% {
|
|
313
|
+
70% {
|
|
312
314
|
color: var(--imggen-flash);
|
|
313
315
|
transform: scale(1.1);
|
|
314
316
|
font-weight: bold;
|
|
315
317
|
}
|
|
316
|
-
100% {
|
|
318
|
+
100% {
|
|
317
319
|
color: var(--imggen-text-color);
|
|
318
320
|
transform: scale(1);
|
|
319
321
|
}
|
|
@@ -325,8 +327,12 @@
|
|
|
325
327
|
|
|
326
328
|
/* Regenerate spinner animation */
|
|
327
329
|
@keyframes regen-spin {
|
|
328
|
-
0% {
|
|
329
|
-
|
|
330
|
+
0% {
|
|
331
|
+
transform: rotate(0deg);
|
|
332
|
+
}
|
|
333
|
+
100% {
|
|
334
|
+
transform: rotate(360deg);
|
|
335
|
+
}
|
|
330
336
|
}
|
|
331
337
|
|
|
332
338
|
.imggen-regen-spinning {
|
|
@@ -530,7 +536,9 @@
|
|
|
530
536
|
border-radius: 8px;
|
|
531
537
|
text-align: center;
|
|
532
538
|
cursor: pointer;
|
|
533
|
-
transition:
|
|
539
|
+
transition:
|
|
540
|
+
border-color 0.2s,
|
|
541
|
+
background-color 0.2s;
|
|
534
542
|
margin-bottom: 1rem;
|
|
535
543
|
}
|
|
536
544
|
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
import './ImgGen.css';
|
|
7
|
+
export interface ImgGenProps {
|
|
8
|
+
readonly prompt: string;
|
|
9
|
+
readonly _id: string;
|
|
10
|
+
readonly className: string;
|
|
11
|
+
readonly alt: string;
|
|
12
|
+
readonly images: File[];
|
|
13
|
+
readonly options: ImageGenOptions;
|
|
14
|
+
readonly database: string | Database;
|
|
15
|
+
readonly useImageGen: (options: Partial<UseImageGenOptions>) => UseImageGenResult;
|
|
16
|
+
readonly onComplete: () => void;
|
|
17
|
+
readonly onError: (error: Error) => void;
|
|
18
|
+
readonly onDelete: (id: string) => void;
|
|
19
|
+
readonly onPromptEdit: (id: string, newPrompt: string) => void;
|
|
20
|
+
readonly classes: ImgGenClasses;
|
|
21
|
+
readonly onDocumentCreated: (docId: string) => void;
|
|
22
|
+
readonly debug: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare function ImgGen(props: Partial<ImgGenProps>): React.ReactElement;
|
|
25
|
+
export default ImgGen;
|
|
@@ -1,55 +1,33 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { v4 as uuid } from 'uuid';
|
|
3
|
-
import { useImageGen } from '../hooks/image-gen/use-image-gen';
|
|
3
|
+
import { useImageGen as defaultUseImageGen } from '../hooks/image-gen/use-image-gen.js';
|
|
4
4
|
import { useFireproof } from 'use-fireproof';
|
|
5
|
-
import { ImgGenPromptWaiting, ImgGenDisplayPlaceholder, ImgGenDisplay, ImgGenError, } from './ImgGenUtils';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { logDebug } from '../utils/debug';
|
|
5
|
+
import { ImgGenPromptWaiting, ImgGenDisplayPlaceholder, ImgGenDisplay, ImgGenError, } from './ImgGenUtils.js';
|
|
6
|
+
import { ImgGenUploadWaiting } from './ImgGenUtils/ImgGenUploadWaiting.js';
|
|
7
|
+
import { getImgGenMode } from './ImgGenUtils/ImgGenModeUtils.js';
|
|
8
|
+
import { defaultClasses } from '../utils/style-utils.js';
|
|
9
|
+
import { logDebug } from '../utils/debug.js';
|
|
11
10
|
import './ImgGen.css';
|
|
12
|
-
/**
|
|
13
|
-
* Core implementation of ImgGen component
|
|
14
|
-
* This is the component that gets remounted when the document ID or prompt changes
|
|
15
|
-
*/
|
|
16
11
|
function ImgGenCore(props) {
|
|
17
|
-
|
|
18
|
-
const { prompt, _id, className, alt, images, options, database, onComplete, onError, onDelete, onPromptEdit, onDocumentCreated, classes = defaultClasses, debug, } = props;
|
|
19
|
-
// Get access to the Fireproof database directly
|
|
12
|
+
const { prompt, _id, className, alt, images, options, database, onComplete, onError, onDelete, onPromptEdit, onDocumentCreated, classes = defaultClasses, debug, useImageGen, } = props;
|
|
20
13
|
const { database: db } = useFireproof(database || 'ImgGen');
|
|
21
|
-
// Use a unique generationId to trigger regeneration
|
|
22
|
-
// This provides a clearer signal when regeneration is needed
|
|
23
14
|
const [generationId, setGenerationId] = React.useState(undefined);
|
|
24
|
-
// Track the edited prompt to pass to the image generator and show in UI
|
|
25
15
|
const [currentEditedPrompt, setCurrentEditedPrompt] = React.useState(undefined);
|
|
26
|
-
// Track the document for image generation - use ImageDocument type or Record
|
|
27
16
|
const [imageGenDocument, setImageGenDocument] = React.useState(null);
|
|
28
|
-
// Merge options with images into a single options object for the hook
|
|
29
17
|
const mergedOptions = React.useMemo(() => (images ? { ...options, images } : options), [options, images]);
|
|
30
|
-
// Determine the effective prompt to use - either from form submission or props
|
|
31
18
|
const effectivePrompt = currentEditedPrompt || prompt || '';
|
|
32
|
-
// Check if we should skip image generation based on whether we have prompt or id
|
|
33
|
-
// Use effectivePrompt instead of just props.prompt
|
|
34
19
|
const shouldSkipGeneration = !effectivePrompt && !_id;
|
|
35
|
-
|
|
36
|
-
const { imageData, loading, error, progress, document } = useImageGen({
|
|
37
|
-
// Use the effective prompt that prioritizes form submission
|
|
20
|
+
const { imageData, loading, error, progress, document } = (useImageGen || defaultUseImageGen)({
|
|
38
21
|
prompt: effectivePrompt,
|
|
39
22
|
_id: _id,
|
|
40
23
|
options: {
|
|
41
24
|
...mergedOptions,
|
|
42
|
-
// Include the document with uploaded files for image generation
|
|
43
25
|
...(imageGenDocument ? { document: imageGenDocument } : {}),
|
|
44
26
|
},
|
|
45
27
|
database,
|
|
46
|
-
// Use the generationId to signal when we want a new image
|
|
47
28
|
generationId,
|
|
48
|
-
// We no longer need editedPrompt since we're using effectivePrompt as the main prompt
|
|
49
|
-
// Skip processing if neither prompt nor _id is provided
|
|
50
29
|
skip: shouldSkipGeneration,
|
|
51
30
|
});
|
|
52
|
-
// Determine the current display mode based on document state
|
|
53
31
|
const mode = React.useMemo(() => {
|
|
54
32
|
return getImgGenMode({
|
|
55
33
|
document,
|
|
@@ -58,7 +36,7 @@ function ImgGenCore(props) {
|
|
|
58
36
|
error: error || undefined,
|
|
59
37
|
debug,
|
|
60
38
|
});
|
|
61
|
-
}, [document, effectivePrompt, loading, error, debug]);
|
|
39
|
+
}, [document, effectivePrompt, loading, error, debug]);
|
|
62
40
|
if (debug) {
|
|
63
41
|
logDebug('[ImgGenCore] Current mode:', mode, {
|
|
64
42
|
document: !!document,
|
|
@@ -68,43 +46,32 @@ function ImgGenCore(props) {
|
|
|
68
46
|
error: !!error,
|
|
69
47
|
});
|
|
70
48
|
}
|
|
71
|
-
// When document is generated, use its ID for subsequent operations
|
|
72
|
-
// This is done through the parent component's remounting logic with uuid()
|
|
73
49
|
React.useEffect(() => {
|
|
74
50
|
if (onComplete && imageData && !loading && !error) {
|
|
75
51
|
onComplete();
|
|
76
52
|
}
|
|
77
53
|
}, [onComplete, imageData, loading, error]);
|
|
78
|
-
// Handle errors from the image generation hook
|
|
79
54
|
React.useEffect(() => {
|
|
80
55
|
if (onError && error) {
|
|
81
56
|
onError(error);
|
|
82
57
|
}
|
|
83
58
|
}, [onError, error]);
|
|
84
|
-
// Handle regeneration
|
|
85
59
|
const handleRegen = React.useCallback(() => {
|
|
86
60
|
if (document?._id || _id || prompt) {
|
|
87
|
-
// Create a new unique ID to trigger regeneration
|
|
88
61
|
const newGenId = crypto.randomUUID();
|
|
89
62
|
setGenerationId(newGenId);
|
|
90
63
|
}
|
|
91
64
|
}, [document, _id, prompt]);
|
|
92
|
-
// Handle prompt editing
|
|
93
65
|
const handlePromptEdit = React.useCallback(async (id, newPrompt) => {
|
|
94
|
-
// Update the tracked edited prompt
|
|
95
66
|
setCurrentEditedPrompt(newPrompt);
|
|
96
67
|
try {
|
|
97
|
-
// First, update the document in the database with the new prompt
|
|
98
68
|
const doc = await db.get(id);
|
|
99
69
|
if (!doc) {
|
|
100
70
|
logDebug('Document not found:', id);
|
|
101
71
|
return;
|
|
102
72
|
}
|
|
103
|
-
// Update prompt structure based on existing document pattern
|
|
104
|
-
// Support both 'prompt' field (legacy) and new structured 'prompts' pattern
|
|
105
73
|
const updatedDoc = { ...doc };
|
|
106
74
|
if (updatedDoc.prompts) {
|
|
107
|
-
// Handle new structured prompts with versioning
|
|
108
75
|
const promptKey = `p${Date.now()}`;
|
|
109
76
|
updatedDoc.prompts = {
|
|
110
77
|
...updatedDoc.prompts,
|
|
@@ -113,43 +80,32 @@ function ImgGenCore(props) {
|
|
|
113
80
|
updatedDoc.currentPromptKey = promptKey;
|
|
114
81
|
}
|
|
115
82
|
else {
|
|
116
|
-
// Handle simple legacy prompt field
|
|
117
83
|
updatedDoc.prompt = newPrompt;
|
|
118
84
|
}
|
|
119
|
-
// Save the updated document
|
|
120
85
|
await db.put(updatedDoc);
|
|
121
|
-
// Notify parent component
|
|
122
86
|
if (onPromptEdit) {
|
|
123
87
|
onPromptEdit(id, newPrompt);
|
|
124
88
|
}
|
|
125
|
-
// Store the document to be used for generation
|
|
126
|
-
// This ensures that when the regeneration happens, we have access to the document with uploaded images
|
|
127
89
|
const refreshedDoc = await db.get(id);
|
|
128
|
-
// Set the document in options before triggering regeneration
|
|
129
90
|
if (refreshedDoc) {
|
|
130
|
-
// Set a local state variable for the document to be used during regeneration
|
|
131
91
|
setImageGenDocument(refreshedDoc);
|
|
132
92
|
if (debug) {
|
|
133
93
|
logDebug('[ImgGen] Setting document for image generation:', refreshedDoc._id, 'with files:', Object.keys(refreshedDoc._files || {}).filter((key) => key.startsWith('in')));
|
|
134
94
|
}
|
|
135
95
|
}
|
|
136
|
-
// Now trigger regeneration with the updated prompt
|
|
137
96
|
handleRegen();
|
|
138
97
|
}
|
|
139
98
|
catch (error) {
|
|
140
99
|
logDebug('Error updating prompt:', error);
|
|
141
100
|
}
|
|
142
101
|
}, [db, handleRegen, onPromptEdit]);
|
|
143
|
-
// Handle document deletion
|
|
144
102
|
const handleDelete = React.useCallback(async (id) => {
|
|
145
103
|
logDebug('[ImgGen] Attempting to delete document:', id);
|
|
146
104
|
try {
|
|
147
|
-
// Use await to ensure the operation completes
|
|
148
105
|
const result = await db.del(id);
|
|
149
106
|
if (debug) {
|
|
150
107
|
logDebug('[ImgGen] Document deletion result:', result);
|
|
151
108
|
}
|
|
152
|
-
// Notify parent component about deletion
|
|
153
109
|
if (onDelete) {
|
|
154
110
|
if (debug) {
|
|
155
111
|
logDebug('[ImgGen] Calling onDelete callback with id:', id);
|
|
@@ -161,17 +117,14 @@ function ImgGenCore(props) {
|
|
|
161
117
|
logDebug('Error deleting document:', error);
|
|
162
118
|
}
|
|
163
119
|
}, [db, onDelete, debug]);
|
|
164
|
-
// Handle document creation from file uploads
|
|
165
120
|
const handleDocCreated = React.useCallback((docId) => {
|
|
166
121
|
if (debug) {
|
|
167
122
|
logDebug('[ImgGenCore] Document created:', docId);
|
|
168
123
|
}
|
|
169
|
-
// Call user's callback if provided
|
|
170
124
|
if (onDocumentCreated) {
|
|
171
125
|
onDocumentCreated(docId);
|
|
172
126
|
}
|
|
173
127
|
}, [onDocumentCreated, debug]);
|
|
174
|
-
// Render function that determines what to show based on current mode
|
|
175
128
|
function renderContent() {
|
|
176
129
|
if (debug) {
|
|
177
130
|
logDebug('[ImgGen Debug] Render state:', {
|
|
@@ -183,59 +136,41 @@ function ImgGenCore(props) {
|
|
|
183
136
|
imageData: !!imageData,
|
|
184
137
|
});
|
|
185
138
|
}
|
|
186
|
-
// Render different components based on the current mode
|
|
187
139
|
switch (mode) {
|
|
188
140
|
case 'placeholder': {
|
|
189
|
-
// Initial state - no document, no prompt
|
|
190
|
-
// Use the same ImgGenUploadWaiting component that's used in uploadWaiting mode
|
|
191
|
-
// but without a document (this creates a consistent UI for both entry points)
|
|
192
141
|
return (React.createElement(ImgGenUploadWaiting, { className: className, classes: classes, debug: debug, database: database, onDocumentCreated: handleDocCreated, onPromptSubmit: (newPrompt) => {
|
|
193
|
-
// When a user enters a prompt directly in the initial state
|
|
194
142
|
if (debug) {
|
|
195
143
|
logDebug('[ImgGenCore] Prompt submitted from initial view:', newPrompt);
|
|
196
144
|
}
|
|
197
|
-
// Update the edited prompt and generate a new generationId to trigger generation
|
|
198
145
|
setCurrentEditedPrompt(newPrompt);
|
|
199
146
|
setGenerationId(uuid());
|
|
200
147
|
} }));
|
|
201
148
|
}
|
|
202
149
|
case 'uploadWaiting': {
|
|
203
|
-
// We have a document with uploaded files, waiting for prompt input
|
|
204
150
|
if (!document || !document._id) {
|
|
205
|
-
// This shouldn't happen - go back to placeholder if no document
|
|
206
151
|
return React.createElement(ImgGenPromptWaiting, { className: className, classes: classes });
|
|
207
152
|
}
|
|
208
|
-
// If loading has started, switch to generating view to show progress
|
|
209
153
|
if (loading) {
|
|
210
154
|
const displayPrompt = currentEditedPrompt || prompt;
|
|
211
155
|
return (React.createElement(ImgGenDisplayPlaceholder, { prompt: displayPrompt || '', loading: loading, progress: progress, error: error, className: className, classes: classes }));
|
|
212
156
|
}
|
|
213
|
-
return (React.createElement(React.Fragment, null,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
if (targetDocId) {
|
|
228
|
-
// Use the document ID to ensure we're using the correct document with the uploaded images
|
|
229
|
-
handlePromptEdit(targetDocId, newPrompt);
|
|
230
|
-
}
|
|
231
|
-
} })));
|
|
157
|
+
return (React.createElement(React.Fragment, null, React.createElement(ImgGenUploadWaiting, { document: document, className: className, classes: classes, debug: debug, database: database, onFilesAdded: () => {
|
|
158
|
+
if (debug) {
|
|
159
|
+
logDebug('[ImgGenCore] Files added to existing document:', document._id);
|
|
160
|
+
}
|
|
161
|
+
}, onPromptSubmit: (newPrompt, docId) => {
|
|
162
|
+
const targetDocId = docId || (document && document._id);
|
|
163
|
+
if (debug) {
|
|
164
|
+
logDebug('[ImgGenCore] Prompt submitted for existing uploads:', newPrompt);
|
|
165
|
+
logDebug('[ImgGenCore] Using document ID:', targetDocId);
|
|
166
|
+
}
|
|
167
|
+
if (targetDocId) {
|
|
168
|
+
handlePromptEdit(targetDocId, newPrompt);
|
|
169
|
+
}
|
|
170
|
+
} })));
|
|
232
171
|
}
|
|
233
172
|
case 'generating': {
|
|
234
|
-
// Document with prompt, waiting for generation to complete
|
|
235
|
-
// Use the edited prompt during generation if available, or fall back to document prompt
|
|
236
|
-
// Look in three places: 1) edited prompt 2) direct prop 3) document's prompt
|
|
237
173
|
let displayPrompt = currentEditedPrompt || prompt;
|
|
238
|
-
// If we still don't have a prompt but have a document with a prompt, use that
|
|
239
174
|
if (!displayPrompt &&
|
|
240
175
|
document &&
|
|
241
176
|
'prompt' in document &&
|
|
@@ -253,64 +188,42 @@ function ImgGenCore(props) {
|
|
|
253
188
|
return (React.createElement(ImgGenDisplayPlaceholder, { prompt: displayPrompt || '', loading: loading, progress: progress, error: error, className: className, classes: classes }));
|
|
254
189
|
}
|
|
255
190
|
case 'display': {
|
|
256
|
-
// Document with generated images
|
|
257
191
|
if (!document || !document._id) {
|
|
258
192
|
return React.createElement(ImgGenError, { message: "Missing document" });
|
|
259
193
|
}
|
|
260
|
-
return (React.createElement(React.Fragment, null,
|
|
261
|
-
React.createElement(ImgGenDisplay, { document: document, loading: loading, progress: progress, onPromptEdit: handlePromptEdit, onDelete: handleDelete, onRegen: handleRegen, alt: alt || '', className: className, classes: classes, debug: debug, error: error })));
|
|
194
|
+
return (React.createElement(React.Fragment, null, React.createElement(ImgGenDisplay, { document: document, loading: loading, progress: progress, onPromptEdit: handlePromptEdit, onDelete: handleDelete, onRegen: handleRegen, alt: alt || '', className: className, classes: classes, debug: debug, error: error })));
|
|
262
195
|
}
|
|
263
196
|
case 'error': {
|
|
264
|
-
// Error state
|
|
265
197
|
return (React.createElement(ImgGenError, { message: error ? error.message : 'Unknown error', className: className }));
|
|
266
198
|
}
|
|
267
199
|
default: {
|
|
268
|
-
// Fallback for any unexpected state
|
|
269
200
|
return React.createElement(ImgGenError, { message: "Unknown state" });
|
|
270
201
|
}
|
|
271
202
|
}
|
|
272
203
|
}
|
|
273
|
-
// Always render through the render function - no conditional returns in the main component body
|
|
274
204
|
return renderContent();
|
|
275
205
|
}
|
|
276
|
-
/**
|
|
277
|
-
* Main component for generating images with call-ai's imageGen
|
|
278
|
-
* Provides automatic caching, reactive updates, and placeholder handling
|
|
279
|
-
* Uses a mountKey to ensure clean state when switching documents
|
|
280
|
-
*/
|
|
281
206
|
export function ImgGen(props) {
|
|
282
|
-
// Destructure key props for identity-change tracking
|
|
283
|
-
// classes prop is used via the props spread to ImgGenCore
|
|
284
207
|
const { _id, prompt, debug, onDocumentCreated } = props;
|
|
285
|
-
// Generate a unique mountKey for this instance
|
|
286
208
|
const [mountKey, setMountKey] = React.useState(() => uuid());
|
|
287
|
-
// Track document creation from uploads for remounting
|
|
288
209
|
const [uploadedDocId, setUploadedDocId] = React.useState(undefined);
|
|
289
|
-
// Handle document creation callback - combines user callback with internal state
|
|
290
210
|
const handleDocCreated = React.useCallback((docId) => {
|
|
291
211
|
if (debug)
|
|
292
212
|
logDebug('[ImgGen] Document created:', docId);
|
|
293
|
-
// Update internal state to trigger remount
|
|
294
213
|
setUploadedDocId(docId);
|
|
295
|
-
// Call user's callback if provided
|
|
296
214
|
if (onDocumentCreated) {
|
|
297
215
|
if (debug)
|
|
298
216
|
logDebug('[ImgGen] Calling onDocumentCreated callback');
|
|
299
217
|
onDocumentCreated(docId);
|
|
300
218
|
}
|
|
301
219
|
}, [debug, onDocumentCreated]);
|
|
302
|
-
// Track previous props/state to detect identity changes
|
|
303
220
|
const prevIdRef = React.useRef(_id);
|
|
304
221
|
const prevPromptRef = React.useRef(prompt);
|
|
305
222
|
const prevUploadedDocIdRef = React.useRef(uploadedDocId);
|
|
306
|
-
// Update mountKey when document identity changes
|
|
307
223
|
React.useEffect(() => {
|
|
308
224
|
const idChanged = _id !== prevIdRef.current;
|
|
309
225
|
const promptChanged = prompt && prompt !== prevPromptRef.current;
|
|
310
226
|
const uploadedDocIdChanged = uploadedDocId !== prevUploadedDocIdRef.current;
|
|
311
|
-
// Reset mountKey if we switched documents, or if we're showing a new prompt
|
|
312
|
-
// with no document ID (which means a brand new generation),
|
|
313
|
-
// or if we got a new document ID from uploads
|
|
314
227
|
if (idChanged || (!_id && promptChanged) || uploadedDocIdChanged) {
|
|
315
228
|
if (debug) {
|
|
316
229
|
logDebug('[ImgGen] Identity change detected, generating new mountKey:', {
|
|
@@ -325,27 +238,20 @@ export function ImgGen(props) {
|
|
|
325
238
|
prevUploadedDocId: prevUploadedDocIdRef.current,
|
|
326
239
|
});
|
|
327
240
|
}
|
|
328
|
-
setMountKey(uuid());
|
|
241
|
+
setMountKey(uuid());
|
|
329
242
|
}
|
|
330
|
-
// Update refs for next comparison
|
|
331
243
|
prevIdRef.current = _id;
|
|
332
244
|
prevPromptRef.current = prompt;
|
|
333
245
|
prevUploadedDocIdRef.current = uploadedDocId;
|
|
334
246
|
}, [_id, prompt, uploadedDocId, debug]);
|
|
335
|
-
// Create a merged props object with the document creation handler
|
|
336
247
|
const coreProps = {
|
|
337
248
|
...props,
|
|
338
249
|
onDocumentCreated: handleDocCreated,
|
|
339
250
|
};
|
|
340
|
-
// Handle different cases for document identity
|
|
341
251
|
if (uploadedDocId && !_id) {
|
|
342
|
-
// Always pass the uploadedDocId to ImgGenCore so it can access the document
|
|
343
|
-
// This ensures the document with uploaded files is accessible
|
|
344
252
|
coreProps._id = uploadedDocId;
|
|
345
253
|
}
|
|
346
|
-
// Render the core component with a key to force remount when identity changes
|
|
347
254
|
return React.createElement(ImgGenCore, { ...coreProps, key: mountKey });
|
|
348
255
|
}
|
|
349
|
-
// Simple export - no memoization or complex structure
|
|
350
256
|
export default ImgGen;
|
|
351
257
|
//# sourceMappingURL=ImgGen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImgGen.js","sourceRoot":"","sources":["../../jsr/components/ImgGen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,WAAW,IAAI,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EAAE,YAAY,EAAY,MAAM,eAAe,CAAC;AAMvD,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAiB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,cAAc,CAAC;AAoDtB,SAAS,UAAU,CAAC,KAA2B,EAAsB;IAEnE,MAAM,EACJ,MAAM,EACN,GAAG,EACH,SAAS,EACT,GAAG,EACH,MAAM,EACN,OAAO,EACP,QAAQ,EACR,UAAU,EACV,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,OAAO,GAAG,cAAc,EACxB,KAAK,EACL,WAAW,GACZ,GAAG,KAAK,CAAC;IAGV,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,YAAY,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC;IAI5D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAqB,SAAS,CAAC,CAAC;IAGtF,MAAM,CAAC,mBAAmB,EAA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