@umituz/react-native-ai-generation-content 1.17.232 → 1.17.233

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/README.md +236 -261
  2. package/package.json +1 -1
  3. package/src/domains/content-moderation/README.md +239 -296
  4. package/src/domains/creations/README.md +242 -325
  5. package/src/domains/face-detection/README.md +228 -307
  6. package/src/domains/prompts/README.md +242 -312
  7. package/src/features/ai-hug/README.md +381 -219
  8. package/src/features/ai-kiss/README.md +388 -219
  9. package/src/features/anime-selfie/README.md +327 -256
  10. package/src/features/audio-generation/README.md +352 -309
  11. package/src/features/colorization/README.md +332 -228
  12. package/src/features/couple-future/README.md +387 -212
  13. package/src/features/future-prediction/README.md +391 -221
  14. package/src/features/hd-touch-up/README.md +339 -252
  15. package/src/features/image-captioning/README.md +359 -299
  16. package/src/features/image-to-image/README.md +398 -357
  17. package/src/features/image-to-video/README.md +337 -292
  18. package/src/features/inpainting/README.md +348 -244
  19. package/src/features/meme-generator/README.md +350 -269
  20. package/src/features/remove-background/README.md +335 -234
  21. package/src/features/remove-object/README.md +341 -288
  22. package/src/features/replace-background/README.md +353 -236
  23. package/src/features/script-generator/README.md +358 -287
  24. package/src/features/shared/README.md +254 -223
  25. package/src/features/sketch-to-image/README.md +331 -234
  26. package/src/features/style-transfer/README.md +336 -237
  27. package/src/features/text-to-video/README.md +360 -193
  28. package/src/features/text-to-voice/README.md +382 -272
@@ -1,296 +1,393 @@
1
- # Sketch to Image
1
+ # Sketch to Image Feature
2
2
 
3
3
  Convert hand-drawn sketches and doodles into realistic images using AI.
4
4
 
5
- ## Features
5
+ ## 📍 Import Path
6
6
 
7
- - Transform rough sketches into detailed images
8
- - Support for various sketch styles
9
- - Multiple output styles (realistic, artistic, etc.)
10
- - Automatic detail enhancement
11
- - Color and texture generation
7
+ ```typescript
8
+ import { useSketchToImageFeature } from '@umituz/react-native-ai-generation-content';
9
+ ```
12
10
 
13
- ## Installation
11
+ **Location**: `src/features/sketch-to-image/`
14
12
 
15
- This feature is part of `@umituz/react-native-ai-generation-content`.
13
+ ## 🎯 Feature Purpose
16
14
 
17
- ```bash
18
- npm install @umituz/react-native-ai-generation-content
19
- ```
15
+ Transform rough sketches into detailed, realistic images using AI. Supports multiple output styles including realistic, artistic, anime, and 3D render. Automatically adds color, details, and textures to bring drawings to life.
20
16
 
21
- ## Basic Usage
17
+ ---
22
18
 
23
- ### Using the Hook
19
+ ## 📋 Usage Strategy
24
20
 
25
- ```tsx
26
- import { useSketchToImageFeature } from '@umituz/react-native-ai-generation-content';
27
- import * as ImagePicker from 'react-native-image-picker';
28
-
29
- function SketchToImageScreen() {
30
- const [sketch, setSketch] = useState<string | null>(null);
31
-
32
- const feature = useSketchToImageFeature({
33
- config: {
34
- outputStyle: 'realistic',
35
- prompt: 'A beautiful landscape',
36
- onProcessingStart: () => console.log('Converting sketch...'),
37
- onProcessingComplete: (result) => console.log('Complete:', result),
38
- onError: (error) => console.error('Error:', error),
39
- },
40
- onSelectSketch: async () => {
41
- const result = await ImagePicker.launchImageLibrary({ mediaType: 'photo' });
42
- if (result.assets && result.assets[0].uri) {
43
- const base64 = await convertToBase64(result.assets[0].uri);
44
- setSketch(base64);
45
- return base64;
46
- }
47
- return null;
48
- },
49
- onSaveResult: async (imageUrl) => {
50
- await saveToGallery(imageUrl);
51
- },
52
- });
53
-
54
- return (
55
- <View>
56
- <PhotoUploadCard
57
- image={sketch}
58
- onSelectImage={feature.selectSketch}
59
- title="Upload Your Sketch"
60
- />
61
-
62
- <OutputStyleSelector
63
- selectedStyle={feature.state.outputStyle}
64
- onSelectStyle={feature.setOutputStyle}
65
- />
66
-
67
- <PromptInput
68
- prompt={feature.state.prompt}
69
- onChangePrompt={feature.setPrompt}
70
- placeholder="Describe what you drew..."
71
- />
72
-
73
- <Button
74
- title="Convert to Image"
75
- onPress={feature.process}
76
- disabled={!feature.isReady || feature.state.isProcessing}
77
- />
78
-
79
- {feature.state.isProcessing && (
80
- <ActivityIndicator />
81
- )}
82
-
83
- {feature.state.result && (
84
- <ResultDisplay
85
- originalImage={sketch}
86
- resultImage={feature.state.result.imageUrl}
87
- onSave={() => feature.saveResult()}
88
- />
89
- )}
90
- </View>
91
- );
92
- }
93
- ```
21
+ ### When to Use This Feature
94
22
 
95
- ### Using the Unified AI Feature Screen
23
+ **Use Cases:**
24
+ - Creating concept art from sketches
25
+ - Turning doodles into illustrations
26
+ - Transforming storyboard sketches
27
+ - Converting design sketches to mockups
28
+ - Quick prototyping and ideation
96
29
 
97
- ```tsx
98
- import { AIFeatureScreen } from '@umituz/react-native-ai-generation-content';
30
+ ❌ **When NOT to Use:**
31
+ - Generating images from text only (use Text to Image)
32
+ - Applying artistic styles to photos (use Style Transfer)
33
+ - Image-to-image transformation (use Image to Image)
34
+ - Creating detailed artwork from scratch
99
35
 
100
- function App() {
101
- return (
102
- <AIFeatureScreen
103
- featureId="sketch-to-image"
104
- userId="user-123"
105
- />
106
- );
107
- }
108
- ```
36
+ ### Implementation Strategy
109
37
 
110
- ## Configuration Options
38
+ 1. **Select or draw sketch** to convert
39
+ 2. **Choose output style** (realistic, artistic, anime, 3D)
40
+ 3. **Add prompt** (optional) describing the sketch
41
+ 4. **Configure options** (add color, add details)
42
+ 5. **Generate image** with progress tracking
43
+ 6. **Preview result** and offer regeneration
44
+ 7. **Save or share** final image
111
45
 
112
- ### Feature Config
46
+ ---
47
+
48
+ ## ⚠️ Critical Rules (MUST FOLLOW)
49
+
50
+ ### 1. Sketch Requirements
51
+ - **MUST** provide ONE sketch image
52
+ - **MUST** use clear, readable sketches
53
+ - **MUST** have visible line work
54
+ - **MUST NOT** exceed file size limits (10MB max)
55
+ - **MUST** be in a common image format
56
+
57
+ ### 2. Configuration
58
+ - **MUST** provide valid `userId` for tracking
59
+ - **MUST** specify `outputStyle` (realistic, artistic, anime, 3D)
60
+ - **MUST** implement `onError` callback
61
+ - **MUST** implement `onSelectSketch` callback
62
+ - **MUST** provide optional prompt input
63
+
64
+ ### 3. State Management
65
+ - **MUST** check `isReady` before enabling generate button
66
+ - **MUST** display progress during generation
67
+ - **MUST** handle long processing times
68
+ - **MUST** display `error` state with clear messages
69
+ - **MUST** implement proper cleanup on unmount
70
+
71
+ ### 4. Performance
72
+ - **MUST** implement image compression before upload
73
+ - **MUST** show progress indicator for processing
74
+ - **MUST** cache results locally
75
+ - **MUST** allow users to cancel processing
76
+ - **MUST NOT** generate multiple images simultaneously
77
+
78
+ ### 5. Content Quality
79
+ - **MUST** provide sketch-to-result comparison
80
+ - **MUST** allow style adjustment
81
+ - **MUST** handle various sketch types
82
+ - **MUST** support descriptive prompts
83
+ - **MUST** offer regeneration with different settings
84
+
85
+ ---
86
+
87
+ ## 🚫 Prohibitions (MUST AVOID)
88
+
89
+ ### Strictly Forbidden
90
+
91
+ ❌ **NEVER** do the following:
92
+
93
+ 1. **No Missing Sketches**
94
+ - Always validate sketch is selected
95
+ - Never call process() without sketch
96
+
97
+ 2. **No Auto-Processing**
98
+ - Never start conversion without user action
99
+ - Always require explicit "Convert" button press
100
+ - Show preview before processing
101
+
102
+ 3. **No Hardcoded Credentials**
103
+ - Never store API keys in component files
104
+ - Use environment variables or secure storage
105
+
106
+ 4. **No Unhandled Errors**
107
+ - Never ignore conversion failures
108
+ - Always explain what went wrong
109
+ - Provide retry or alternative options
110
+
111
+ 5. **No Memory Leaks**
112
+ - Never store both sketch and result simultaneously
113
+ - Clean up temporary images
114
+ - Implement proper image disposal
115
+
116
+ 6. **No Blocked UI**
117
+ - Never block main thread with image processing
118
+ - Always show progress indicator
119
+ - Allow cancellation
120
+
121
+ 7. **No Poor Sketch Quality**
122
+ - Never use unreadable or extremely messy sketches
123
+ - Always provide guidance on sketch quality
124
+ - Show examples of good sketches
125
+
126
+ ---
127
+
128
+ ## 🤖 AI Agent Directions
129
+
130
+ ### For AI Code Generation Tools
131
+
132
+ When using this feature with AI code generation tools, follow these guidelines:
133
+
134
+ #### Prompt Template for AI Agents
113
135
 
114
- ```tsx
115
- interface SketchToImageFeatureConfig {
116
- outputStyle?: 'realistic' | 'artistic' | 'anime' | '3d';
117
- prompt?: string; // Description of the sketch
118
- onProcessingStart?: () => void;
119
- onProcessingComplete?: (result: SketchToImageResult) => void;
120
- onError?: (error: string) => void;
121
- }
122
136
  ```
137
+ You are implementing a sketch to image feature using @umituz/react-native-ai-generation-content.
138
+
139
+ REQUIREMENTS:
140
+ 1. Import from: @umituz/react-native-ai-generation-content
141
+ 2. Use the useSketchToImageFeature hook
142
+ 3. Select output style (realistic, artistic, anime, 3d)
143
+ 4. Implement sketch selection/upload UI
144
+ 5. Add optional prompt input for description
145
+ 6. Configure options (addColor, addDetails)
146
+ 7. Validate sketch before conversion
147
+ 8. Show sketch-to-result comparison
148
+ 9. Handle long processing times with progress
149
+ 10. Implement proper error handling
150
+ 11. Implement cleanup on unmount
151
+
152
+ CRITICAL RULES:
153
+ - MUST validate sketch before calling convert()
154
+ - MUST show sketch-to-result comparison
155
+ - MUST handle output style selection
156
+ - MUST handle prompt input
157
+ - MUST implement debouncing (300ms)
158
+ - MUST allow regeneration with different settings
159
+
160
+ CONFIGURATION:
161
+ - Provide valid userId (string)
162
+ - Set outputStyle: 'realistic' | 'artistic' | 'anime' | '3d'
163
+ - Set prompt: string (optional description)
164
+ - Set addColor: boolean (add color to sketch)
165
+ - Set addDetails: boolean (enhance with details)
166
+ - Implement onSelectSketch callback
167
+ - Implement onSaveResult callback
168
+ - Configure callbacks: onProcessingStart, onProcessingComplete, onError
169
+
170
+ OUTPUT STYLES:
171
+ - realistic: Photorealistic output
172
+ - artistic: Artistic interpretation
173
+ - anime: Anime/manga style
174
+ - 3d: 3D rendered look
175
+
176
+ OPTIONS:
177
+ - addColor: Add color to sketch (default: true)
178
+ - addDetails: Enhance with details (default: true)
179
+ - prompt: Optional description of sketch content
180
+
181
+ STRICTLY FORBIDDEN:
182
+ - No missing sketch validation
183
+ - No auto-processing without user action
184
+ - No hardcoded API keys
185
+ - No unhandled errors
186
+ - No memory leaks
187
+ - No blocking UI
188
+ - No poor sketch quality acceptance
189
+
190
+ QUALITY CHECKLIST:
191
+ - [ ] Sketch selection/upload implemented
192
+ - [ ] Output style selector added
193
+ - [ ] Prompt input included
194
+ - [ ] Validation before convert()
195
+ - [ ] Sketch-to-result comparison view
196
+ - [ ] Progress indicator during processing
197
+ - [ ] Error display with retry option
198
+ - [ ] Download/share functionality
199
+ - [ ] Regeneration with different styles
200
+ ```
201
+
202
+ #### AI Implementation Checklist
203
+
204
+ Use this checklist when generating code:
205
+
206
+ - [ ] Feature imported from correct path
207
+ - [ ] Sketch selection implemented
208
+ - [ ] Output style selector added
209
+ - [ ] Prompt input implemented
210
+ - [ ] Validation before convert()
211
+ - [ ] Sketch-to-result comparison view
212
+ - [ ] Progress indicator during processing
213
+ - [ ] Error display with user-friendly message
214
+ - [ ] Download/share buttons
215
+ - [ ] Regeneration option
216
+ - [ ] Cleanup on unmount
217
+ - [ ] Original sketch preserved
218
+
219
+ ---
123
220
 
124
- ### Generation Options
221
+ ## 🛠️ Configuration Strategy
125
222
 
126
- ```tsx
127
- interface SketchToImageOptions {
128
- sketch: string; // Base64 sketch image
129
- outputStyle: 'realistic' | 'artistic' | 'anime' | '3d';
130
- prompt?: string; // Optional description
131
- addColor?: boolean; // Add color to sketch (default: true)
132
- addDetails?: boolean; // Enhance with details (default: true)
223
+ ### Essential Configuration
224
+
225
+ ```typescript
226
+ // Required fields
227
+ {
228
+ userId: string
229
+ outputStyle: 'realistic' | 'artistic' | 'anime' | '3d'
230
+ onSelectSketch: () => Promise<string | null>
231
+ }
232
+
233
+ // Optional callbacks
234
+ {
235
+ onProcessingStart?: () => void
236
+ onProcessingComplete?: (result) => void
237
+ onError?: (error: string) => void
133
238
  }
134
239
  ```
135
240
 
136
- ## Output Styles
241
+ ### Recommended Settings
137
242
 
138
- ### Realistic
243
+ 1. **Output Styles**
244
+ - Realistic: Photorealistic output (recommended for concept art)
245
+ - Artistic: Artistic interpretation (creative projects)
246
+ - Anime: Anime/manga style (illustrations)
247
+ - 3D: 3D rendered look (product mockups)
139
248
 
140
- Photorealistic output:
249
+ 2. **Options**
250
+ - addColor: Add color to sketch (default: true)
251
+ - addDetails: Enhance with AI-generated details (default: true)
141
252
 
142
- ```tsx
143
- const result = await feature.process({
144
- outputStyle: 'realistic',
145
- addColor: true,
146
- addDetails: true,
147
- });
148
- ```
253
+ 3. **Sketch Quality**
254
+ - Clear, readable line work
255
+ - Visible shapes and forms
256
+ - Good contrast
257
+ - Max size: 10MB
149
258
 
150
- ### Artistic
259
+ ---
151
260
 
152
- Artistic interpretation:
261
+ ## 📊 State Management
153
262
 
154
- ```tsx
155
- const result = await feature.process({
156
- outputStyle: 'artistic',
157
- });
158
- ```
263
+ ### Feature States
159
264
 
160
- ### Anime
265
+ **isReady**: boolean
266
+ - Sketch selected and validated
267
+ - Check before enabling generate button
161
268
 
162
- Anime/manga style:
269
+ **isProcessing**: boolean
270
+ - Conversion in progress
271
+ - Show loading/progress indicator
272
+ - Disable generate button
163
273
 
164
- ```tsx
165
- const result = await feature.process({
166
- outputStyle: 'anime',
167
- });
168
- ```
274
+ **progress**: number (0-100)
275
+ - Conversion progress percentage
276
+ - Update progress bar
277
+
278
+ **error**: string | null
279
+ - Error message if conversion failed
280
+ - Display to user with clear message
169
281
 
170
- ### 3D Render
282
+ **result**: {
283
+ imageUrl: string
284
+ sketchImageUrl?: string
285
+ outputStyle?: string
286
+ prompt?: string
287
+ metadata?: any
288
+ }
171
289
 
172
- 3D rendered look:
290
+ ---
173
291
 
174
- ```tsx
175
- const result = await feature.process({
176
- outputStyle: '3d',
177
- });
178
- ```
292
+ ## 🎨 Best Practices
179
293
 
180
- ## Usage Flow
294
+ ### Sketch Creation
181
295
 
182
- 1. Select **Sketch** - Upload or draw a sketch
183
- 2. Choose **Output Style** - Select the desired output style
184
- 3. Add **Prompt** (optional) - Describe what you drew
185
- 4. Tap **Convert** - Start the conversion
186
- 5. View **Result** - See the generated image
187
- 6. Save or Share - Save or share the result
296
+ 1. **Sketch Quality**
297
+ - Good: Clear lines, readable shapes
298
+ - Bad: Extremely messy, unreadable
188
299
 
189
- ## Component Examples
300
+ 2. **Style Selection**
301
+ - Match style to use case
302
+ - Consider final application
303
+ - Test different styles
190
304
 
191
- ### Output Style Selector
305
+ 3. **Prompt Writing**
306
+ - Be descriptive about content
307
+ - Include important details
308
+ - Mention style preferences
192
309
 
193
- ```tsx
194
- import { StylePresetsGrid } from '@umituz/react-native-ai-generation-content';
310
+ ### User Experience
195
311
 
196
- const styles = [
197
- { id: 'realistic', name: 'Realistic', preview: '...' },
198
- { id: 'artistic', name: 'Artistic', preview: '...' },
199
- { id: 'anime', name: 'Anime', preview: '...' },
200
- { id: '3d', name: '3D Render', preview: '...' },
201
- ];
312
+ 1. **Sketch Upload**
313
+ - Support multiple upload methods
314
+ - Allow camera capture
315
+ - Provide sketch guidelines
202
316
 
203
- <StylePresetsGrid
204
- styles={styles}
205
- selectedStyle={selectedStyle}
206
- onSelectStyle={setSelectedStyle}
207
- />
208
- ```
317
+ 2. **Preview**
318
+ - Show sketch preview before conversion
319
+ - Compare different output styles
320
+ - Display prompt examples
209
321
 
210
- ### Prompt Input
322
+ ---
211
323
 
212
- ```tsx
213
- import { TextInput } from 'react-native';
324
+ ## 🐛 Common Pitfalls
214
325
 
215
- <TextInput
216
- placeholder="Describe what you drew..."
217
- value={prompt}
218
- onChangeText={setPrompt}
219
- multiline
220
- numberOfLines={3}
221
- />
222
- ```
326
+ ### Quality Issues
223
327
 
224
- ### Before/After Comparison
328
+ **Problem**: Poor conversion results
329
+ ✅ **Solution**: Use clearer sketch, try different style, add descriptive prompt
225
330
 
226
- ```tsx
227
- import { ResultDisplay } from '@umituz/react-native-ai-generation-content';
331
+ ### Style Issues
228
332
 
229
- {feature.state.result && sketch && (
230
- <ResultDisplay
231
- originalImage={sketch}
232
- resultImage={feature.state.result.imageUrl}
233
- onSave={() => feature.saveResult()}
234
- onShare={() => shareImage(feature.state.result.imageUrl)}
235
- />
236
- )}
237
- ```
333
+ **Problem**: Output doesn't match expectations
334
+ ✅ **Solution**: Try different output style, improve prompt
238
335
 
239
- ## Use Cases
336
+ ### Content Issues
240
337
 
241
- ### Concept Art
338
+ **Problem**: AI misinterprets sketch
339
+ ✅ **Solution**: Add descriptive prompt, use clearer sketch
242
340
 
243
- ```tsx
244
- // Convert rough sketches to detailed concept art
245
- const result = await feature.process({
246
- outputStyle: 'realistic',
247
- prompt: 'Futuristic cityscape',
248
- });
249
- ```
341
+ ---
250
342
 
251
- ### Illustration
343
+ ## 📦 Related Components
252
344
 
253
- ```tsx
254
- // Turn doodles into illustrations
255
- const result = await feature.process({
256
- outputStyle: 'artistic',
257
- });
258
- ```
345
+ Use these components from the library:
259
346
 
260
- ### Storyboarding
347
+ - **PhotoUploadCard**: Upload sketch interface
348
+ - **OutputStyleSelector**: Choose output style
349
+ - **PromptInput**: Enter sketch description
350
+ - **ResultDisplay**: Sketch-to-result comparison
351
+ - **ProgressBar**: Progress display
261
352
 
262
- ```tsx
263
- // Transform storyboard sketches
264
- const result = await feature.process({
265
- outputStyle: 'realistic',
266
- prompt: 'Action scene with characters',
267
- });
268
- ```
353
+ Located at: `src/presentation/components/`
269
354
 
270
- ### Design Mockups
355
+ ---
271
356
 
272
- ```tsx
273
- // Convert design sketches to realistic mockups
274
- const result = await feature.process({
275
- outputStyle: 'realistic',
276
- addDetails: true,
277
- });
278
- ```
357
+ ## 🔄 Migration Strategy
358
+
359
+ If migrating from previous implementation:
360
+
361
+ 1. **Update imports** to new path
362
+ 2. **Add output style selector**
363
+ 3. **Implement prompt input**
364
+ 4. **Update state handling** for new structure
365
+ 5. **Add sketch-to-result comparison**
366
+ 6. **Test all output styles**
367
+
368
+ ---
369
+
370
+ ## 📚 Additional Resources
371
+
372
+ - Main documentation: `/docs/`
373
+ - API reference: `/docs/api/`
374
+ - Examples: `/docs/examples/basic/sketch-to-image/`
375
+ - Architecture: `/ARCHITECTURE.md`
279
376
 
280
- ## Best Practices
377
+ ---
281
378
 
282
- 1. **Clear Sketches**: Use clear, readable sketches
283
- 2. **Descriptive Prompts**: Provide detailed descriptions
284
- 3. **Style Selection**: Match style to your use case
285
- 4. **Multiple Iterations**: Try different styles and prompts
286
- 5. **Sketch Quality**: Better sketches produce better results
379
+ **Last Updated**: 2025-01-08
380
+ **Version**: 2.0.0 (Strategy-based Documentation)
287
381
 
288
- ## Related Features
382
+ ---
289
383
 
290
- - [Text to Image](../text-to-image) - Generate images from text
291
- - [Image to Image](../image-to-image) - Transform images with AI
292
- - [Style Transfer](../style-transfer) - Apply artistic styles
384
+ ## 📝 Changelog
293
385
 
294
- ## License
386
+ ### v2.0.0 - 2025-01-08
387
+ - **BREAKING**: Documentation format changed to strategy-based
388
+ - Removed extensive code examples
389
+ - Added rules, prohibitions, and AI agent directions
390
+ - Focus on best practices and implementation guidance
295
391
 
296
- MIT
392
+ ### v1.0.0 - Initial Release
393
+ - Initial feature documentation