@imgly/plugin-ai-generation-web 0.2.6 → 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 +18 -0
- package/README.md +50 -0
- package/dist/__tests__/propertyResolver.test.d.ts +1 -0
- package/dist/core/propertyConfiguration.d.ts +58 -0
- package/dist/core/provider.d.ts +5 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +4 -4
- package/dist/openapi/renderProperty.d.ts +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/ui/panels/createPanelRenderFunctionFromSchema.d.ts +1 -1
- package/dist/utils/propertyContext.d.ts +21 -0
- package/dist/utils/propertyResolver.d.ts +16 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
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
|
+
|
|
5
23
|
## [0.2.6] - 2025-09-09
|
|
6
24
|
|
|
7
25
|
### New Features
|
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:
|
|
@@ -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
|
+
};
|
package/dist/core/provider.d.ts
CHANGED
|
@@ -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';
|