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

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,12 +2,40 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.2.7] - 2025-09-26
6
+
7
+ ### New Features
8
+
9
+ - [image-generation] **QwenImageEdit Provider**: Added Qwen image editing provider via fal.ai for advanced image-to-image transformation with text prompts, supporting all standard quick actions
10
+ - [video-generation] **MinimaxHailuo02StandardImageToVideo Provider**: Added Minimax Hailuo-02 Standard image-to-video provider via fal.ai for transforming still images into videos with selectable resolutions (512P: 912×512, 768P: 1280×720) and adjustable durations (6 or 10 seconds)
11
+ - [video-generation] **ByteDance Seedance v1 Pro Providers**: Added ByteDance Seedance v1 Pro text-to-video and image-to-video providers via fal.ai with:
12
+ - Text-to-video generation from text descriptions with customizable aspect ratios
13
+ - Image-to-video transformation with dynamic motion generation from still images
14
+ - Multiple aspect ratio options (21:9, 16:9, 4:3, 1:1, 3:4, 9:16, or auto from image for i2v)
15
+ - Adjustable duration (3-12 seconds, default 5)
16
+ - Resolution options (480p, 720p, 1080p)
17
+ - Proper aspect ratio handling in placeholder blocks based on user selection
18
+
19
+ - [all] **Property Configuration System**: Providers can now define default values for their properties. Defaults can be static values or dynamic based on context (language, design state, etc.)
20
+
21
+ - [image-generation] **Recraft Provider Defaults**: Recraft providers (V3 and 20b) now support configurable default values for all properties, including dynamic style defaults based on the selected style type
22
+
23
+ ## [0.2.6] - 2025-09-09
24
+
25
+ ### New Features
26
+
27
+ - [all] **Feature API Integration**: Added comprehensive Feature API support across all AI plugins to control visibility and availability of features through feature flags. Core features include `providerSelect`, `quickAction`, `quickAction.providerSelect`, `fromText`, and `fromImage` flags.
28
+ - [all] **Quick Action Feature Flags**: Each quick action now automatically registers and respects its own feature flag (e.g., `ly.img.plugin-ai-image-generation-web.quickAction.editImage`), allowing fine-grained control over which quick actions are available to users.
29
+ - [image-generation] **Provider Style Group Control**: Added Feature API support for Recraft providers to control style group visibility. RecraftV3 supports `style.image` and `style.vector` flags, while Recraft20b adds `style.icon` flag for controlling icon style availability.
30
+ - [all] **Provider Selection Feature Flags**: Added support for controlling provider selection UI in both panels (`providerSelect`) and quick actions (`quickAction.providerSelect`), with proper handling when multiple providers are configured.
31
+
5
32
  ## [0.2.5] - 2025-09-03
6
33
 
7
34
  ### New Features
8
35
 
9
36
  - [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
37
  - [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)
38
+ - [all] **AI Style Asset Library Translations**: AI style presets in asset libraries now automatically use localized names and descriptions from provider translation files, eliminating the need for manual translation configuration
11
39
 
12
40
  ### Bug Fixes
13
41
 
package/README.md CHANGED
@@ -210,6 +210,9 @@ interface CommonProviderConfiguration<I, O extends Output> {
210
210
  supportedQuickActions?: {
211
211
  [quickActionId: string]: Partial<QuickActionSupport<I>> | false | null;
212
212
  };
213
+
214
+ // Configure default property values
215
+ properties?: PropertiesConfiguration;
213
216
  }
214
217
  ```
215
218
 
@@ -283,6 +286,53 @@ const provider = createMyImageProvider({
283
286
  - Object with `mapInput`: Override the quick action with custom input mapping
284
287
  - Object with other properties: Override with custom configuration
285
288
 
289
+ #### Property Configuration
290
+
291
+ The `properties` field allows you to define default values for any provider property. These defaults can be static values or dynamic functions that receive context:
292
+
293
+ ```typescript
294
+ const provider = createMyImageProvider({
295
+ proxyUrl: 'https://proxy.example.com',
296
+
297
+ // Configure default property values
298
+ properties: {
299
+ // Static default value
300
+ image_size: 'square_hd',
301
+
302
+ // Dynamic default based on context
303
+ style: (context) => {
304
+ // Context includes: engine, cesdk, locale
305
+ const locale = context.locale;
306
+
307
+ // Return different defaults for different locales
308
+ if (locale === 'de') {
309
+ return 'realistic';
310
+ }
311
+ return 'digital_illustration';
312
+ },
313
+
314
+ // Dynamic default based on design state
315
+ resolution: (context) => {
316
+ const engine = context.engine;
317
+ const scene = engine.scene.get();
318
+ const width = engine.block.getFloat(scene, 'scene/frame/width');
319
+
320
+ // Choose resolution based on canvas size
321
+ if (width > 1920) {
322
+ return '1080p';
323
+ }
324
+ return '720p';
325
+ }
326
+ }
327
+ });
328
+ ```
329
+
330
+ **Property Configuration Features:**
331
+ - **Static Defaults**: Simple values that apply to all users
332
+ - **Dynamic Defaults**: Functions that return values based on context (engine state, locale, etc.)
333
+ - **Context Available**: `engine`, `cesdk`, `locale` for making informed decisions
334
+ - **Fallback Chain**: Properties use configured value → schema default → undefined
335
+
286
336
  ### Headers Configuration
287
337
 
288
338
  The `headers` property allows you to include custom HTTP headers in all API requests made by your provider. This is useful for:
@@ -902,6 +952,161 @@ For example:
902
952
  - Audio quick actions: `ly.img.plugin-ai-audio-generation-web.canvasMenu`
903
953
  - Text quick actions: `ly.img.plugin-ai-text-generation-web.canvasMenu`
904
954
 
955
+ ### Customizing Quick Action Availability
956
+
957
+ You can control which quick actions appear in your application using the Feature API. This is useful when you want to:
958
+ - Show only specific AI capabilities to certain user groups
959
+ - Simplify the UI by hiding advanced features
960
+ - Create different feature sets for different subscription tiers
961
+ - Disable actions that aren't relevant to your use case
962
+
963
+ #### Disabling Specific Quick Actions
964
+
965
+ All quick actions are enabled by default. To hide specific quick actions from the UI:
966
+
967
+ ```typescript
968
+ // Hide the "Edit Image" quick action from users
969
+ cesdk.feature.enable(
970
+ 'ly.img.plugin-ai-image-generation-web.quickAction.editImage',
971
+ false
972
+ );
973
+
974
+ // Hide multiple text quick actions for a simpler experience
975
+ cesdk.feature.enable('ly.img.plugin-ai-text-generation-web.quickAction.changeTone', false);
976
+ cesdk.feature.enable('ly.img.plugin-ai-text-generation-web.quickAction.translate', false);
977
+ ```
978
+
979
+ #### Dynamic Feature Control
980
+
981
+ You can also pass a function to dynamically control feature availability based on context. This is powerful for implementing complex business logic, time-based features, or context-sensitive UI. See the [CE.SDK Feature API documentation](https://img.ly/docs/cesdk/js/user-interface/customization/disable-or-enable-f058e2/) for more details.
982
+
983
+ ```typescript
984
+ // Show advanced AI features only during business hours
985
+ cesdk.feature.enable(
986
+ 'ly.img.plugin-ai-image-generation-web.quickAction.artistTransfer',
987
+ ({ isPreviousEnable }) => {
988
+ const hour = new Date().getHours();
989
+ const isBusinessHours = hour >= 9 && hour < 18;
990
+ return isBusinessHours && isPreviousEnable();
991
+ }
992
+ );
993
+
994
+ // Disable certain quick actions based on selected content
995
+ cesdk.feature.enable(
996
+ 'ly.img.plugin-ai-text-generation-web.quickAction.translate',
997
+ ({ engine, isPreviousEnable }) => {
998
+ const selectedBlocks = engine.block.findAllSelected();
999
+ if (selectedBlocks.length === 0) return false;
1000
+
1001
+ const blockId = selectedBlocks[0];
1002
+ const textContent = engine.block.getString(blockId, 'text/text');
1003
+
1004
+ // Only show translate if text is long enough
1005
+ const hasEnoughText = textContent && textContent.length > 20;
1006
+ return hasEnoughText && isPreviousEnable();
1007
+ }
1008
+ );
1009
+ ```
1010
+
1011
+ #### Creating Feature Sets for Different User Tiers
1012
+
1013
+ ```typescript
1014
+ // Configure features based on user subscription
1015
+ function configureAIFeatures(cesdk, userTier) {
1016
+ if (userTier === 'basic') {
1017
+ // Basic users only get simple text improvements
1018
+ cesdk.feature.enable('ly.img.plugin-ai-text-generation-web.quickAction.improve', true);
1019
+ cesdk.feature.enable('ly.img.plugin-ai-text-generation-web.quickAction.fix', true);
1020
+ cesdk.feature.enable('ly.img.plugin-ai-text-generation-web.quickAction.translate', false);
1021
+ cesdk.feature.enable('ly.img.plugin-ai-text-generation-web.quickAction.changeTone', false);
1022
+
1023
+ // Disable advanced image features
1024
+ cesdk.feature.enable('ly.img.plugin-ai-image-generation-web.quickAction.artistTransfer', false);
1025
+ cesdk.feature.enable('ly.img.plugin-ai-image-generation-web.quickAction.styleTransfer', false);
1026
+ } else if (userTier === 'premium') {
1027
+ // Premium users get all features (default behavior)
1028
+ // All quick actions are enabled by default
1029
+ }
1030
+ }
1031
+ ```
1032
+
1033
+ #### Available Feature Flags
1034
+
1035
+ ##### Core Plugin Features
1036
+
1037
+ These feature flags control the main functionality of each AI plugin:
1038
+
1039
+ **General Features:**
1040
+ - `ly.img.plugin-ai-{kind}-generation-web.providerSelect` - Enable/disable provider selection dropdown in panels
1041
+ - `ly.img.plugin-ai-{kind}-generation-web.quickAction` - Enable/disable all quick actions for a plugin
1042
+ - `ly.img.plugin-ai-{kind}-generation-web.quickAction.providerSelect` - Enable/disable provider selection dropdown in quick actions
1043
+
1044
+ **Input Type Features (Image & Video only):**
1045
+ - `ly.img.plugin-ai-image-generation-web.fromText` - Enable/disable text-to-image generation
1046
+ - `ly.img.plugin-ai-image-generation-web.fromImage` - Enable/disable image-to-image generation
1047
+ - `ly.img.plugin-ai-video-generation-web.fromText` - Enable/disable text-to-video generation
1048
+ - `ly.img.plugin-ai-video-generation-web.fromImage` - Enable/disable image-to-video generation
1049
+
1050
+ **Usage Examples:**
1051
+
1052
+ ```typescript
1053
+ // Hide provider selection dropdown in video generation panel
1054
+ cesdk.feature.enable('ly.img.plugin-ai-video-generation-web.providerSelect', false);
1055
+
1056
+ // Only allow text-to-image, disable image-to-image editing
1057
+ cesdk.feature.enable('ly.img.plugin-ai-image-generation-web.fromImage', false);
1058
+ cesdk.feature.enable('ly.img.plugin-ai-image-generation-web.fromText', true);
1059
+
1060
+ // Hide provider selection dropdown in quick actions (use default provider only)
1061
+ cesdk.feature.enable('ly.img.plugin-ai-image-generation-web.quickAction.providerSelect', false);
1062
+
1063
+ // Disable all quick actions but keep panel generation available
1064
+ cesdk.feature.enable('ly.img.plugin-ai-image-generation-web.quickAction', false);
1065
+ ```
1066
+
1067
+ ##### Quick Action Features
1068
+
1069
+ The quick action feature flags follow this pattern: `ly.img.plugin-ai-{kind}-generation-web.quickAction.{actionName}`
1070
+
1071
+ **Image Quick Actions:**
1072
+ - `ly.img.plugin-ai-image-generation-web.quickAction.editImage`
1073
+ - `ly.img.plugin-ai-image-generation-web.quickAction.swapBackground`
1074
+ - `ly.img.plugin-ai-image-generation-web.quickAction.styleTransfer`
1075
+ - `ly.img.plugin-ai-image-generation-web.quickAction.artistTransfer`
1076
+ - `ly.img.plugin-ai-image-generation-web.quickAction.createVariant`
1077
+ - `ly.img.plugin-ai-image-generation-web.quickAction.combineImages`
1078
+ - `ly.img.plugin-ai-image-generation-web.quickAction.remixPage`
1079
+ - `ly.img.plugin-ai-image-generation-web.quickAction.remixPageWithPrompt`
1080
+
1081
+ **Text Quick Actions:**
1082
+ - `ly.img.plugin-ai-text-generation-web.quickAction.improve`
1083
+ - `ly.img.plugin-ai-text-generation-web.quickAction.fix`
1084
+ - `ly.img.plugin-ai-text-generation-web.quickAction.shorter`
1085
+ - `ly.img.plugin-ai-text-generation-web.quickAction.longer`
1086
+ - `ly.img.plugin-ai-text-generation-web.quickAction.changeTone`
1087
+ - `ly.img.plugin-ai-text-generation-web.quickAction.translate`
1088
+ - `ly.img.plugin-ai-text-generation-web.quickAction.changeTextTo`
1089
+
1090
+ **Video Quick Actions:**
1091
+ - `ly.img.plugin-ai-video-generation-web.quickAction.createVideo`
1092
+
1093
+ **Note:** Quick actions are automatically enabled when their plugin is loaded. Each quick action manages its own feature flag internally, ensuring proper initialization and registration.
1094
+
1095
+ ##### Provider-Specific Style Features
1096
+
1097
+ Some providers (like RecraftV3 and Recraft20b) support style groups that can be controlled independently:
1098
+
1099
+ **RecraftV3 Style Groups:**
1100
+ - `ly.img.plugin-ai-image-generation-web.fal-ai/recraft-v3.style.image` - Enable/disable image styles (realistic, digital illustration)
1101
+ - `ly.img.plugin-ai-image-generation-web.fal-ai/recraft-v3.style.vector` - Enable/disable vector styles (vector illustration and variants)
1102
+
1103
+ **Recraft20b Style Groups:**
1104
+ - `ly.img.plugin-ai-image-generation-web.fal-ai/recraft/v2/text-to-image.style.image` - Enable/disable image styles
1105
+ - `ly.img.plugin-ai-image-generation-web.fal-ai/recraft/v2/text-to-image.style.vector` - Enable/disable vector styles
1106
+ - `ly.img.plugin-ai-image-generation-web.fal-ai/recraft/v2/text-to-image.style.icon` - Enable/disable icon styles
1107
+
1108
+ When all style groups are disabled for a provider, it automatically falls back to the 'any' style. For more details on style control, see the [@imgly/plugin-ai-image-generation-web documentation](https://github.com/imgly/plugins/tree/main/packages/plugin-ai-image-generation-web).
1109
+
905
1110
  ### Using with Existing AI Generation Plugins
906
1111
 
907
1112
  IMG.LY offers several pre-built AI generation packages that work with this base plugin:
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,58 @@
1
+ import type { CreativeEngine } from '@cesdk/cesdk-js';
2
+ import type CreativeEditorSDK from '@cesdk/cesdk-js';
3
+ /**
4
+ * Base context provided to all property default functions
5
+ */
6
+ export interface PropertyContext {
7
+ /**
8
+ * Creative Engine instance
9
+ * Always available for engine-level operations
10
+ */
11
+ engine: CreativeEngine;
12
+ /**
13
+ * Creative Editor SDK instance
14
+ * May be undefined if running headless or without UI
15
+ */
16
+ cesdk?: CreativeEditorSDK;
17
+ /**
18
+ * Current locale for internationalization
19
+ * Format: ISO 639-1 language code (e.g., 'en', 'de', 'ja')
20
+ * Defaults to 'en' if not available
21
+ */
22
+ locale: string;
23
+ }
24
+ /**
25
+ * Configuration for a single property
26
+ * @template T - The type of the property value
27
+ * @template C - The context type (defaults to PropertyContext)
28
+ */
29
+ export interface PropertyConfig<T, C extends PropertyContext = PropertyContext> {
30
+ /**
31
+ * Default value for the property
32
+ * Can be a static value or a function that returns the value
33
+ */
34
+ default?: T | ((context: C) => T);
35
+ }
36
+ /**
37
+ * Properties configuration for a provider
38
+ * @template I - The input type of the provider
39
+ */
40
+ export type PropertiesConfiguration<I> = {
41
+ [K in keyof Partial<I>]?: PropertyConfig<I[K]>;
42
+ };
43
+ /**
44
+ * Utility type for extending property contexts selectively
45
+ * @template I - The input type of the provider
46
+ * @template ContextMap - Map of property names to their extended context types
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * type MyConfig = ExtendPropertyContexts<MyInput, {
51
+ * style: StyleContext; // style property gets StyleContext
52
+ * // other properties get PropertyContext
53
+ * }>;
54
+ * ```
55
+ */
56
+ export type ExtendPropertyContexts<I, ContextMap extends Partial<Record<keyof I, PropertyContext>>> = {
57
+ [K in keyof Partial<I>]: K extends keyof ContextMap ? ContextMap[K] extends PropertyContext ? PropertyConfig<I[K], ContextMap[K]> : PropertyConfig<I[K]> : PropertyConfig<I[K]>;
58
+ };
@@ -18,6 +18,11 @@ interface Provider<K extends OutputKind, I, O extends Output, C = O> {
18
18
  * The human-readable name of the provider.
19
19
  */
20
20
  name?: string;
21
+ /**
22
+ * Provider-specific configuration passed during initialization
23
+ * @internal
24
+ */
25
+ configuration?: any;
21
26
  /**
22
27
  * Initialize the provider when the plugin is loaded.
23
28
  * Can be used to initialize libraries, and register additional UI components.
package/dist/index.d.ts CHANGED
@@ -8,6 +8,9 @@ export { CommonProperties };
8
8
  export { type default as Provider, type ImageOutput, type VideoOutput, type TextOutput, type AudioOutput, type StickerOutput, type Output, type OutputKind, type PanelInputSchema, type RenderCustomProperty, type GetBlockInput, type GetBlockInputResult, type GetInput } from './core/provider';
9
9
  export { type GetPropertyInput, type Property } from './openapi/types';
10
10
  export { type GetProvider, type CommonProviderConfiguration, type CommonPluginConfiguration, type CommonConfiguration, type InternalPluginConfiguration } from './types';
11
+ export type { PropertyContext, PropertyConfig, PropertiesConfiguration, ExtendPropertyContexts } from './core/propertyConfiguration';
12
+ export { buildPropertyContext, PropertyContextCache } from './utils/propertyContext';
13
+ export { resolvePropertyDefault, resolvePropertyDefaults } from './utils/propertyResolver';
11
14
  export { default as integrateIntoDefaultAssetLibraryEntry } from './assets/integrateIntoDefaultAssetLibraryEntry';
12
15
  export { ActionRegistry, type PluginActionDefinition, type QuickActionDefinition, type ActionDefinition, type ActionRegistryEventType, type ActionRegistrySubscriberCallback, type ActionRegistryFilters } from './core/ActionRegistry';
13
16
  export { ProviderRegistry } from './core/ProviderRegistry';
@@ -26,3 +29,4 @@ export { default as initializeProvider } from './providers/initializeProvider';
26
29
  export { default as initializeQuickActionComponents } from './ui/quickActions/initializeQuickActionComponents';
27
30
  export { extractAndSetSchemaTranslations } from './openapi/extractSchemaTranslations';
28
31
  export { AI_EDIT_MODE, AI_METADATA_KEY } from './ui/quickActions/utils';
32
+ export { createTranslationCallback, buildTranslationKeys } from './utils/translationHelpers';