use-vibes 2.0.3 → 2.0.7
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 +44 -44
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,14 +11,14 @@ pnpm add use-vibes
|
|
|
11
11
|
## Basic Usage
|
|
12
12
|
|
|
13
13
|
```jsx
|
|
14
|
-
import {
|
|
14
|
+
import { ImgVibes } from "use-vibes";
|
|
15
15
|
|
|
16
16
|
function MyComponent() {
|
|
17
|
-
// You can use
|
|
18
|
-
return <
|
|
17
|
+
// You can use ImgVibes without any props - it includes its own form UI
|
|
18
|
+
return <ImgVibes />;
|
|
19
19
|
|
|
20
20
|
// Or provide a prompt directly (bypasses the form UI completely)
|
|
21
|
-
// return <
|
|
21
|
+
// return <ImgVibes prompt="A futuristic cityscape with flying cars" />;
|
|
22
22
|
}
|
|
23
23
|
```
|
|
24
24
|
|
|
@@ -41,7 +41,7 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
|
41
41
|
{
|
|
42
42
|
/* Includes a built-in form UI for prompt entry and image upload */
|
|
43
43
|
}
|
|
44
|
-
<
|
|
44
|
+
<ImgVibes />;
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
- **One-line Implementation**: Directly specify a prompt for immediate generation (bypasses the form UI)
|
|
@@ -50,17 +50,17 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
|
50
50
|
{
|
|
51
51
|
/* Starts generating immediately, no form shown to the user */
|
|
52
52
|
}
|
|
53
|
-
<
|
|
53
|
+
<ImgVibes prompt="A sunset over mountains" />;
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
- **Automatic Database Integration**: All images are automatically stored in Fireproof database with version history
|
|
57
57
|
|
|
58
58
|
```jsx
|
|
59
59
|
// Custom database name
|
|
60
|
-
<
|
|
60
|
+
<ImgVibes prompt="Forest landscape" database="MyCustomDB" />
|
|
61
61
|
|
|
62
62
|
// Or pass a database instance
|
|
63
|
-
<
|
|
63
|
+
<ImgVibes prompt="Forest landscape" database={myDbInstance} />
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
### Prompt Management
|
|
@@ -74,7 +74,7 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
|
74
74
|
- Press Enter to submit and regenerate with new prompt
|
|
75
75
|
- App receives updates via `onPromptEdit` callback
|
|
76
76
|
```jsx
|
|
77
|
-
<
|
|
77
|
+
<ImgVibes
|
|
78
78
|
prompt="Initial prompt"
|
|
79
79
|
onPromptEdit={(id, newPrompt) => {
|
|
80
80
|
console.log(`Document ${id} updated with new prompt: ${newPrompt}`);
|
|
@@ -91,18 +91,18 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
|
91
91
|
- **Image Quality Control**: Set quality levels for output images
|
|
92
92
|
|
|
93
93
|
```jsx
|
|
94
|
-
<
|
|
94
|
+
<ImgVibes prompt="Detailed artwork" options={{ quality: "high" }} />
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
- **Image Editing with Uploads**: Process existing images with AI
|
|
98
98
|
|
|
99
99
|
```jsx
|
|
100
|
-
<
|
|
100
|
+
<ImgVibes prompt="Turn this photo into a watercolor painting" images={[myImageFile]} />
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
- **Multiple Image Inputs**: Combine multiple images in one generation
|
|
104
104
|
```jsx
|
|
105
|
-
<
|
|
105
|
+
<ImgVibes prompt="Create a collage of these photos" images={[photo1, photo2, photo3]} />
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
### User Interface Components
|
|
@@ -115,7 +115,7 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
|
115
115
|
|
|
116
116
|
```jsx
|
|
117
117
|
// Disable overlay for a minimal UI
|
|
118
|
-
<
|
|
118
|
+
<ImgVibes prompt="Clean interface" overlay={false} />
|
|
119
119
|
```
|
|
120
120
|
|
|
121
121
|
- **Progress Visualization**: Shows generation progress with visual indicators
|
|
@@ -124,7 +124,7 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
|
124
124
|
|
|
125
125
|
- **Error Handling UI**: Clean error states with informative messages
|
|
126
126
|
```jsx
|
|
127
|
-
<
|
|
127
|
+
<ImgVibes
|
|
128
128
|
prompt="Test error handling"
|
|
129
129
|
onError={(error) => {
|
|
130
130
|
console.error("Generation failed:", error.message);
|
|
@@ -154,7 +154,7 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
|
154
154
|
|
|
155
155
|
- **Generation Lifecycle Events**: Track the complete generation process
|
|
156
156
|
```jsx
|
|
157
|
-
<
|
|
157
|
+
<ImgVibes
|
|
158
158
|
prompt="Track this generation"
|
|
159
159
|
onComplete={() => console.log("Generation complete!")}
|
|
160
160
|
onError={(error) => console.error("Generation failed:", error)}
|
|
@@ -193,7 +193,7 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
|
193
193
|
- Custom classes for component-level styling
|
|
194
194
|
|
|
195
195
|
```jsx
|
|
196
|
-
<
|
|
196
|
+
<ImgVibes
|
|
197
197
|
prompt="Styled component"
|
|
198
198
|
classes={{
|
|
199
199
|
root: "my-custom-container",
|
|
@@ -211,19 +211,19 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
|
211
211
|
```jsx
|
|
212
212
|
<div className="image-grid">
|
|
213
213
|
{imageDocuments.map((doc) => (
|
|
214
|
-
<
|
|
214
|
+
<ImgVibes key={doc._id} _id={doc._id} className="thumbnail" />
|
|
215
215
|
))}
|
|
216
216
|
</div>
|
|
217
217
|
```
|
|
218
218
|
|
|
219
219
|
- **Document Reuse**: Load existing documents by ID
|
|
220
220
|
```jsx
|
|
221
|
-
<
|
|
221
|
+
<ImgVibes _id="existing-document-id" />
|
|
222
222
|
```
|
|
223
223
|
|
|
224
224
|
## Implementation Modes
|
|
225
225
|
|
|
226
|
-
The
|
|
226
|
+
The ImgVibes component has several operational modes that it switches between automatically:
|
|
227
227
|
|
|
228
228
|
1. **Placeholder Mode**: Initial state when no prompt or document ID is provided
|
|
229
229
|
2. **Upload Waiting Mode**: When files are uploaded but waiting for a prompt
|
|
@@ -240,7 +240,7 @@ The component automatically determines which mode to use based on the current st
|
|
|
240
240
|
Enable debug mode to see detailed console logs about component state:
|
|
241
241
|
|
|
242
242
|
```jsx
|
|
243
|
-
<
|
|
243
|
+
<ImgVibes prompt="Debug this" options={{ debug: true }} />
|
|
244
244
|
```
|
|
245
245
|
|
|
246
246
|
### Custom Image Sizing
|
|
@@ -248,12 +248,12 @@ Enable debug mode to see detailed console logs about component state:
|
|
|
248
248
|
Control output image dimensions with the size option:
|
|
249
249
|
|
|
250
250
|
```jsx
|
|
251
|
-
<
|
|
251
|
+
<ImgVibes
|
|
252
252
|
prompt="Landscape format"
|
|
253
253
|
options={{ size: '1536x1024' }} // Landscape
|
|
254
254
|
/>
|
|
255
255
|
|
|
256
|
-
<
|
|
256
|
+
<ImgVibes
|
|
257
257
|
prompt="Portrait format"
|
|
258
258
|
options={{ size: '1024x1536' }} // Portrait
|
|
259
259
|
/>
|
|
@@ -261,7 +261,7 @@ Control output image dimensions with the size option:
|
|
|
261
261
|
|
|
262
262
|
# Advanced Usage
|
|
263
263
|
|
|
264
|
-
This guide covers the implementation, configuration, and best practices for using the
|
|
264
|
+
This guide covers the implementation, configuration, and best practices for using the ImgVibes component from the use-vibes library.
|
|
265
265
|
|
|
266
266
|
## Installation
|
|
267
267
|
|
|
@@ -271,7 +271,7 @@ pnpm add use-vibes
|
|
|
271
271
|
|
|
272
272
|
### Styling
|
|
273
273
|
|
|
274
|
-
The
|
|
274
|
+
The ImgVibes component uses inline styles with centralized theme constants, so **no separate CSS setup is required**. All styling is self-contained within the component.
|
|
275
275
|
|
|
276
276
|
## Basic Usage
|
|
277
277
|
|
|
@@ -280,12 +280,12 @@ The ImgGen component uses inline styles with centralized theme constants, so **n
|
|
|
280
280
|
Add AI image generation to any React app with minimal code:
|
|
281
281
|
|
|
282
282
|
```jsx
|
|
283
|
-
import {
|
|
283
|
+
import { ImgVibes } from "use-vibes";
|
|
284
284
|
|
|
285
285
|
function MyComponent() {
|
|
286
286
|
return (
|
|
287
287
|
<div>
|
|
288
|
-
<
|
|
288
|
+
<ImgVibes prompt="A sunset over mountains" />
|
|
289
289
|
</div>
|
|
290
290
|
);
|
|
291
291
|
}
|
|
@@ -296,7 +296,7 @@ function MyComponent() {
|
|
|
296
296
|
Configure image generation with the `options` prop:
|
|
297
297
|
|
|
298
298
|
```jsx
|
|
299
|
-
<
|
|
299
|
+
<ImgVibes
|
|
300
300
|
prompt="A detailed cityscape"
|
|
301
301
|
options={{
|
|
302
302
|
model: "gpt-image-1",
|
|
@@ -340,10 +340,10 @@ Configure image generation with the `options` prop:
|
|
|
340
340
|
|
|
341
341
|
### Prompt Management
|
|
342
342
|
|
|
343
|
-
The
|
|
343
|
+
The ImgVibes component tracks the history of different prompts used to generate an image:
|
|
344
344
|
|
|
345
345
|
```jsx
|
|
346
|
-
<
|
|
346
|
+
<ImgVibes
|
|
347
347
|
prompt="Initial prompt"
|
|
348
348
|
onPromptEdit={(id, newPrompt) => {
|
|
349
349
|
console.log(`Document ${id} updated with new prompt: ${newPrompt}`);
|
|
@@ -369,7 +369,7 @@ The component supports one-click regeneration, preserving document history while
|
|
|
369
369
|
Set quality levels for output images:
|
|
370
370
|
|
|
371
371
|
```jsx
|
|
372
|
-
<
|
|
372
|
+
<ImgVibes prompt="Detailed artwork" options={{ quality: "high" }} />
|
|
373
373
|
```
|
|
374
374
|
|
|
375
375
|
#### Image Editing with Uploads
|
|
@@ -377,7 +377,7 @@ Set quality levels for output images:
|
|
|
377
377
|
Process existing images with AI:
|
|
378
378
|
|
|
379
379
|
```jsx
|
|
380
|
-
<
|
|
380
|
+
<ImgVibes prompt="Turn this photo into a watercolor painting" images={[myImageFile]} />
|
|
381
381
|
```
|
|
382
382
|
|
|
383
383
|
#### Multiple Image Inputs
|
|
@@ -385,7 +385,7 @@ Process existing images with AI:
|
|
|
385
385
|
Combine multiple images in one generation:
|
|
386
386
|
|
|
387
387
|
```jsx
|
|
388
|
-
<
|
|
388
|
+
<ImgVibes prompt="Create a collage of these photos" images={[photo1, photo2, photo3]} />
|
|
389
389
|
```
|
|
390
390
|
|
|
391
391
|
### Database Integration
|
|
@@ -394,10 +394,10 @@ All images are automatically stored in a Fireproof database with version history
|
|
|
394
394
|
|
|
395
395
|
```jsx
|
|
396
396
|
// Custom database name
|
|
397
|
-
<
|
|
397
|
+
<ImgVibes prompt="Forest landscape" database="MyCustomDB" />
|
|
398
398
|
|
|
399
399
|
// Or pass a database instance
|
|
400
|
-
<
|
|
400
|
+
<ImgVibes prompt="Forest landscape" database={myDbInstance} />
|
|
401
401
|
```
|
|
402
402
|
|
|
403
403
|
### Event Callbacks
|
|
@@ -405,7 +405,7 @@ All images are automatically stored in a Fireproof database with version history
|
|
|
405
405
|
Track the complete generation process with lifecycle events:
|
|
406
406
|
|
|
407
407
|
```jsx
|
|
408
|
-
<
|
|
408
|
+
<ImgVibes
|
|
409
409
|
prompt="Track this generation"
|
|
410
410
|
onComplete={() => console.log("Generation complete!")}
|
|
411
411
|
onError={(error) => console.error("Generation failed:", error)}
|
|
@@ -420,7 +420,7 @@ Toggle the information overlay and controls:
|
|
|
420
420
|
|
|
421
421
|
```jsx
|
|
422
422
|
// Disable overlay for a minimal UI
|
|
423
|
-
<
|
|
423
|
+
<ImgVibes prompt="Clean interface" overlay={false} />
|
|
424
424
|
```
|
|
425
425
|
|
|
426
426
|
The overlay includes:
|
|
@@ -447,14 +447,14 @@ const imageFile = base64ToFile(imageResponse.data[0].b64_json, "my-image.png");
|
|
|
447
447
|
|
|
448
448
|
### CSS Variables
|
|
449
449
|
|
|
450
|
-
The component uses centralized theme constants from `
|
|
450
|
+
The component uses centralized theme constants from `imgVibesTheme` for consistent styling. All styles are applied inline using JavaScript objects, eliminating the need for external CSS files.
|
|
451
451
|
|
|
452
452
|
### Custom Classes
|
|
453
453
|
|
|
454
454
|
For more granular control, provide a `classes` object with custom CSS classes for specific component parts:
|
|
455
455
|
|
|
456
456
|
```jsx
|
|
457
|
-
<
|
|
457
|
+
<ImgVibes
|
|
458
458
|
prompt="Styled component"
|
|
459
459
|
classes={{
|
|
460
460
|
root: "my-custom-container",
|
|
@@ -491,7 +491,7 @@ Easily create image galleries using document IDs:
|
|
|
491
491
|
```jsx
|
|
492
492
|
<div className="image-grid">
|
|
493
493
|
{imageDocuments.map((doc) => (
|
|
494
|
-
<
|
|
494
|
+
<ImgVibes key={doc._id} _id={doc._id} className="thumbnail" />
|
|
495
495
|
))}
|
|
496
496
|
</div>
|
|
497
497
|
```
|
|
@@ -501,12 +501,12 @@ Easily create image galleries using document IDs:
|
|
|
501
501
|
Load existing documents by `_id`:
|
|
502
502
|
|
|
503
503
|
```jsx
|
|
504
|
-
<
|
|
504
|
+
<ImgVibes _id="existing-document-id" />
|
|
505
505
|
```
|
|
506
506
|
|
|
507
507
|
## Operation Modes
|
|
508
508
|
|
|
509
|
-
The
|
|
509
|
+
The ImgVibes component has several operational modes that it switches between automatically:
|
|
510
510
|
|
|
511
511
|
1. **Placeholder Mode**: Initial state when no prompt or document ID is provided
|
|
512
512
|
2. **Upload Waiting Mode**: When files are uploaded but waiting for a prompt
|
|
@@ -521,7 +521,7 @@ The ImgGen component has several operational modes that it switches between auto
|
|
|
521
521
|
Enable debug mode to see detailed console logs about component state:
|
|
522
522
|
|
|
523
523
|
```jsx
|
|
524
|
-
<
|
|
524
|
+
<ImgVibes prompt="Debug this" options={{ debug: true }} />
|
|
525
525
|
```
|
|
526
526
|
|
|
527
527
|
### Custom Image Sizing
|
|
@@ -529,12 +529,12 @@ Enable debug mode to see detailed console logs about component state:
|
|
|
529
529
|
Control output image dimensions with the size option:
|
|
530
530
|
|
|
531
531
|
```jsx
|
|
532
|
-
<
|
|
532
|
+
<ImgVibes
|
|
533
533
|
prompt="Landscape format"
|
|
534
534
|
options={{ size: '1536x1024' }} // Landscape
|
|
535
535
|
/>
|
|
536
536
|
|
|
537
|
-
<
|
|
537
|
+
<ImgVibes
|
|
538
538
|
prompt="Portrait format"
|
|
539
539
|
options={{ size: '1024x1536' }} // Portrait
|
|
540
540
|
/>
|
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { useFireproof, fireproof, ImgFile, toCloud, type Fireproof, callAI, callAi, type CallAI,
|
|
1
|
+
export { useFireproof, fireproof, ImgFile, toCloud, type Fireproof, callAI, callAi, type CallAI, useVibes, type UseVibesOptions, type UseVibesResult, type VibeDocument, generateInstallId, useMobile, } from "@vibes.diy/use-vibes-base";
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { useFireproof, fireproof, ImgFile, toCloud, callAI, callAi,
|
|
1
|
+
export { useFireproof, fireproof, ImgFile, toCloud, callAI, callAi, useVibes, generateInstallId, useMobile, } from "@vibes.diy/use-vibes-base";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,EACZ,SAAS,EACT,OAAO,EACP,OAAO,EAIP,MAAM,EACN,MAAM,EAIN,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,YAAY,EACZ,SAAS,EACT,OAAO,EACP,OAAO,EAIP,MAAM,EACN,MAAM,EAIN,QAAQ,EAMR,iBAAiB,EAGjB,SAAS,GACV,MAAM,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-vibes",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"description": "Transform any DOM element into an AI-powered micro-app",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@fireproof/core-types-base": "~0.24.19",
|
|
30
30
|
"@fireproof/core-types-protocols-cloud": "~0.24.19",
|
|
31
31
|
"@fireproof/use-fireproof": "~0.24.19",
|
|
32
|
-
"@vibes.diy/use-vibes-base": "^2.0.
|
|
32
|
+
"@vibes.diy/use-vibes-base": "^2.0.7"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"react": ">=19.1.0"
|