@imgly/plugin-ai-generation-web 0.2.8 → 0.2.10
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/CHANGELOG.md +43 -0
- package/README.md +133 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/core/provider.d.ts +48 -0
- package/dist/generation/createGenerateFunction.d.ts +12 -1
- package/dist/generation/handleGenerationError.d.ts +2 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +3 -3
- package/dist/middleware/middleware.d.ts +1 -8
- package/dist/openapi/types.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.2.10] - 2025-10-22
|
|
6
|
+
|
|
7
|
+
### New Features
|
|
8
|
+
|
|
9
|
+
- [video-generation] **Google Veo 3.1 Provider Suite**: Added comprehensive Google Veo 3.1 video generation providers via fal.ai, offering multiple models optimized for different use cases:
|
|
10
|
+
- **Text-to-Video Providers**:
|
|
11
|
+
- `Veo31TextToVideo`: Standard quality text-to-video with configurable aspect ratios (16:9, 9:16, 1:1), variable duration (4s, 6s, 8s), resolution options (720p, 1080p), and optional audio generation
|
|
12
|
+
- `Veo31FastTextToVideo`: Faster and more cost-effective text-to-video variant with same capabilities as standard version
|
|
13
|
+
- **Image-to-Video Providers**:
|
|
14
|
+
- `Veo31ImageToVideo`: Standard quality image-to-video with auto aspect ratio detection, multiple preset options (16:9, 9:16, 1:1), resolution options (720p, 1080p), fixed 8-second duration, and optional audio generation
|
|
15
|
+
- `Veo31FastImageToVideo`: Faster and more cost-effective image-to-video variant with same capabilities
|
|
16
|
+
- **First-Last Frame Providers** (experimental dual-image transformation):
|
|
17
|
+
- `Veo31FirstLastFrameToVideo`: Standard quality interpolation between two images (first and last frame)
|
|
18
|
+
- `Veo31FastFirstLastFrameToVideo`: Faster variant with dual image input UI, multiple aspect ratios (16:9, 9:16, 1:1, 4:3, 3:4), resolution options (480p, 720p, 1080p), adjustable duration (2-8 seconds), optional prompt guidance, and optional audio generation
|
|
19
|
+
- **Quick Action Support**: Added "Animate Between Images" quick action for creating smooth transitions between two selected images using the first-last-frame providers
|
|
20
|
+
|
|
21
|
+
## [0.2.9] - 2025-10-16
|
|
22
|
+
|
|
23
|
+
### New Features
|
|
24
|
+
|
|
25
|
+
- [image-generation] **GeminiFlash25 Provider**: Added Google Gemini Flash 2.5 text-to-image provider via fal.ai with fast generation times, multiple aspect ratios (1:1, 3:4, 4:3, 9:16, 16:9), custom dimensions support, and multiple output formats (JPEG, PNG, WEBP)
|
|
26
|
+
- [image-generation] **Gemini25FlashImageEdit Provider**: Added Google Gemini 2.5 Flash Image Edit provider via fal.ai for advanced image editing with multi-image support (1-10 images), comprehensive quick actions support (editImage, swapBackground, styleTransfer, artistTransfer, createVariant, combineImages, remixPage, remixPageWithPrompt), text-based editing instructions, and fast processing times
|
|
27
|
+
|
|
28
|
+
### Improvements
|
|
29
|
+
|
|
30
|
+
- [generation-web] **Middleware preventDefault() API**: Added `options.preventDefault()` method to suppress default UI feedback (notifications, block states, console logging) when handling errors in custom middleware
|
|
31
|
+
- [all] **Internationalization Support**: All hardcoded strings across AI plugins have been removed and replaced with translation keys, enabling full localization support for plugin labels, actions, styles, and error messages
|
|
32
|
+
- [all] **Translation Keys Available**: Added comprehensive translation keys for:
|
|
33
|
+
- Panel and dock labels (AI Image, AI Video, AI Sticker, AI Voice, Sound Generation)
|
|
34
|
+
- Action labels (Generate Image, Generate Video, Generate Sticker)
|
|
35
|
+
- Style transfer options (None, Anime, Cyberpunk, Kodak 400, Watercolor, Dark Fantasy, Vaporwave, Vector Flat, 3D Animation, Ukiyo-e, Surreal, Steampunk, Night Bokeh, Pop Art)
|
|
36
|
+
- Error messages and UI elements
|
|
37
|
+
- [all] **Backwards Compatibility**: Translation system automatically detects CE.SDK version and gracefully falls back to English strings for CE.SDK versions < 1.59.0, ensuring no breaking changes for existing integrations
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- [generation-web] **Placeholder Block Error State**: Fixed placeholder blocks getting stuck in Pending state when generation fails or is aborted. Blocks are now properly destroyed when generation is aborted, or moved to Error state when generation fails, preventing perpetual loading spinners in the UI.
|
|
42
|
+
- [generation-web] **Middleware Block Targeting**: Fixed middleware to correctly receive block IDs for placeholder blocks and quick action targets. Previously, middleware would fall back to `findAllSelected()` which could target incorrect blocks if the selection changed during generation. Now placeholder blocks created during panel generation and target blocks from quick actions are explicitly passed to middleware, ensuring operations like pending state, locking, and highlighting affect the correct blocks.
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
|
|
46
|
+
- [generation-web] **BlockIds Type Refinement**: Removed unused `| null` type from `blockIds` parameter in `GenerationOptions` and `Generate` function signature. The `null` value was documented but never implemented or used. Use an empty array `[]` instead of `null` to explicitly target no blocks.
|
|
47
|
+
|
|
5
48
|
## [0.2.8] - 2025-09-29
|
|
6
49
|
|
|
7
50
|
### New Features
|
package/README.md
CHANGED
|
@@ -1208,9 +1208,9 @@ const upload = uploadMiddleware(async (output) => {
|
|
|
1208
1208
|
headers: { 'Content-Type': 'application/json' },
|
|
1209
1209
|
body: JSON.stringify(output)
|
|
1210
1210
|
});
|
|
1211
|
-
|
|
1211
|
+
|
|
1212
1212
|
const result = await response.json();
|
|
1213
|
-
|
|
1213
|
+
|
|
1214
1214
|
// Return the output with the updated URL
|
|
1215
1215
|
return {
|
|
1216
1216
|
...output,
|
|
@@ -1228,6 +1228,137 @@ const provider = {
|
|
|
1228
1228
|
};
|
|
1229
1229
|
```
|
|
1230
1230
|
|
|
1231
|
+
#### Preventing Default Feedback
|
|
1232
|
+
|
|
1233
|
+
Middleware can suppress default UI feedback behaviors (notifications, block states, console logging) using `options.preventDefault()`. This is useful when you want to handle success or error feedback yourself:
|
|
1234
|
+
|
|
1235
|
+
```typescript
|
|
1236
|
+
const customErrorMiddleware: Middleware<any, any> = async (input, options, next) => {
|
|
1237
|
+
try {
|
|
1238
|
+
return await next(input, options);
|
|
1239
|
+
} catch (error) {
|
|
1240
|
+
// Prevent default error notification and block error state
|
|
1241
|
+
options.preventDefault();
|
|
1242
|
+
|
|
1243
|
+
// When preventDefault() is called, you need to handle the block state yourself.
|
|
1244
|
+
// Here we set the error state to mimic the default behavior:
|
|
1245
|
+
options.blockIds?.forEach(blockId => {
|
|
1246
|
+
if (options.engine.block.isValid(blockId)) {
|
|
1247
|
+
options.engine.block.setState(blockId, { type: 'Error', error: 'Unknown' });
|
|
1248
|
+
}
|
|
1249
|
+
});
|
|
1250
|
+
// Alternative: Delete the placeholder block instead
|
|
1251
|
+
// options.blockIds?.forEach(blockId => {
|
|
1252
|
+
// if (options.engine.block.isValid(blockId)) {
|
|
1253
|
+
// options.engine.block.destroy(blockId);
|
|
1254
|
+
// }
|
|
1255
|
+
// });
|
|
1256
|
+
|
|
1257
|
+
// Show custom notification
|
|
1258
|
+
options.cesdk?.ui.showNotification({
|
|
1259
|
+
type: 'error',
|
|
1260
|
+
message: `Custom error: ${error.message}`,
|
|
1261
|
+
duration: 5000,
|
|
1262
|
+
action: {
|
|
1263
|
+
label: 'Contact Support',
|
|
1264
|
+
onClick: () => window.open('mailto:support@example.com')
|
|
1265
|
+
}
|
|
1266
|
+
});
|
|
1267
|
+
|
|
1268
|
+
throw error;
|
|
1269
|
+
}
|
|
1270
|
+
};
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
**What gets prevented:**
|
|
1274
|
+
- Error/success notifications (toast messages)
|
|
1275
|
+
- Block error state (error icon)
|
|
1276
|
+
- Console error logging
|
|
1277
|
+
|
|
1278
|
+
**What is NOT prevented:**
|
|
1279
|
+
- Pending → Ready transition (loading spinner always stops)
|
|
1280
|
+
|
|
1281
|
+
**Common use cases:**
|
|
1282
|
+
|
|
1283
|
+
**1. Custom Error Notifications:**
|
|
1284
|
+
```typescript
|
|
1285
|
+
const middleware = async (input, options, next) => {
|
|
1286
|
+
try {
|
|
1287
|
+
return await next(input, options);
|
|
1288
|
+
} catch (error) {
|
|
1289
|
+
options.preventDefault();
|
|
1290
|
+
|
|
1291
|
+
// When preventDefault() is called, you need to handle the block state yourself.
|
|
1292
|
+
// Here we set the error state to mimic the default behavior:
|
|
1293
|
+
options.blockIds?.forEach(blockId => {
|
|
1294
|
+
if (options.engine.block.isValid(blockId)) {
|
|
1295
|
+
options.engine.block.setState(blockId, { type: 'Error', error: 'Unknown' });
|
|
1296
|
+
}
|
|
1297
|
+
});
|
|
1298
|
+
|
|
1299
|
+
options.cesdk?.ui.showNotification({
|
|
1300
|
+
type: 'error',
|
|
1301
|
+
message: `Generation failed: ${error.message}`,
|
|
1302
|
+
action: { label: 'Retry', onClick: () => retry() }
|
|
1303
|
+
});
|
|
1304
|
+
throw error;
|
|
1305
|
+
}
|
|
1306
|
+
};
|
|
1307
|
+
```
|
|
1308
|
+
|
|
1309
|
+
**2. Silent Failures with External Logging:**
|
|
1310
|
+
```typescript
|
|
1311
|
+
const middleware = async (input, options, next) => {
|
|
1312
|
+
try {
|
|
1313
|
+
return await next(input, options);
|
|
1314
|
+
} catch (error) {
|
|
1315
|
+
options.preventDefault();
|
|
1316
|
+
errorTracker.capture({ error, context: { input, blockIds: options.blockIds } });
|
|
1317
|
+
throw error;
|
|
1318
|
+
}
|
|
1319
|
+
};
|
|
1320
|
+
```
|
|
1321
|
+
|
|
1322
|
+
**3. Retry Logic:**
|
|
1323
|
+
```typescript
|
|
1324
|
+
const retryMiddleware = async (input, options, next) => {
|
|
1325
|
+
const maxRetries = 3;
|
|
1326
|
+
let attempt = 0;
|
|
1327
|
+
|
|
1328
|
+
while (attempt < maxRetries) {
|
|
1329
|
+
try {
|
|
1330
|
+
return await next(input, options);
|
|
1331
|
+
} catch (error) {
|
|
1332
|
+
attempt++;
|
|
1333
|
+
if (attempt < maxRetries) {
|
|
1334
|
+
options.preventDefault();
|
|
1335
|
+
options.cesdk?.ui.showNotification({
|
|
1336
|
+
type: 'info',
|
|
1337
|
+
message: `Retrying... (${attempt}/${maxRetries})`
|
|
1338
|
+
});
|
|
1339
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
1340
|
+
} else {
|
|
1341
|
+
options.preventDefault();
|
|
1342
|
+
|
|
1343
|
+
// When preventDefault() is called, you need to handle the block state yourself.
|
|
1344
|
+
// After final retry failure, you might want to delete the placeholder:
|
|
1345
|
+
options.blockIds?.forEach(blockId => {
|
|
1346
|
+
if (options.engine.block.isValid(blockId)) {
|
|
1347
|
+
options.engine.block.destroy(blockId); // Remove failed placeholder
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
|
|
1351
|
+
options.cesdk?.ui.showNotification({
|
|
1352
|
+
type: 'error',
|
|
1353
|
+
message: `Failed after ${maxRetries} attempts`
|
|
1354
|
+
});
|
|
1355
|
+
throw error;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1360
|
+
```
|
|
1361
|
+
|
|
1231
1362
|
### Provider Registry
|
|
1232
1363
|
|
|
1233
1364
|
The `ProviderRegistry` is a global singleton that manages all registered providers:
|