@imgly/plugin-ai-generation-web 0.2.3 → 0.2.5

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 CHANGED
@@ -2,11 +2,35 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.2.5] - 2025-09-03
6
+
7
+ ### New Features
8
+
9
+ - [image-generation] **NanoBanana Provider**: Added NanoBanana text-to-image provider via fal.ai with fast generation times, 1024×1024 resolution, support for multiple output formats (JPEG, PNG), configurable number of images (1-4), and remixPageWithPrompt quick action
10
+ - [image-generation] **NanoBananaEdit Provider**: Added NanoBananaEdit image-to-image provider via fal.ai for editing existing images with text prompts, supporting all standard quick actions (editImage, swapBackground, styleTransfer, artistTransfer, createVariant, combineImages with up to 10 images, remixPage, remixPageWithPrompt)
11
+
12
+ ### Bug Fixes
13
+
14
+ - [all] **fal.ai Provider Configuration**: Fixed singleton configuration conflict when using multiple fal.ai providers with different proxy URLs. Each provider now maintains its own client instance instead of overwriting a global configuration
15
+ - [video-generation] **Missing Dependency**: Added missing `@fal-ai/client` dependency to plugin-ai-video-generation-web package.json to ensure the package works correctly when installed independently
16
+
17
+ ## [0.2.4] - 2025-08-07
18
+
19
+ ### New Features
20
+
21
+ - [all] **Provider Label Translations**: Added support for provider label translations
22
+ - [all] **Extended Provider Configuration**: Added support for `history` and `supportedQuickActions` configuration fields in `CommonProviderConfiguration`, allowing customers to:
23
+ - Override provider's default history asset source (`history` field) - can be set to `false` to disable history, `'@imgly/local'` for temporary storage, `'@imgly/indexedDB'` for persistent browser storage, or any custom asset source ID
24
+ - Configure supported quick actions (`supportedQuickActions` field) - can disable quick actions by setting to `false`/`null`, keep defaults with `true`, or override with custom mappings and configurations
25
+ - Both fields are optional and maintain backward compatibility with existing provider configurations
26
+ - [generation-web] **Utility Function**: Added `mergeQuickActionsConfig` utility function for merging provider defaults with user configuration overrides, exported from `@imgly/plugin-ai-generation-web` with comprehensive Jest test coverage
27
+
5
28
  ## [0.2.3] - 2025-07-23
6
29
 
7
30
  - [all] **Automatic History Asset Library Entries**: Composite history asset sources now automatically have corresponding asset library entries created with the same IDs (e.g., `ly.img.ai.image-generation.history`)
8
31
  - [all] **Provider Selection in Expanded Quick Actions**: When a quick action is expanded, users can now switch between all providers that support that specific quick action, enhancing flexibility in provider selection
9
32
  - [all] **Quick Action Can Disable Lock**: Some quick actions can now decide to not lock the block when operating on a block. Examples are `CreateVariant` and `CombineImages`.
33
+ - [image-generation] **Ideogram V3**: Added support for Ideogram V3 provider for image generation, which supports text-to-image and image-to-image generation
10
34
 
11
35
  ## [0.2.2] - 2025-07-16
12
36
 
package/README.md CHANGED
@@ -202,9 +202,89 @@ interface CommonProviderConfiguration<I, O extends Output> {
202
202
 
203
203
  // Custom headers to include in all API requests
204
204
  headers?: Record<string, string>;
205
+
206
+ // Override provider's default history asset source
207
+ history?: false | '@imgly/local' | '@imgly/indexedDB' | (string & {});
208
+
209
+ // Configure supported quick actions
210
+ supportedQuickActions?: {
211
+ [quickActionId: string]: Partial<QuickActionSupport<I>> | false | null;
212
+ };
205
213
  }
206
214
  ```
207
215
 
216
+ ### Extended Configuration Options
217
+
218
+ #### History Configuration
219
+
220
+ The `history` field allows you to override the provider's default history storage behavior:
221
+
222
+ ```typescript
223
+ const provider = createMyImageProvider({
224
+ proxyUrl: 'https://proxy.example.com',
225
+
226
+ // Disable history storage entirely
227
+ history: false,
228
+
229
+ // Or use temporary local storage (not persistent)
230
+ // history: '@imgly/local',
231
+
232
+ // Or use persistent browser storage (default for most providers)
233
+ // history: '@imgly/indexedDB',
234
+
235
+ // Or use a custom asset source ID
236
+ // history: 'my-custom-asset-source'
237
+ });
238
+ ```
239
+
240
+ **Available Options:**
241
+ - `false`: Disable history storage entirely
242
+ - `'@imgly/local'`: Use temporary local storage (not persistent across sessions)
243
+ - `'@imgly/indexedDB'`: Use browser IndexedDB storage (persistent across sessions)
244
+ - `string`: Use your own custom asset source ID
245
+
246
+ #### Quick Actions Configuration
247
+
248
+ The `supportedQuickActions` field allows you to customize which quick actions are supported and how they behave:
249
+
250
+ ```typescript
251
+ const provider = createMyImageProvider({
252
+ proxyUrl: 'https://proxy.example.com',
253
+
254
+ // Configure quick actions
255
+ supportedQuickActions: {
256
+ // Remove an unwanted quick action
257
+ 'ly.img.editImage': false,
258
+
259
+ // Override with custom mapping
260
+ 'ly.img.swapBackground': {
261
+ mapInput: (input) => ({
262
+ prompt: input.prompt,
263
+ image_url: input.uri,
264
+ strength: 0.9, // Custom strength
265
+ style: 'REALISTIC' // Force realistic style
266
+ })
267
+ },
268
+
269
+ // Add support for new quick action
270
+ 'ly.img.customAction': {
271
+ mapInput: (input) => ({
272
+ prompt: `Custom prefix: ${input.text}`,
273
+ image_url: input.imageUrl
274
+ })
275
+ }
276
+ }
277
+ });
278
+ ```
279
+
280
+ **Configuration Values:**
281
+ - `false` or `null`: Remove the quick action entirely
282
+ - `true`: Keep the provider's default implementation
283
+ - Object with `mapInput`: Override the quick action with custom input mapping
284
+ - Object with other properties: Override with custom configuration
285
+
286
+ ### Headers Configuration
287
+
208
288
  The `headers` property allows you to include custom HTTP headers in all API requests made by your provider. This is useful for:
209
289
  - Adding custom client identification headers
210
290
  - Including version information
@@ -657,6 +737,95 @@ render: ({ builder, isExpanded, toggleExpand }) => {
657
737
  }
658
738
  ```
659
739
 
740
+ ## Customizing Labels and Text
741
+
742
+ You can customize all labels and text in the AI generation interface using the translation system. This allows you to provide better labels for your users in any language.
743
+
744
+ ### Translation Priority
745
+
746
+ The system checks for translations in this order (highest to lowest priority):
747
+
748
+ 1. **Provider & Kind-specific**: `ly.img.plugin-ai-${kind}-generation-web.${provider}.property.${field}` - Override labels for a specific AI provider and generation type
749
+ 2. **Generic**: `ly.img.plugin-ai-generation-web.property.${field}` - Override labels for all AI plugins
750
+
751
+ Where `${kind}` can be:
752
+ - `image` for image generation plugins
753
+ - `video` for video generation plugins
754
+ - `audio` for audio generation plugins
755
+ - `text` for text generation plugins
756
+
757
+ ### Basic Example
758
+
759
+ ```typescript
760
+ // Customize labels for your AI generation interface
761
+ cesdk.i18n.setTranslations({
762
+ en: {
763
+ // Generic labels (applies to ALL AI plugins)
764
+ 'ly.img.plugin-ai-generation-web.property.prompt': 'Describe what you want to create',
765
+ 'ly.img.plugin-ai-generation-web.property.image_size': 'Image Dimensions',
766
+ 'ly.img.plugin-ai-generation-web.property.duration': 'Video Length',
767
+
768
+ // Provider-specific for images (highest priority)
769
+ 'ly.img.plugin-ai-image-generation-web.fal-ai/recraft-v3.property.prompt': 'Describe your Recraft image',
770
+ 'ly.img.plugin-ai-image-generation-web.fal-ai/recraft-v3.property.image_size': 'Canvas Size',
771
+
772
+ // Provider-specific for videos (highest priority)
773
+ 'ly.img.plugin-ai-video-generation-web.fal-ai/veo3.property.prompt': 'Describe your video scene',
774
+ 'ly.img.plugin-ai-video-generation-web.fal-ai/veo3.property.duration': 'Video Duration'
775
+ }
776
+ });
777
+ ```
778
+
779
+ ### Dropdown Options
780
+
781
+ For dropdown menus, add the option value to the translation key:
782
+
783
+ ```typescript
784
+ cesdk.i18n.setTranslations({
785
+ en: {
786
+ // Image generation dropdown options
787
+ 'ly.img.plugin-ai-image-generation-web.fal-ai/recraft-v3.property.image_size.square_hd': 'Square HD (1024×1024)',
788
+ 'ly.img.plugin-ai-image-generation-web.fal-ai/recraft-v3.property.image_size.portrait_4_3': 'Portrait 4:3 (768×1024)',
789
+
790
+ // Video generation dropdown options
791
+ 'ly.img.plugin-ai-video-generation-web.fal-ai/veo3.property.duration.5': '5 seconds',
792
+ 'ly.img.plugin-ai-video-generation-web.fal-ai/veo3.property.duration.10': '10 seconds'
793
+ }
794
+ });
795
+ ```
796
+
797
+ ### QuickAction Translations
798
+
799
+ QuickActions use their own translation keys with provider-specific overrides:
800
+
801
+ ```typescript
802
+ cesdk.i18n.setTranslations({
803
+ en: {
804
+ // Provider-specific translations (highest priority)
805
+ 'ly.img.plugin-ai-image-generation-web.fal-ai/gemini-flash-edit.quickAction.editImage': 'Edit with Gemini',
806
+ 'ly.img.plugin-ai-text-generation-web.anthropic.quickAction.improve': 'Improve with Claude',
807
+
808
+ // Generic plugin translations
809
+ 'ly.img.plugin-ai-image-generation-web.quickAction.editImage': 'Edit Image...',
810
+ 'ly.img.plugin-ai-image-generation-web.quickAction.editImage.prompt': 'Edit Image...',
811
+ 'ly.img.plugin-ai-image-generation-web.quickAction.editImage.apply': 'Change',
812
+ 'ly.img.plugin-ai-text-generation-web.quickAction.improve': 'Improve Text',
813
+ 'ly.img.plugin-ai-text-generation-web.quickAction.translate': 'Translate Text',
814
+ 'ly.img.plugin-ai-video-generation-web.quickAction.createVideo': 'Create Video'
815
+ }
816
+ });
817
+ ```
818
+
819
+ **QuickAction Translation Priority:**
820
+ 1. Provider-specific: `ly.img.plugin-ai-${kind}-generation-web.${provider}.quickAction.${action}.${field}`
821
+ 2. Generic plugin: `ly.img.plugin-ai-${kind}-generation-web.quickAction.${action}.${field}`
822
+
823
+ **Translation Structure:**
824
+ - Base key (e.g., `.quickAction.editImage`): Button text when QuickAction is collapsed
825
+ - `.prompt`: Label for input field when expanded
826
+ - `.prompt.placeholder`: Placeholder text for input field
827
+ - `.apply`: Text for action/submit button
828
+
660
829
  ## Using Your Provider
661
830
 
662
831
  Once you've created your provider, you need to initialize it with CreativeEditor SDK and integrate it into the UI.
@@ -700,12 +869,12 @@ function setupMyProvider(cesdk) {
700
869
  When a provider is initialized, it automatically registers panels with specific IDs:
701
870
 
702
871
  ```
703
- ly.img.ai.{provider-id}
872
+ ly.img.plugin-ai-{kind}-generation-web.{provider-id}
704
873
  ```
705
874
 
706
875
  For example:
707
- - A provider with ID `my-image-provider` registers a panel with ID `ly.img.ai.my-image-provider`
708
- - A provider with ID `fal-ai/recraft-v3` registers a panel with ID `ly.img.ai.fal-ai/recraft-v3`
876
+ - A provider with ID `my-image-provider` for images registers a panel with ID `ly.img.plugin-ai-image-generation-web.my-image-provider`
877
+ - A provider with ID `fal-ai/recraft-v3` for images registers a panel with ID `ly.img.plugin-ai-image-generation-web.fal-ai/recraft-v3`
709
878
 
710
879
  You can programmatically get a panel ID using the `getPanelId` function:
711
880
 
@@ -724,14 +893,14 @@ cesdk.ui.openPanel(panelId);
724
893
  Quick actions are automatically registered in canvas menus with these IDs:
725
894
 
726
895
  ```
727
- ly.img.ai.{kind}.canvasMenu
896
+ ly.img.plugin-ai-{kind}-generation-web.canvasMenu
728
897
  ```
729
898
 
730
899
  For example:
731
- - Image quick actions: `ly.img.ai.image.canvasMenu`
732
- - Video quick actions: `ly.img.ai.video.canvasMenu`
733
- - Audio quick actions: `ly.img.ai.audio.canvasMenu`
734
- - Text quick actions: `ly.img.ai.text.canvasMenu`
900
+ - Image quick actions: `ly.img.plugin-ai-image-generation-web.canvasMenu`
901
+ - Video quick actions: `ly.img.plugin-ai-video-generation-web.canvasMenu`
902
+ - Audio quick actions: `ly.img.plugin-ai-audio-generation-web.canvasMenu`
903
+ - Text quick actions: `ly.img.plugin-ai-text-generation-web.canvasMenu`
735
904
 
736
905
  ### Using with Existing AI Generation Plugins
737
906
 
@@ -777,8 +946,8 @@ CreativeEditorSDK.create(domElement, {
777
946
 
778
947
  // Add quick action menus to canvas
779
948
  cesdk.ui.setCanvasMenuOrder([
780
- 'ly.img.ai.image.canvasMenu',
781
- 'ly.img.ai.video.canvasMenu',
949
+ 'ly.img.plugin-ai-image-generation-web.canvasMenu',
950
+ 'ly.img.plugin-ai-video-generation-web.canvasMenu',
782
951
  ...cesdk.ui.getCanvasMenuOrder()
783
952
  ]);
784
953
  });
@@ -904,7 +1073,7 @@ export { initializeProvider, initializeProviders } from './providers/';
904
1073
  export { loggingMiddleware, rateLimitMiddleware, uploadMiddleware } from './middleware/';
905
1074
 
906
1075
  // Utilities
907
- export { getPanelId, enableQuickActionForImageFill } from './utils/';
1076
+ export { getPanelId, enableQuickActionForImageFill, mergeQuickActionsConfig } from './utils/';
908
1077
  ```
909
1078
 
910
1079
  ### Initialization Functions
@@ -937,7 +1106,7 @@ const result = await initializeProviders(
937
1106
  ```
938
1107
 
939
1108
  **Key Points:**
940
- - Creates a composite history asset source with ID format: `ly.img.ai.{kind}-generation.history`
1109
+ - Creates a composite history asset source with ID format: `ly.img.plugin-ai-{kind}-generation-web.history`
941
1110
  - Automatically creates an asset library entry with the same ID as the asset source
942
1111
  - The library entry is configured with appropriate settings (sortBy: insertedAt descending, canRemove: true, etc.)
943
1112
  - Returns both the asset source ID and library entry ID for reference
@@ -951,6 +1120,10 @@ interface CommonProviderConfiguration<I, O extends Output> {
951
1120
  debug?: boolean;
952
1121
  middleware?: Middleware<I, O>[];
953
1122
  headers?: Record<string, string>;
1123
+ history?: false | '@imgly/local' | '@imgly/indexedDB' | (string & {});
1124
+ supportedQuickActions?: {
1125
+ [quickActionId: string]: Partial<QuickActionSupport<I>> | false | null;
1126
+ };
954
1127
  }
955
1128
 
956
1129
  // Quick action definition
@@ -963,3 +1136,7 @@ interface QuickActionDefinition<Q extends Record<string, any>> {
963
1136
  render: (context: QuickActionRenderContext<Q>) => void;
964
1137
  }
965
1138
  ```
1139
+
1140
+ ## Translations
1141
+
1142
+ For customization and localization, see the [translations.json](https://github.com/imgly/plugins/tree/main/packages/plugin-ai-generation-web/translations.json) file which contains base translation keys that can be overridden for all AI plugins.
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export { ProviderRegistry } from './core/ProviderRegistry';
14
14
  export { composeMiddlewares, type Middleware } from './middleware/middleware';
15
15
  export { default as loggingMiddleware } from './middleware/loggingMiddleware';
16
16
  export { default as uploadMiddleware } from './middleware/uploadMiddleware';
17
+ export { mergeQuickActionsConfig } from './utils/mergeQuickActionsConfig';
17
18
  export { default as rateLimitMiddleware, type RateLimitOptions } from './middleware/rateLimitMiddleware';
18
19
  export { getPanelId, getDurationForVideo, getThumbnailForVideo, getLabelFromId, isAsyncGenerator, addIconSetOnce } from './utils/utils';
19
20
  export { checkAiPluginVersion } from './utils/checkAiPluginVersion';
@@ -23,4 +24,5 @@ export { isGeneratingStateKey, abortGenerationStateKey } from './ui/components/r
23
24
  export { default as initializeProviders } from './providers/initializeProviders';
24
25
  export { default as initializeProvider } from './providers/initializeProvider';
25
26
  export { default as initializeQuickActionComponents } from './ui/quickActions/initializeQuickActionComponents';
27
+ export { extractAndSetSchemaTranslations } from './openapi/extractSchemaTranslations';
26
28
  export { AI_EDIT_MODE, AI_METADATA_KEY } from './ui/quickActions/utils';