@anu3ev/fabric-image-editor 0.1.76 → 0.1.78

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 (3) hide show
  1. package/dist/main.js +386 -349
  2. package/package.json +1 -1
  3. package/readme.md +52 -49
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anu3ev/fabric-image-editor",
3
- "version": "0.1.76",
3
+ "version": "0.1.78",
4
4
  "description": "JavaScript image editor built on FabricJS, allowing you to create instances with an integrated montage area and providing an API to modify and manage state.",
5
5
  "module": "dist/main.js",
6
6
  "files": [
package/readme.md CHANGED
@@ -25,7 +25,8 @@ A modern, powerful browser-based image editor built with [FabricJS](https://fabr
25
25
  - **Modular Architecture** - Clean separation of concerns with manager classes
26
26
  - **Event System** - Rich event handling for integration
27
27
  - **Responsive Design** - Adapts to different screen sizes and containers
28
- - **Comprehensive Testing** - Jest test suite with 85%+ coverage
28
+ - **Testing Infrastructure** - Jest test suite with 45%+ coverage
29
+ - **Web Worker Support** - Background processing for heavy operations
29
30
 
30
31
  ## 📦 Installation
31
32
 
@@ -76,10 +77,10 @@ await editor.imageManager.importImage({
76
77
  // Export the canvas
77
78
  const result = await editor.imageManager.exportCanvasAsImageFile({
78
79
  fileName: 'edited-image.png',
79
- contentType: 'image/png'
80
+ contentType: 'image/png' // Supports: 'image/png', 'image/jpeg', 'image/svg+xml', 'application/pdf'
80
81
  })
81
82
 
82
- // Handle the exported file
83
+ // Handle the exported file (result.image is File, Blob, or Base64 string)
83
84
  const url = URL.createObjectURL(result.image)
84
85
  // Use the URL for download or display
85
86
  ```
@@ -92,13 +93,24 @@ editor.backgroundManager.setColorBackground({ color: '#ff0000' })
92
93
 
93
94
  // Set a gradient background
94
95
  editor.backgroundManager.setGradientBackground({
95
- startColor: '#ff0000',
96
- endColor: '#0000ff',
97
- angle: 45
96
+ gradient: {
97
+ // 'linear' or 'radial'
98
+ type: 'linear',
99
+ angle: 45,
100
+ startColor: '#ff0000',
101
+ endColor: '#0000ff'
102
+ },
103
+ customData: {
104
+ customProperty: 'value'
105
+ },
106
+ withoutSave: false
98
107
  })
99
108
 
100
109
  // Set an image background
101
- await editor.backgroundManager.setImageBackground({ source: 'bg-image.jpg' })
110
+ await editor.backgroundManager.setImageBackground({ imageSource: 'bg-image.jpg' })
111
+
112
+ // Remove background
113
+ editor.backgroundManager.removeBackground()
102
114
  ```
103
115
 
104
116
  ## 🎮 Demo Application
@@ -130,8 +142,11 @@ The editor follows a modular architecture with specialized managers:
130
142
  - **`SelectionManager`** - Object selection and multi-selection handling
131
143
  - **`ClipboardManager`** - Copy/paste with system clipboard integration
132
144
  - **`GroupingManager`** - Object grouping and ungrouping operations
133
- - **`ShapeManager`** - Shape creation (rectangles, circles, etc.)
145
+ - **`DeletionManager`** - Object deletion with group handling
146
+ - **`ShapeManager`** - Shape creation (rectangles, circles, triangles)
147
+ - **`ObjectLockManager`** - Object locking and unlocking functionality
134
148
  - **`WorkerManager`** - Web Worker integration for heavy operations
149
+ - **`ModuleLoader`** - Dynamic module loading (jsPDF, etc.)
135
150
  - **`ErrorManager`** - Error handling and user notifications
136
151
 
137
152
  ### UI Components
@@ -183,38 +198,14 @@ initEditor(containerId, options): Promise<ImageEditor>
183
198
  // Import image from file or URL
184
199
  await editor.imageManager.importImage({
185
200
  source: File | string,
186
- scale?: 'image-contain' | 'image-cover' | 'scale-montage',
187
- withoutSave?: boolean
201
+ scale: 'image-contain' // or 'image-cover', 'scale-montage'
188
202
  })
189
203
 
190
204
  // Export canvas as image
191
205
  await editor.imageManager.exportCanvasAsImageFile({
192
- fileName?: string,
193
- contentType?: 'image/png' | 'image/jpeg' | 'image/svg+xml' | 'application/pdf',
194
- exportAsBase64?: boolean,
195
- exportAsBlob?: boolean
196
- })
197
- ```
198
-
199
- #### Background Management
200
- ```javascript
201
- // Color background
202
- editor.backgroundManager.setColorBackground({ color: '#ff0000' })
203
-
204
- // Gradient background
205
- editor.backgroundManager.setGradientBackground({
206
- startColor: '#ff0000',
207
- endColor: '#0000ff',
208
- angle: 45,
209
- startPosition?: 0,
210
- endPosition?: 100
206
+ fileName: 'export.png',
207
+ contentType: 'image/png' // 'image/png', 'image/jpeg', 'image/svg+xml', 'application/pdf'
211
208
  })
212
-
213
- // Image background
214
- await editor.backgroundManager.setImageBackground({ source: 'image.jpg' })
215
-
216
- // Remove background
217
- editor.backgroundManager.removeBackground()
218
209
  ```
219
210
 
220
211
  #### Canvas Control
@@ -234,25 +225,25 @@ editor.canvas.zoomToPoint(point, zoomLevel)
234
225
  ```javascript
235
226
  // Fit object to montage area
236
227
  editor.transformManager.fitObject({
237
- type: 'contain' | 'cover',
238
- fitAsOneObject?: boolean
228
+ type: 'contain',
229
+ fitAsOneObject: true
239
230
  })
240
231
 
241
232
  // Reset object transformations
242
233
  editor.transformManager.resetObject()
243
234
 
244
235
  // Flip operations
245
- editor.transformManager.flipObjectHorizontally()
246
- editor.transformManager.flipObjectVertically()
236
+ editor.transformManager.flipX()
237
+ editor.transformManager.flipY()
247
238
  ```
248
239
 
249
240
  #### Layer Management
250
241
  ```javascript
251
242
  // Layer operations
252
- editor.layerManager.sendObjectToBack(object)
253
- editor.layerManager.bringObjectToFront(object)
254
- editor.layerManager.moveLayerUp(object)
255
- editor.layerManager.moveLayerDown(object)
243
+ editor.layerManager.sendToBack(object)
244
+ editor.layerManager.bringToFront(object)
245
+ editor.layerManager.sendBackwards(object)
246
+ editor.layerManager.bringForward(object)
256
247
  ```
257
248
 
258
249
  #### History Control
@@ -279,10 +270,10 @@ npm run dev
279
270
  # Development build to dev-build folder
280
271
  npm run dev:build
281
272
 
282
- # Production build
273
+ # Production build (library to dist/)
283
274
  npm run build
284
275
 
285
- # Build documentation
276
+ # Build for GitHub Pages (demo to docs/)
286
277
  npm run build:docs
287
278
  ```
288
279
 
@@ -315,17 +306,27 @@ src/
315
306
  │ ├── background-manager/ # Background functionality
316
307
  │ ├── canvas-manager/ # Canvas operations
317
308
  │ ├── clipboard-manager/ # Copy/paste operations
309
+ │ ├── customized-controls/ # Custom FabricJS controls
310
+ │ ├── deletion-manager/ # Object deletion
318
311
  │ ├── error-manager/ # Error handling
312
+ │ ├── grouping-manager/ # Object grouping
319
313
  │ ├── history-manager/ # Undo/redo system
320
314
  │ ├── image-manager/ # Image import/export
315
+ │ ├── interaction-blocker/ # UI blocking during operations
321
316
  │ ├── layer-manager/ # Layer management
317
+ │ ├── module-loader/ # Dynamic module loading
318
+ │ ├── object-lock-manager/ # Object locking
319
+ │ ├── selection-manager/ # Selection handling
322
320
  │ ├── shape-manager/ # Shape creation
323
321
  │ ├── transform-manager/ # Object transformations
324
- │ ├── ui/ # UI components
322
+ │ ├── worker-manager/ # Web Worker management
323
+ │ ├── ui/ # UI components (toolbar)
325
324
  │ └── types/ # TypeScript definitions
326
325
  ├── demo/ # Demo application
327
326
  specs/ # Test specifications
328
- docs/ # Documentation build
327
+ docs/ # GitHub Pages build output
328
+ dev-build/ # Development build output
329
+ dist/ # Production library build
329
330
  vite.config.*.js # Vite configurations
330
331
  jest.config.ts # Jest test configuration
331
332
  ```
@@ -335,10 +336,10 @@ jest.config.ts # Jest test configuration
335
336
  The following features are planned for future releases:
336
337
 
337
338
  - **Drawing Mode** - Freehand drawing tools and brushes
338
- - **Text Support** - Text layers with formatting options
339
+ - **Text Support** - Text layers with formatting options (IText, Textbox)
339
340
  - **Snap/Alignment** - Snap to edges, centers, and guides
340
341
  - **Filters & Effects** - Image filters and visual effects
341
- - **Shape Library** - Extended shape collection
342
+ - **Extended Shape Library** - Additional shapes beyond current rectangles, circles, and triangles
342
343
  - **Multi-language** - Internationalization support
343
344
 
344
345
  ## 🤝 Contributing
@@ -383,5 +384,7 @@ MIT License - see [LICENSE](LICENSE) file for details.
383
384
  ---
384
385
 
385
386
  **Repository:** [github.com/Anu3ev/image-editor](https://github.com/Anu3ev/image-editor)
387
+
386
388
  **NPM Package:** [@anu3ev/fabric-image-editor](https://www.npmjs.com/package/@anu3ev/fabric-image-editor)
389
+
387
390
  **Live Demo:** [anu3ev.github.io/image-editor](https://anu3ev.github.io/image-editor/)