@imgly/plugin-ai-sticker-generation-web 0.2.0

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 ADDED
@@ -0,0 +1,49 @@
1
+ # Changelog - AI Plugins
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [0.2.0] - 2025-07-15
6
+
7
+ ### Breaking Changes
8
+
9
+ - [all] **Provider Initialization**: `initProvider` is replaced with `initializeProviders` and `initializeProvider` with a different signature
10
+ - [all] **Quick Actions Structure**: `provider.input.quickctions.actions` replaced with `provider.input.quickActions.supported`
11
+ - [all] **History Asset Sources**: Combined history asset source is now not added to the default asset libraries anymore. Add the following sources to any library entry (default or not):
12
+ - Image Generation History: `ly.img.ai.image-generation.history`
13
+ - Video Generation History: `ly.img.ai.video-generation.history`
14
+ - Audio Generation History: `ly.img.ai.audio-generation.history`
15
+ - Sticker Generation History: `ly.img.ai.sticker-generation.history`
16
+ - [all] **ID Format Standardization**: All `ly.img.ai/` prefixed IDs changed to use dot notation `ly.img.ai.` for consistency
17
+ - Panel IDs: `ly.img.ai/apps` → `ly.img.ai.apps`, `ly.img.ai/image-generation` → `ly.img.ai.image-generation`
18
+ - Dock IDs: `ly.img.ai/apps.dock` → `ly.img.ai.apps.dock`
19
+
20
+ ### New Features
21
+
22
+ - [all] **Multiple Providers Support**: All plugin packages now support arrays of providers with automatic selection UI
23
+ - [image-generation] **Recraft20b Provider**: Added new Recraft20b (v2) provider via fal.ai with support for icon styles including `broken_line`, `colored_outline`, `colored_shapes`, and more
24
+ - [sticker-generation] **New Sticker Generation Plugin**: Added `@imgly/plugin-ai-sticker-generation-web` plugin for AI-powered sticker generation with support for text-to-sticker generation using Recraft20b provider with icon styles
25
+ - [image-generation] **Flux Pro Kontext Provider**: Added Flux Pro Kontext provider for image editing with style transfer and artist style options
26
+ - [image-generation] **Flux Pro Kontext Max Provider**: Added Flux Pro Kontext Max provider for enhanced image editing capabilities
27
+ - [video-generation] **Veo3 Provider**: Added Veo3 text-to-video provider via fal.ai with support for 16:9, 9:16, and 1:1 aspect ratios and 8-second duration
28
+ - [video-generation] **Kling Video V2.1 Master Providers**: Added Kling Video V2.1 Master providers for both text-to-video and image-to-video generation with configurable duration (5s/10s) and aspect ratios
29
+ - [text-generation] **Model Selection**: OpenAI and Anthropic providers now support configurable model selection through the `model` parameter
30
+
31
+ ### Deprecated Features
32
+
33
+ - [all] **Middleware Configuration**: The `middleware` property in provider configurations is deprecated. Use `middlewares` instead. The old property will continue to work for now.
34
+
35
+ ## [0.1.10] - 2025-06-20
36
+
37
+ - [all] Fix issue with GPT provider when using text provider
38
+
39
+ ## [0.1.9] - 2025-06-05
40
+
41
+ - [all] Add support for custom headers
42
+
43
+ ## [0.1.8] - 2025-05-26
44
+
45
+ - [ai-apps] Handle `sceneMode` change in upcoming CE.SDK version 1.52.0
46
+
47
+ ## [0.1.0] - 2025-04-17
48
+
49
+ - [all] Initial release
package/LICENSE.md ADDED
@@ -0,0 +1 @@
1
+ The licensed code may be used by the customer solely in connection with an IMG.LY licensed product and for commercial purposes under the terms set forth in this agreement. Any other use of the licensed code is strictly prohibited unless otherwise agreed in writing by IMG.LY.
package/README.md ADDED
@@ -0,0 +1,308 @@
1
+ # IMG.LY AI Sticker Generation for Web
2
+
3
+ A plugin for integrating AI sticker generation capabilities into CreativeEditor SDK.
4
+
5
+ ## Overview
6
+
7
+ The `@imgly/plugin-ai-sticker-generation-web` package enables users to generate stickers using AI directly within CreativeEditor SDK. This plugin leverages the [fal.ai](https://fal.ai) platform to provide high-quality sticker generation from text prompts using optimized icon styles.
8
+
9
+ Features include:
10
+ - Text-to-sticker generation
11
+ - Icon-style sticker generation optimized for transparency
12
+ - Various icon styles (broken line, colored outline, colored shapes, etc.)
13
+ - Custom dimensions support
14
+ - Automatic history tracking
15
+ - Seamless integration with CreativeEditor SDK
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ npm install @imgly/plugin-ai-sticker-generation-web
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ### Basic Configuration
26
+
27
+ To use the plugin, import it and configure it with your preferred providers:
28
+
29
+ #### Single Provider Configuration
30
+
31
+ ```typescript
32
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
33
+ import StickerGeneration from '@imgly/plugin-ai-sticker-generation-web';
34
+ import FalAiSticker from '@imgly/plugin-ai-sticker-generation-web/fal-ai';
35
+
36
+ // Initialize CreativeEditor SDK
37
+ CreativeEditorSDK.create(domElement, {
38
+ license: 'your-license-key',
39
+ // Other configuration options...
40
+ }).then(async (cesdk) => {
41
+ // Add the sticker generation plugin with fal.ai provider
42
+ cesdk.addPlugin(
43
+ StickerGeneration({
44
+ // Text-to-sticker provider
45
+ text2sticker: FalAiSticker.Recraft20b({
46
+ proxyUrl: 'http://your-proxy-server.com/api/proxy',
47
+ headers: {
48
+ 'x-custom-header': 'value',
49
+ 'x-client-version': '1.0.0'
50
+ }
51
+ }),
52
+
53
+ // Optional configuration
54
+ debug: false,
55
+ dryRun: false
56
+ })
57
+ );
58
+ });
59
+ ```
60
+
61
+ #### Multiple Providers Configuration
62
+
63
+ You can configure multiple providers for text-to-sticker generation, and users will see a selection box to choose between them:
64
+
65
+ ```typescript
66
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
67
+ import StickerGeneration from '@imgly/plugin-ai-sticker-generation-web';
68
+ import FalAiSticker from '@imgly/plugin-ai-sticker-generation-web/fal-ai';
69
+
70
+ // Initialize CreativeEditor SDK
71
+ CreativeEditorSDK.create(domElement, {
72
+ license: 'your-license-key',
73
+ // Other configuration options...
74
+ }).then(async (cesdk) => {
75
+ // Add the sticker generation plugin with multiple providers
76
+ cesdk.addPlugin(
77
+ StickerGeneration({
78
+ // Multiple text-to-sticker providers
79
+ text2sticker: [
80
+ FalAiSticker.Recraft20b({
81
+ proxyUrl: 'http://your-proxy-server.com/api/proxy',
82
+ headers: {
83
+ 'x-custom-header': 'value',
84
+ 'x-client-version': '1.0.0'
85
+ }
86
+ })
87
+ // Add more providers as they become available
88
+ ],
89
+
90
+ // Optional configuration
91
+ debug: false,
92
+ dryRun: false
93
+ })
94
+ );
95
+ });
96
+ ```
97
+
98
+ ### Providers
99
+
100
+ The plugin comes with pre-configured providers for fal.ai models:
101
+
102
+ #### Recraft20b (Text-to-Sticker)
103
+
104
+ A specialized text-to-sticker model from fal.ai with icon style support optimized for sticker generation:
105
+
106
+ ```typescript
107
+ text2sticker: FalAiSticker.Recraft20b({
108
+ proxyUrl: 'http://your-proxy-server.com/api/proxy',
109
+ headers: {
110
+ 'x-custom-header': 'value',
111
+ 'x-client-version': '1.0.0'
112
+ }
113
+ })
114
+ ```
115
+
116
+ Key features:
117
+ - **Icon styles optimized for stickers**: broken_line, colored_outline, colored_shapes, doodle_fill, and more
118
+ - Various image size presets (square, landscape, portrait)
119
+ - Custom dimensions support
120
+ - Transparent background support
121
+ - Cost-effective sticker generation
122
+ - Custom headers support for API requests
123
+
124
+ Available icon styles:
125
+ - `broken_line`: Clean broken line style
126
+ - `colored_outline`: Colored outline style
127
+ - `colored_shapes`: Filled colored shapes
128
+ - `colored_shapes_gradient`: Gradient filled shapes
129
+ - `doodle_fill`: Doodle-style fill
130
+ - `doodle_offset_fill`: Offset doodle fill
131
+ - `offset_fill`: Offset fill style
132
+ - `outline`: Simple outline style
133
+ - `outline_gradient`: Gradient outline
134
+ - `uneven_fill`: Uneven fill style
135
+
136
+ ### Configuration Options
137
+
138
+ The plugin accepts the following configuration options:
139
+
140
+ | Option | Type | Description | Default |
141
+ |--------|------|-------------|---------|
142
+ | `text2sticker` | Provider \| Provider[] | Provider(s) for text-to-sticker generation. When multiple providers are provided, users can select between them | undefined |
143
+ | `debug` | boolean | Enable debug logging | false |
144
+ | `dryRun` | boolean | Simulate generation without API calls | false |
145
+ | `middleware` | Function[] | Array of middleware functions to extend the generation process | undefined |
146
+
147
+ ### Middleware Configuration
148
+
149
+ The `middleware` option allows you to add pre-processing and post-processing capabilities to the generation process:
150
+
151
+ ```typescript
152
+ import StickerGeneration from '@imgly/plugin-ai-sticker-generation-web';
153
+ import FalAiSticker from '@imgly/plugin-ai-sticker-generation-web/fal-ai';
154
+ import { loggingMiddleware, rateLimitMiddleware } from '@imgly/plugin-ai-generation-web';
155
+
156
+ // Create middleware functions
157
+ const logging = loggingMiddleware();
158
+ const rateLimit = rateLimitMiddleware({
159
+ maxRequests: 10,
160
+ timeWindowMs: 60000, // 1 minute
161
+ onRateLimitExceeded: (input, options, info) => {
162
+ console.log(`Rate limit exceeded: ${info.currentCount}/${info.maxRequests}`);
163
+ return false; // Reject request
164
+ }
165
+ });
166
+
167
+ // Apply middleware to plugin
168
+ cesdk.addPlugin(
169
+ StickerGeneration({
170
+ text2sticker: FalAiSticker.Recraft20b({
171
+ proxyUrl: 'http://your-proxy-server.com/api/proxy'
172
+ }),
173
+ middleware: [logging, rateLimit] // Apply middleware in order
174
+ })
175
+ );
176
+ ```
177
+
178
+ ### Using a Proxy
179
+
180
+ For security reasons, it's recommended to use a proxy server to handle API requests to fal.ai. The proxy URL is required when configuring providers:
181
+
182
+ ```typescript
183
+ text2sticker: FalAiSticker.Recraft20b({
184
+ proxyUrl: 'http://your-proxy-server.com/api/proxy',
185
+ headers: {
186
+ 'x-custom-header': 'value',
187
+ 'x-client-version': '1.0.0'
188
+ }
189
+ })
190
+ ```
191
+
192
+ The `headers` option allows you to include custom HTTP headers in all API requests. This is useful for:
193
+ - Adding custom client identification headers
194
+ - Including version information
195
+ - Passing through metadata required by your API
196
+ - Adding correlation IDs for request tracing
197
+
198
+ You'll need to implement a proxy server that forwards requests to fal.ai and handles authentication.
199
+
200
+ ## API Reference
201
+
202
+ ### Main Plugin
203
+
204
+ ```typescript
205
+ StickerGeneration(options: PluginConfiguration): EditorPlugin
206
+ ```
207
+
208
+ Creates and returns a plugin that can be added to CreativeEditor SDK.
209
+
210
+ ### Plugin Configuration
211
+
212
+ ```typescript
213
+ interface PluginConfiguration {
214
+ // Provider(s) for text-to-sticker generation
215
+ text2sticker?: AiStickerProvider | AiStickerProvider[];
216
+
217
+ // Enable debug logging
218
+ debug?: boolean;
219
+
220
+ // Skip actual API calls for testing
221
+ dryRun?: boolean;
222
+
223
+ // Extend the generation process
224
+ middleware?: GenerationMiddleware;
225
+ }
226
+ ```
227
+
228
+ ### Fal.ai Providers
229
+
230
+ #### Recraft20b
231
+
232
+ ```typescript
233
+ FalAiSticker.Recraft20b(config: {
234
+ proxyUrl: string;
235
+ headers?: Record<string, string>;
236
+ debug?: boolean;
237
+ })
238
+ ```
239
+
240
+ ## UI Integration
241
+
242
+ The plugin automatically registers the following UI components:
243
+
244
+ 1. **Generation Panel**: A sidebar panel for text-to-sticker generation
245
+ 2. **History Library**: Displays previously generated stickers
246
+ 3. **Dock Component**: A button in the dock area to open the sticker generation panel
247
+
248
+ ### Panel IDs
249
+
250
+ - Main panel: `ly.img.ai.sticker-generation`
251
+ - Provider-specific panels:
252
+ - Recraft20b: `ly.img.ai.fal-ai/recraft/v2/text-to-sticker`
253
+
254
+ ### Asset History
255
+
256
+ Generated stickers are automatically stored in asset sources with the following IDs:
257
+ - Recraft20b: `fal-ai/recraft/v2/text-to-sticker.history`
258
+
259
+ ### Dock Integration
260
+
261
+ The plugin automatically registers a dock component with a sparkle icon that opens the sticker generation panel. To customize the component's position in the dock, use the `setDockOrder` method:
262
+
263
+ ```typescript
264
+ // Add the AI Sticker component to the beginning of the dock
265
+ cesdk.ui.setDockOrder([
266
+ 'ly.img.ai.sticker-generation.dock',
267
+ ...cesdk.ui.getDockOrder()
268
+ ]);
269
+
270
+ // Or add it at a specific position
271
+ const currentOrder = cesdk.ui.getDockOrder();
272
+ currentOrder.splice(2, 0, 'ly.img.ai.sticker-generation.dock');
273
+ cesdk.ui.setDockOrder(currentOrder);
274
+ ```
275
+
276
+ ## Integration with AI Apps Plugin
277
+
278
+ The sticker generation plugin integrates seamlessly with the AI Apps plugin:
279
+
280
+ ```typescript
281
+ import AIApps from '@imgly/plugin-ai-apps-web';
282
+ import FalAiSticker from '@imgly/plugin-ai-sticker-generation-web/fal-ai';
283
+
284
+ cesdk.addPlugin(
285
+ AIApps({
286
+ providers: {
287
+ // Other providers...
288
+ text2sticker: FalAiSticker.Recraft20b({
289
+ proxyUrl: 'http://your-proxy-server.com/api/proxy'
290
+ })
291
+ }
292
+ })
293
+ );
294
+ ```
295
+
296
+ When integrated with AI Apps, the sticker generation functionality appears in the main AI interface alongside other AI generation capabilities.
297
+
298
+ ## Related Packages
299
+
300
+ - [@imgly/plugin-ai-generation-web](https://github.com/imgly/plugins/tree/main/packages/plugin-ai-generation-web) - Core utilities for AI generation
301
+ - [@imgly/plugin-ai-apps-web](https://github.com/imgly/plugins/tree/main/packages/plugin-ai-apps-web) - AI apps orchestration
302
+ - [@imgly/plugin-ai-image-generation-web](https://github.com/imgly/plugins/tree/main/packages/plugin-ai-image-generation-web) - AI image generation
303
+ - [@imgly/plugin-ai-video-generation-web](https://github.com/imgly/plugins/tree/main/packages/plugin-ai-video-generation-web) - AI video generation
304
+ - [@imgly/plugin-ai-audio-generation-web](https://github.com/imgly/plugins/tree/main/packages/plugin-ai-audio-generation-web) - AI audio generation
305
+
306
+ ## License
307
+
308
+ This plugin is part of the IMG.LY plugin ecosystem for CreativeEditor SDK. Please refer to the license terms in the package.
@@ -0,0 +1 @@
1
+ export declare const PLUGIN_ID = "@imgly/plugin-ai-sticker-generation-web";
@@ -0,0 +1,30 @@
1
+ export declare function getImageDimensions(id: string): {
2
+ width: number;
3
+ height: number;
4
+ };
5
+ export type StyleId = 'any' | 'realistic_image' | 'digital_illustration' | 'vector_illustration' | 'realistic_image/b_and_w' | 'realistic_image/hard_flash' | 'realistic_image/hdr' | 'realistic_image/natural_light' | 'realistic_image/studio_portrait' | 'realistic_image/enterprise' | 'realistic_image/motion_blur' | 'realistic_image/evening_light' | 'realistic_image/faded_nostalgia' | 'realistic_image/forest_life' | 'realistic_image/mystic_naturalism' | 'realistic_image/natural_tones' | 'realistic_image/organic_calm' | 'realistic_image/real_life_glow' | 'realistic_image/retro_realism' | 'realistic_image/retro_snapshot' | 'realistic_image/urban_drama' | 'realistic_image/village_realism' | 'realistic_image/warm_folk' | 'digital_illustration/pixel_art' | 'digital_illustration/hand_drawn' | 'digital_illustration/grain' | 'digital_illustration/infantile_sketch' | 'digital_illustration/2d_art_poster' | 'digital_illustration/handmade_3d' | 'digital_illustration/hand_drawn_outline' | 'digital_illustration/engraving_color' | 'digital_illustration/2d_art_poster_2' | 'digital_illustration/antiquarian' | 'digital_illustration/bold_fantasy' | 'digital_illustration/child_book' | 'digital_illustration/child_books' | 'digital_illustration/cover' | 'digital_illustration/crosshatch' | 'digital_illustration/digital_engraving' | 'digital_illustration/expressionism' | 'digital_illustration/freehand_details' | 'digital_illustration/grain_20' | 'digital_illustration/graphic_intensity' | 'digital_illustration/hard_comics' | 'digital_illustration/long_shadow' | 'digital_illustration/modern_folk' | 'digital_illustration/multicolor' | 'digital_illustration/neon_calm' | 'digital_illustration/noir' | 'digital_illustration/nostalgic_pastel' | 'digital_illustration/outline_details' | 'digital_illustration/pastel_gradient' | 'digital_illustration/pastel_sketch' | 'digital_illustration/pop_art' | 'digital_illustration/pop_renaissance' | 'digital_illustration/street_art' | 'digital_illustration/tablet_sketch' | 'digital_illustration/urban_glow' | 'digital_illustration/urban_sketching' | 'digital_illustration/vanilla_dreams' | 'digital_illustration/young_adult_book' | 'digital_illustration/young_adult_book_2' | 'vector_illustration/bold_stroke' | 'vector_illustration/chemistry' | 'vector_illustration/colored_stencil' | 'vector_illustration/contour_pop_art' | 'vector_illustration/cosmics' | 'vector_illustration/cutout' | 'vector_illustration/depressive' | 'vector_illustration/editorial' | 'vector_illustration/emotional_flat' | 'vector_illustration/infographical' | 'vector_illustration/marker_outline' | 'vector_illustration/mosaic' | 'vector_illustration/naivector' | 'vector_illustration/roundish_flat' | 'vector_illustration/segmented_colors' | 'vector_illustration/sharp_contrast' | 'vector_illustration/thin' | 'vector_illustration/vector_photo' | 'vector_illustration/vivid_shapes' | 'vector_illustration/engraving' | 'vector_illustration/line_art' | 'vector_illustration/line_circuit' | 'vector_illustration/linocut' | 'icon/broken_line' | 'icon/colored_outline' | 'icon/colored_shapes' | 'icon/colored_shapes_gradient' | 'icon/doodle_fill' | 'icon/doodle_offset_fill' | 'icon/offset_fill' | 'icon/outline' | 'icon/outline_gradient' | 'icon/uneven_fill';
6
+ export declare const STYLES_IMAGE: {
7
+ id: StyleId;
8
+ label: string;
9
+ }[];
10
+ export declare const STYLE_IMAGE_DEFAULT: {
11
+ id: StyleId;
12
+ label: string;
13
+ };
14
+ export declare const STYLES_VECTOR: {
15
+ id: StyleId;
16
+ label: string;
17
+ }[];
18
+ export declare const STYLE_VECTOR_DEFAULT: {
19
+ id: StyleId;
20
+ label: string;
21
+ };
22
+ export declare const STYLES_ICON: {
23
+ id: StyleId;
24
+ label: string;
25
+ }[];
26
+ export declare const STYLE_ICON_DEFAULT: {
27
+ id: StyleId;
28
+ label: string;
29
+ };
30
+ export declare function getStyleThumbnail(id: StyleId, baseURL: string): string | undefined;
@@ -0,0 +1,30 @@
1
+ import { CommonProviderConfiguration } from '@imgly/plugin-ai-generation-web';
2
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
3
+ import { type StyleId } from './Recraft20b.constants';
4
+ type Recraft20bInput = {
5
+ prompt: string;
6
+ image_size?: 'square_hd' | 'square' | 'portrait_4_3' | 'portrait_16_9' | 'landscape_4_3' | 'landscape_16_9' | {
7
+ width: number;
8
+ height: number;
9
+ };
10
+ style?: StyleId;
11
+ colors?: Array<{
12
+ r: number;
13
+ g: number;
14
+ b: number;
15
+ }>;
16
+ };
17
+ interface ProviderConfiguration extends CommonProviderConfiguration<Recraft20bInput, any> {
18
+ /**
19
+ * Base URL used for the UI assets used in the plugin.
20
+ *
21
+ * By default, we load the assets from the IMG.LY CDN You can copy the assets.
22
+ * from the `/assets` folder to your own server and set the base URL to your server.
23
+ */
24
+ baseURL?: string;
25
+ }
26
+ export declare function Recraft20b(config: ProviderConfiguration): (context: {
27
+ cesdk: CreativeEditorSDK;
28
+ }) => Promise<any>;
29
+ declare function getProvider(cesdk: CreativeEditorSDK, config: ProviderConfiguration): any;
30
+ export default getProvider;
@@ -0,0 +1,40 @@
1
+ import { type OpenAPIV3 } from 'openapi-types';
2
+ import CreativeEditorSDK, { CreativeEngine } from '@cesdk/cesdk-js';
3
+ import { RenderCustomProperty, Middleware } from '@imgly/plugin-ai-generation-web';
4
+ import { StickerQuickActionSupportMap } from '../types';
5
+ type StickerProviderConfiguration = {
6
+ proxyUrl: string;
7
+ debug?: boolean;
8
+ middlewares?: Middleware<any, any>[];
9
+ /**
10
+ * @deprecated Use `middlewares` instead.
11
+ */
12
+ middleware?: Middleware<any, any>[];
13
+ };
14
+ /**
15
+ * Creates a base provider from schema. This should work out of the box
16
+ * but may be rough around the edges and should/can be further customized.
17
+ */
18
+ declare function createStickerProvider<I extends Record<string, any>>(options: {
19
+ falKey: string;
20
+ modelKey: string;
21
+ name?: string;
22
+ schema: OpenAPIV3.Document;
23
+ inputReference: string;
24
+ userFlow?: 'placeholder' | 'generation-only';
25
+ initialize?: (context: {
26
+ cesdk?: CreativeEditorSDK;
27
+ engine: CreativeEngine;
28
+ }) => void;
29
+ renderCustomProperty?: RenderCustomProperty;
30
+ supportedQuickActions?: StickerQuickActionSupportMap<I>;
31
+ getBlockInput?: any;
32
+ getStickerSize?: (input: I) => {
33
+ width: number;
34
+ height: number;
35
+ };
36
+ middleware?: any[];
37
+ headers?: Record<string, string>;
38
+ cesdk?: CreativeEditorSDK;
39
+ }, config: StickerProviderConfiguration): any;
40
+ export default createStickerProvider;
@@ -0,0 +1,5 @@
1
+ import { Recraft20b } from './Recraft20b';
2
+ declare const FalAi: {
3
+ Recraft20b: typeof Recraft20b;
4
+ };
5
+ export default FalAi;