@umituz/react-native-ai-generation-content 1.20.5 → 1.20.6

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.
@@ -1,406 +0,0 @@
1
- # Inpainting Feature
2
-
3
- Fill in missing or hidden parts of images using AI.
4
-
5
- ## 📍 Import Path
6
-
7
- ```typescript
8
- import { useInpaintingFeature } from '@umituz/react-native-ai-generation-content';
9
- ```
10
-
11
- **Location**: `src/features/inpainting/`
12
-
13
- ## 🎯 Feature Purpose
14
-
15
- Intelligently fill in missing areas, remove unwanted objects, or extend image boundaries using AI-powered content-aware fill. Supports smart reconstruction, contextual filling, and pattern matching for natural-looking results.
16
-
17
- ---
18
-
19
- ## 📋 Usage Strategy
20
-
21
- ### When to Use This Feature
22
-
23
- ✅ **Use Cases:**
24
- - Removing unwanted objects from photos
25
- - Repairing damaged or torn areas
26
- - Extending image boundaries
27
- - Filling in missing parts of images
28
- - Cleaning up sensor dust or scratches
29
-
30
- ❌ **When NOT to Use:**
31
- - Simple background removal (use Remove Background)
32
- - General object removal without precise masking (use Remove Object)
33
- - Photo restoration (use Photo Restoration)
34
- - Adding new elements not present in image
35
-
36
- ### Implementation Strategy
37
-
38
- 1. **Select image** with missing or unwanted areas
39
- 2. **Create mask** by painting over areas to fill
40
- 3. **Choose fill method** (smart, contextual, pattern)
41
- 4. **Configure options** (edge blending, context preservation)
42
- 5. **Process inpainting** with progress tracking
43
- 6. **Preview and compare** with original
44
- 7. **Save or adjust** result
45
-
46
- ---
47
-
48
- ## ⚠️ Critical Rules (MUST FOLLOW)
49
-
50
- ### 1. Image Requirements
51
- - **MUST** provide ONE image to inpaint
52
- - **MUST** use high-quality images (min 512x512 recommended)
53
- - **MUST** have clear areas to fill
54
- - **MUST NOT** exceed file size limits (10MB max)
55
- - **MUST** create accurate mask for areas to fill
56
-
57
- ### 2. Mask Requirements
58
- - **MUST** provide valid mask image
59
- - **MUST** paint mask carefully over areas to fill
60
- - **MUST** ensure mask covers entire area to inpaint
61
- - **MUST** include mask creation interface
62
- - **MUST** validate mask before processing
63
-
64
- ### 3. Configuration
65
- - **MUST** provide valid `userId` for tracking
66
- - **MUST** specify `fillMethod` (smart, contextual, pattern)
67
- - **MUST** implement `onError` callback
68
- - **MUST** implement `onSelectImage` callback
69
- - **MUST** implement `onCreateMask` callback
70
-
71
- ### 4. State Management
72
- - **MUST** check `isReady` before enabling fill button
73
- - **MUST** verify both image and mask are provided
74
- - **MUST** display progress during inpainting
75
- - **MUST** display `error` state with clear messages
76
- - **MUST** implement proper cleanup on unmount
77
-
78
- ### 5. Performance
79
- - **MUST** implement image compression before upload
80
- - **MUST** show progress indicator for processing
81
- - **MUST** cache results locally
82
- - **MUST** allow users to cancel processing
83
- - **MUST NOT** inpaint multiple areas simultaneously
84
-
85
- ---
86
-
87
- ## 🚫 Prohibitions (MUST AVOID)
88
-
89
- ### Strictly Forbidden
90
-
91
- ❌ **NEVER** do the following:
92
-
93
- 1. **No Missing Mask**
94
- - Always validate mask is created
95
- - Never call process() without mask
96
-
97
- 2. **No Auto-Processing**
98
- - Never start inpainting without user action
99
- - Always require explicit "Fill" button press
100
- - Show mask 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 inpainting failures
108
- - Always explain what went wrong
109
- - Provide retry or alternative options
110
-
111
- 5. **No Memory Leaks**
112
- - Never store both original and result simultaneously
113
- - Clean up temporary mask images
114
- - Implement proper image disposal
115
-
116
- 6. **No Blocked UI**
117
- - Never block main thread with mask processing
118
- - Always show progress indicator
119
- - Allow cancellation
120
-
121
- 7. **No Imprecise Masking**
122
- - Never use rough or inaccurate masks
123
- - Always provide tools for precise mask creation
124
- - Allow mask adjustment before processing
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
135
-
136
- ```
137
- You are implementing an inpainting 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 useInpaintingFeature hook
142
- 3. Implement image selection UI
143
- 4. Implement mask creation UI with drawing tools
144
- 5. Select fill method (smart, contextual, pattern)
145
- 6. Configure options (preserveContext, blendEdges)
146
- 7. Validate both image and mask before processing
147
- 8. Show before/after 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 both image and mask before calling process()
154
- - MUST provide mask drawing/creation interface
155
- - MUST show before/after comparison
156
- - MUST handle fill method selection
157
- - MUST implement debouncing (300ms)
158
- - MUST allow multiple inpainting attempts
159
-
160
- CONFIGURATION:
161
- - Provide valid userId (string)
162
- - Set fillMethod: 'smart' | 'contextual' | 'pattern'
163
- - Set preserveContext: boolean (maintain surroundings)
164
- - Set blendEdges: boolean (seamless integration)
165
- - Implement onSelectImage callback
166
- - Implement onCreateMask callback
167
- - Implement onSaveResult callback
168
- - Configure callbacks: onProcessingStart, onProcessingComplete, onError
169
-
170
- FILL METHODS:
171
- - smart: AI-powered intelligent reconstruction
172
- - contextual: Fill based on surrounding content
173
- - pattern: Fill with detected patterns
174
-
175
- OPTIONS:
176
- - preserveContext: Maintain surrounding context (default: true)
177
- - blendEdges: Blend filled area with surroundings (default: true)
178
-
179
- STRICTLY FORBIDDEN:
180
- - No missing mask validation
181
- - No auto-processing without user action
182
- - No hardcoded API keys
183
- - No unhandled errors
184
- - No memory leaks
185
- - No blocking UI
186
- - No imprecise masking
187
-
188
- QUALITY CHECKLIST:
189
- - [ ] Image selection implemented
190
- - [ ] Mask creation/drawing interface added
191
- - [ ] Fill method selector included
192
- - [ ] Mask validation before processing
193
- - [ ] Before/after comparison view
194
- - [ ] Progress indicator during processing
195
- - [ ] Error display with retry option
196
- - [ ] Download/share functionality
197
- - [ ] Multiple inpainting attempts supported
198
- ```
199
-
200
- #### AI Implementation Checklist
201
-
202
- Use this checklist when generating code:
203
-
204
- - [ ] Feature imported from correct path
205
- - [ ] Image selection implemented
206
- - [ ] Mask drawing interface implemented
207
- - [ ] Fill method selector added
208
- - [ ] Validation before process() (image + mask)
209
- - [ ] Before/after comparison view
210
- - [ ] Progress indicator during processing
211
- - [ ] Error display with user-friendly message
212
- - [ ] Download/share buttons
213
- - [ ] Multiple inpainting attempts option
214
- - [ ] Cleanup on unmount
215
- - [ ] Original image preserved
216
-
217
- ---
218
-
219
- ## 🛠️ Configuration Strategy
220
-
221
- ### Essential Configuration
222
-
223
- ```typescript
224
- // Required fields
225
- {
226
- userId: string
227
- fillMethod: 'smart' | 'contextual' | 'pattern'
228
- onSelectImage: () => Promise<string | null>
229
- onCreateMask: () => Promise<string | null>
230
- }
231
-
232
- // Optional callbacks
233
- {
234
- onProcessingStart?: () => void
235
- onProcessingComplete?: (result) => void
236
- onError?: (error: string) => void
237
- }
238
- ```
239
-
240
- ### Recommended Settings
241
-
242
- 1. **Fill Methods**
243
- - Smart: AI-powered intelligent reconstruction (recommended for most cases)
244
- - Contextual: Fill based on surrounding content (good for consistent backgrounds)
245
- - Pattern: Fill with detected patterns (good for repeating elements)
246
-
247
- 2. **Options**
248
- - preserveContext: Maintain surrounding context (default: true)
249
- - blendEdges: Blend filled area seamlessly (default: true)
250
-
251
- 3. **Image Quality**
252
- - Minimum: 512x512 resolution
253
- - Recommended: 1024x1024 or higher
254
- - Format: JPEG or PNG
255
- - Max size: 10MB
256
-
257
- 4. **Mask Quality**
258
- - Precise masking around edges
259
- - Complete coverage of area to fill
260
- - Semi-transparent for preview
261
-
262
- ---
263
-
264
- ## 📊 State Management
265
-
266
- ### Feature States
267
-
268
- **isReady**: boolean
269
- - Image selected and mask created
270
- - Check before enabling fill button
271
-
272
- **isProcessing**: boolean
273
- - Inpainting in progress
274
- - Show loading/progress indicator
275
- - Disable fill button
276
-
277
- **progress**: number (0-100)
278
- - Inpainting progress percentage
279
- - Update progress bar
280
-
281
- **error**: string | null
282
- - Error message if inpainting failed
283
- - Display to user with clear message
284
-
285
- **result**: {
286
- imageUrl: string
287
- originalImageUrl?: string
288
- fillMethod?: string
289
- metadata?: any
290
- }
291
-
292
- ---
293
-
294
- ## 🎨 Best Practices
295
-
296
- ### Mask Creation
297
-
298
- 1. **Precision**
299
- - Good: Carefully painted edges around area
300
- - Bad: Rough, imprecise masking
301
-
302
- 2. **Coverage**
303
- - Ensure mask covers entire area to fill
304
- - Include some surrounding context
305
- - Avoid leaving gaps
306
-
307
- 3. **Fill Method Selection**
308
- - Use Smart Fill for most cases
309
- - Use Contextual for consistent backgrounds
310
- - Use Pattern for repeating elements
311
-
312
- ### User Experience
313
-
314
- 1. **Mask Drawing Tools**
315
- - Brush size adjustment
316
- - Eraser for corrections
317
- - Undo/redo support
318
- - Zoom for precision
319
-
320
- 2. **Preview**
321
- - Show mask overlay before processing
322
- - Allow mask adjustments
323
- - Preview fill method settings
324
-
325
- 3. **Before/After Comparison**
326
- - Side-by-side comparison
327
- - Slider for easy comparison
328
- - Zoom for detail inspection
329
-
330
- ---
331
-
332
- ## 🐛 Common Pitfalls
333
-
334
- ### Mask Issues
335
-
336
- ❌ **Problem**: Poor inpainting results
337
- ✅ **Solution**: Use precise mask, try different fill method
338
-
339
- ### Edge Issues
340
-
341
- ❌ **Problem**: Visible edges around filled area
342
- ✅ **Solution**: Enable blendEdges, improve mask precision
343
-
344
- ### Performance Issues
345
-
346
- ❌ **Problem**: Slow inpainting
347
- ✅ **Solution**: Compress images, show progress, allow cancellation
348
-
349
- ### Selection Issues
350
-
351
- ❌ **Problem**: Wrong fill method for content
352
- ✅ **Solution**: Try different fill method, adjust context preservation
353
-
354
- ---
355
-
356
- ## 📦 Related Components
357
-
358
- Use these components from the library:
359
-
360
- - **PhotoUploadCard**: Upload image interface
361
- - **MaskEditor**: Create mask with drawing tools
362
- - **FillMethodSelector**: Choose fill strategy
363
- - **ResultDisplay**: Before/after comparison
364
- - **ProgressBar**: Progress display
365
-
366
- Located at: `src/presentation/components/`
367
-
368
- ---
369
-
370
- ## 🔄 Migration Strategy
371
-
372
- If migrating from previous implementation:
373
-
374
- 1. **Update imports** to new path
375
- 2. **Add mask creation interface**
376
- 3. **Implement fill method selector**
377
- 4. **Update state handling** for new structure
378
- 5. **Add before/after comparison**
379
- 6. **Test all fill methods**
380
-
381
- ---
382
-
383
- ## 📚 Additional Resources
384
-
385
- - Main documentation: `/docs/`
386
- - API reference: `/docs/api/`
387
- - Examples: `/docs/examples/basic/inpainting/`
388
- - Architecture: `/ARCHITECTURE.md`
389
-
390
- ---
391
-
392
- **Last Updated**: 2025-01-08
393
- **Version**: 2.0.0 (Strategy-based Documentation)
394
-
395
- ---
396
-
397
- ## 📝 Changelog
398
-
399
- ### v2.0.0 - 2025-01-08
400
- - **BREAKING**: Documentation format changed to strategy-based
401
- - Removed extensive code examples
402
- - Added rules, prohibitions, and AI agent directions
403
- - Focus on best practices and implementation guidance
404
-
405
- ### v1.0.0 - Initial Release
406
- - Initial feature documentation
@@ -1,58 +0,0 @@
1
- /**
2
- * Inpainting Domain Entities
3
- */
4
-
5
- export interface InpaintingConfig {
6
- /**
7
- * Strength of the inpainting effect (0.0 to 1.0)
8
- * @default 0.75
9
- */
10
- strength?: number;
11
-
12
- /**
13
- * Guidance scale for prompt adherence
14
- * @default 7.5
15
- */
16
- guidanceScale?: number;
17
- }
18
-
19
- export interface InpaintingRequest {
20
- /**
21
- * The original image.
22
- * Can be a Base64 string or a remote URL.
23
- */
24
- image: string;
25
-
26
- /**
27
- * The mask image indicating areas to inpaint (white) vs keep (black).
28
- * Can be a Base64 string or a remote URL.
29
- */
30
- mask: string;
31
-
32
- /**
33
- * Description of what to fill in the masked area
34
- */
35
- prompt: string;
36
-
37
- /**
38
- * Negative prompt for what to avoid
39
- */
40
- negativePrompt?: string;
41
-
42
- /**
43
- * Optional configuration
44
- */
45
- options?: InpaintingConfig;
46
- }
47
-
48
- export interface InpaintingResult {
49
- /**
50
- * The resulting image with inpainting applied
51
- */
52
- imageUrl: string;
53
-
54
- /**
55
- * Metadata about the generation
56
- */
57
- metadata?: Record<string, unknown>;
58
- }
@@ -1 +0,0 @@
1
- export * from './domain/entities';