@imgly/plugin-ai-image-generation-web 0.1.10 → 0.2.1

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.
@@ -0,0 +1,39 @@
1
+ import { QuickActionDefinition } from '@imgly/plugin-ai-generation-web';
2
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
3
+ /**
4
+ * The ID of the quick action.
5
+ */
6
+ export declare const ID = "ly.img.gpt-image-1.changeStyleLibrary";
7
+ /**
8
+ * The i18n prefix for the quick action.
9
+ */
10
+ export declare const I18N_PREFIX = "ly.img.ai.quickAction.image.gpt-image-1.changeStyleLibrary";
11
+ /**
12
+ * The input generated from this quick action which needs
13
+ * to be mapped to the specific provider.
14
+ */
15
+ export type InputType = {
16
+ prompt: string;
17
+ uri: string;
18
+ };
19
+ /**
20
+ * Function to create the ChangeStyleLibrary quick action.
21
+ */
22
+ declare const ChangeStyleLibrary: (context: {
23
+ cesdk: CreativeEditorSDK;
24
+ modelKey: string;
25
+ baseURL?: string;
26
+ }) => QuickActionDefinition<InputType>;
27
+ /**
28
+ * Extend ImageQuickActionInputs with this action's input type.
29
+ * This will ensure that the types are correctly recognized
30
+ * in the ImageProvider.
31
+ *
32
+ * COPY this file to other quick action to support type safety
33
+ */
34
+ declare module '../../types' {
35
+ interface ImageQuickActionInputs {
36
+ [ID]: InputType;
37
+ }
38
+ }
39
+ export default ChangeStyleLibrary;
package/dist/plugin.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type EditorPlugin } from '@cesdk/cesdk-js';
2
+ import { Output } from '@imgly/plugin-ai-generation-web';
2
3
  import { PluginConfiguration } from './types';
3
- export { PLUGIN_ID } from './constants';
4
- export declare function ImageGeneration(options: PluginConfiguration): Omit<EditorPlugin, 'name' | 'version'>;
4
+ export { PLUGIN_ID, DEFAULT_IMAGE_QUICK_ACTION_ORDER } from './constants';
5
+ export declare function ImageGeneration<I, O extends Output>(config: PluginConfiguration<I, O>): Omit<EditorPlugin, 'name' | 'version'>;
5
6
  export default ImageGeneration;
@@ -0,0 +1,31 @@
1
+ import { GetQuickActionDefinition } from './types';
2
+ /**
3
+ * The ID of the quick action.
4
+ */
5
+ export declare const ID = "ly.img.artistTransfer";
6
+ /**
7
+ * The i18n prefix for the quick action.
8
+ */
9
+ export declare const I18N_PREFIX = "ly.img.ai.quickAction.image.artistTransfer";
10
+ /**
11
+ * The input generated from this quick action which needs
12
+ * to be mapped to the specific provider.
13
+ */
14
+ export type InputType = {
15
+ artist: string;
16
+ uri: string;
17
+ };
18
+ declare const ArtistTransfer: GetQuickActionDefinition<InputType>;
19
+ /**
20
+ * Extend ImageQuickActionInputs with this action's input type.
21
+ * This will ensure that the types are correctly recognized
22
+ * in the ImageProvider.
23
+ *
24
+ * COPY this file to other quick action to support type safety
25
+ */
26
+ declare module '../types' {
27
+ interface ImageQuickActionInputs {
28
+ [ID]: InputType;
29
+ }
30
+ }
31
+ export default ArtistTransfer;
@@ -0,0 +1,32 @@
1
+ import { GetQuickActionDefinition } from './types';
2
+ /**
3
+ * The ID of the quick action.
4
+ */
5
+ export declare const ID = "ly.img.combineImages";
6
+ /**
7
+ * The i18n prefix for the quick action.
8
+ */
9
+ export declare const I18N_PREFIX = "ly.img.ai.quickAction.combineImages";
10
+ /**
11
+ * The input generated from this quick action which needs
12
+ * to be mapped to the specific provider.
13
+ */
14
+ export type InputType = {
15
+ prompt: string;
16
+ uris: string[];
17
+ exportFromBlockIds: number[];
18
+ };
19
+ declare const CombineImages: GetQuickActionDefinition<InputType>;
20
+ /**
21
+ * Extend ImageQuickActionInputs with this action's input type.
22
+ * This will ensure that the types are correctly recognized
23
+ * in the ImageProvider.
24
+ *
25
+ * COPY this file to other quick action to support type safety
26
+ */
27
+ declare module '../types' {
28
+ interface ImageQuickActionInputs {
29
+ [ID]: InputType;
30
+ }
31
+ }
32
+ export default CombineImages;
@@ -0,0 +1,31 @@
1
+ import { GetQuickActionDefinition } from './types';
2
+ /**
3
+ * The ID of the quick action.
4
+ */
5
+ export declare const ID = "ly.img.createVariant";
6
+ /**
7
+ * The i18n prefix for the quick action.
8
+ */
9
+ export declare const I18N_PREFIX = "ly.img.ai.quickAction.image.createVariant";
10
+ /**
11
+ * The input generated from this quick action which needs
12
+ * to be mapped to the specific provider.
13
+ */
14
+ export type InputType = {
15
+ prompt: string;
16
+ uri: string;
17
+ };
18
+ declare const CreateVariant: GetQuickActionDefinition<InputType>;
19
+ /**
20
+ * Extend ImageQuickActionInputs with this action's input type.
21
+ * This will ensure that the types are correctly recognized
22
+ * in the ImageProvider.
23
+ *
24
+ * COPY this file to other quick action to support type safety
25
+ */
26
+ declare module '../types' {
27
+ interface ImageQuickActionInputs {
28
+ [ID]: InputType;
29
+ }
30
+ }
31
+ export default CreateVariant;
@@ -0,0 +1,31 @@
1
+ import { GetQuickActionDefinition } from './types';
2
+ /**
3
+ * The ID of the quick action.
4
+ */
5
+ export declare const ID = "ly.img.editImage";
6
+ /**
7
+ * The i18n prefix for the quick action.
8
+ */
9
+ export declare const I18N_PREFIX = "ly.img.ai.quickAction.image.editImage";
10
+ /**
11
+ * The input generated from this quick action which needs
12
+ * to be mapped to the specific provider.
13
+ */
14
+ export type InputType = {
15
+ prompt: string;
16
+ uri: string;
17
+ };
18
+ declare const EditImage: GetQuickActionDefinition<InputType>;
19
+ /**
20
+ * Extend ImageQuickActionInputs with this action's input type.
21
+ * This will ensure that the types are correctly recognized
22
+ * in the ImageProvider.
23
+ *
24
+ * COPY this file to other quick action to support type safety
25
+ */
26
+ declare module '../types' {
27
+ interface ImageQuickActionInputs {
28
+ [ID]: InputType;
29
+ }
30
+ }
31
+ export default EditImage;
@@ -0,0 +1,31 @@
1
+ import { GetQuickActionDefinition } from './types';
2
+ /**
3
+ * The ID of the quick action.
4
+ */
5
+ export declare const ID = "ly.img.remixPage";
6
+ /**
7
+ * The i18n prefix for the quick action.
8
+ */
9
+ export declare const I18N_PREFIX = "ly.img.ai.quickAction.remixPage";
10
+ /**
11
+ * The input generated from this quick action which needs
12
+ * to be mapped to the specific provider.
13
+ */
14
+ export type InputType = {
15
+ prompt: string;
16
+ uri: string;
17
+ };
18
+ declare const RemixPage: GetQuickActionDefinition<InputType>;
19
+ /**
20
+ * Extend ImageQuickActionInputs with this action's input type.
21
+ * This will ensure that the types are correctly recognized
22
+ * in the ImageProvider.
23
+ *
24
+ * COPY this file to other quick action to support type safety
25
+ */
26
+ declare module '../types' {
27
+ interface ImageQuickActionInputs {
28
+ [ID]: InputType;
29
+ }
30
+ }
31
+ export default RemixPage;
@@ -0,0 +1,31 @@
1
+ import { GetQuickActionDefinition } from './types';
2
+ /**
3
+ * The ID of the quick action.
4
+ */
5
+ export declare const ID = "ly.img.remixPageWithPrompt";
6
+ /**
7
+ * The i18n prefix for the quick action.
8
+ */
9
+ export declare const I18N_PREFIX = "ly.img.ai.quickAction.remixPageWithPrompt";
10
+ /**
11
+ * The input generated from this quick action which needs
12
+ * to be mapped to the specific provider.
13
+ */
14
+ export type InputType = {
15
+ prompt: string;
16
+ uri: string;
17
+ };
18
+ declare const RemixPageWithPrompt: GetQuickActionDefinition<InputType>;
19
+ /**
20
+ * Extend ImageQuickActionInputs with this action's input type.
21
+ * This will ensure that the types are correctly recognized
22
+ * in the ImageProvider.
23
+ *
24
+ * COPY this file to other quick action to support type safety
25
+ */
26
+ declare module '../types' {
27
+ interface ImageQuickActionInputs {
28
+ [ID]: InputType;
29
+ }
30
+ }
31
+ export default RemixPageWithPrompt;
@@ -0,0 +1,31 @@
1
+ import { GetQuickActionDefinition } from './types';
2
+ /**
3
+ * The ID of the quick action.
4
+ */
5
+ export declare const ID = "ly.img.styleTransfer";
6
+ /**
7
+ * The i18n prefix for the quick action.
8
+ */
9
+ export declare const I18N_PREFIX = "ly.img.ai.quickAction.image.styleTransfer";
10
+ /**
11
+ * The input generated from this quick action which needs
12
+ * to be mapped to the specific provider.
13
+ */
14
+ export type InputType = {
15
+ style: string;
16
+ uri: string;
17
+ };
18
+ declare const StyleTransfer: GetQuickActionDefinition<InputType>;
19
+ /**
20
+ * Extend ImageQuickActionInputs with this action's input type.
21
+ * This will ensure that the types are correctly recognized
22
+ * in the ImageProvider.
23
+ *
24
+ * COPY this file to other quick action to support type safety
25
+ */
26
+ declare module '../types' {
27
+ interface ImageQuickActionInputs {
28
+ [ID]: InputType;
29
+ }
30
+ }
31
+ export default StyleTransfer;
@@ -0,0 +1,31 @@
1
+ import { GetQuickActionDefinition } from './types';
2
+ /**
3
+ * The ID of the quick action.
4
+ */
5
+ export declare const ID = "ly.img.swapBackground";
6
+ /**
7
+ * The i18n prefix for the quick action.
8
+ */
9
+ export declare const I18N_PREFIX = "ly.img.ai.quickAction.image.swapBackground";
10
+ /**
11
+ * The input generated from this quick action which needs
12
+ * to be mapped to the specific provider.
13
+ */
14
+ export type InputType = {
15
+ prompt: string;
16
+ uri: string;
17
+ };
18
+ declare const SwapBackground: GetQuickActionDefinition<InputType>;
19
+ /**
20
+ * Extend ImageQuickActionInputs with this action's input type.
21
+ * This will ensure that the types are correctly recognized
22
+ * in the ImageProvider.
23
+ *
24
+ * COPY this file to other quick action to support type safety
25
+ */
26
+ declare module '../types' {
27
+ interface ImageQuickActionInputs {
28
+ [ID]: InputType;
29
+ }
30
+ }
31
+ export default SwapBackground;
@@ -0,0 +1,6 @@
1
+ import CreativeEditorSDK from '@cesdk/cesdk-js';
2
+ import { QuickActionDefinition } from '@imgly/plugin-ai-generation-web';
3
+ export type GetQuickActionDefinitionContext = {
4
+ cesdk: CreativeEditorSDK;
5
+ };
6
+ export type GetQuickActionDefinition<Q extends Record<string, any>> = (context: GetQuickActionDefinitionContext) => QuickActionDefinition<Q>;
package/dist/types.d.ts CHANGED
@@ -1,35 +1,66 @@
1
- import type CreativeEditorSDK from '@cesdk/cesdk-js';
2
- import { type Provider, type GenerationMiddleware } from '@imgly/plugin-ai-generation-web';
3
- type AiImageProvider = (context: {
4
- cesdk: CreativeEditorSDK;
5
- }) => Promise<Provider<'image', any, any>>;
1
+ import { CommonPluginConfiguration, GetProvider, Output, Provider, ImageOutput } from '@imgly/plugin-ai-generation-web';
6
2
  /**
7
3
  * Configuration to set provider and models for image generation.
8
4
  */
9
- export interface PluginConfiguration {
5
+ export interface PluginConfiguration<I, O extends Output> extends CommonPluginConfiguration<'image', I, O> {
6
+ providers: {
7
+ /**
8
+ * Provider of a model for image generation just from a (prompt) text.
9
+ */
10
+ text2image?: GetProvider<'image'>[] | GetProvider<'image'>;
11
+ /**
12
+ * Provider of a model for image generation from a given image.
13
+ */
14
+ image2image?: GetProvider<'image'>[] | GetProvider<'image'>;
15
+ };
10
16
  /**
11
17
  * Provider of a model for image generation just from a (prompt) text.
18
+ * @deprecated Use `providers.text2image` instead.
12
19
  */
13
- text2image?: AiImageProvider;
20
+ text2image?: GetProvider<'image'>[] | GetProvider<'image'>;
14
21
  /**
15
22
  * Provider of a model for image generation from a given image.
23
+ * @deprecated Use `providers.image2image` instead.
16
24
  */
17
- image2image?: AiImageProvider;
18
- /**
19
- * Render console logs for debugging purposes.
20
- */
21
- debug?: boolean;
22
- /**
23
- * Dry run mode. If set to true, the plugin will not make any API calls.
24
- */
25
- dryRun?: boolean;
26
- /**
27
- * Is called when the generation process is started. Can be used to
28
- * extend the generation process with additional steps.
29
- *
30
- * @param generate A function that starts the actual generation process.
31
- * @param context The context of the generation process.
32
- */
33
- middleware?: GenerationMiddleware;
25
+ image2image?: GetProvider<'image'>[] | GetProvider<'image'>;
26
+ }
27
+ /**
28
+ * Input types for image-specific quick actions
29
+ * This interface is extended by individual quick action files using module augmentation
30
+ */
31
+ export interface ImageQuickActionInputs {
32
+ }
33
+ /**
34
+ * Type-safe support mapping for image quick actions
35
+ * Allows `true` or `{}` when the quick action input type extends the provider input type
36
+ */
37
+ export type ImageQuickActionSupport<I, K extends keyof ImageQuickActionInputs> = ImageQuickActionInputs[K] extends I ? true | {
38
+ mapInput: (input: ImageQuickActionInputs[K]) => I;
39
+ } | {
40
+ [key: string]: any;
41
+ } : {
42
+ mapInput: (input: ImageQuickActionInputs[K]) => I;
43
+ };
44
+ /**
45
+ * Type-safe mapping for image quick action support
46
+ */
47
+ export type ImageQuickActionSupportMap<I> = {
48
+ [K in keyof ImageQuickActionInputs]?: ImageQuickActionSupport<I, K>;
49
+ } & {
50
+ [key: string]: true | {
51
+ mapInput: (input: any) => I;
52
+ } | {
53
+ [key: string]: any;
54
+ };
55
+ };
56
+ /**
57
+ * Image provider extension with type-safe quick action support
58
+ * Only parameterized by K (the quick action key), O is fixed to ImageOutput
59
+ */
60
+ export interface ImageProvider<I> extends Provider<'image', I, ImageOutput> {
61
+ input: Omit<Provider<'image', I, ImageOutput>['input'], 'quickActions'> & {
62
+ quickActions?: {
63
+ supported?: ImageQuickActionSupportMap<I>;
64
+ };
65
+ };
34
66
  }
35
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imgly/plugin-ai-image-generation-web",
3
- "version": "0.1.10",
3
+ "version": "0.2.1",
4
4
  "description": "AI image generation plugin for the CE.SDK editor",
5
5
  "keywords": [
6
6
  "CE.SDK",
@@ -53,7 +53,7 @@
53
53
  "build": "pnpm run clean && pnpm _syncPnpm && pnpm exec node scripts/build.mjs",
54
54
  "test": "echo No tests",
55
55
  "dev": "pnpm --filter \"${npm_package_name}^...\" --parallel run dev:wait && pnpm exec concurrently 'node scripts/watch.mjs' 'pnpm _syncPnpm --watch' --names 'build,sync deps'",
56
- "dev:wait": "pnpm exec wait-on ./dist/index.mjs ./dist/index.d.ts ./dist/fal-ai/index.mjs ./dist/fal-ai/index.d.ts ./dist/open-ai/index.mjs ./dist/open-ai/index.d.ts --window 250 --timeout 30000",
56
+ "dev:wait": "pnpm exec wait-on ./dist/index.mjs ./dist/index.d.ts ./dist/fal-ai/index.mjs ./dist/fal-ai/index.d.ts ./dist/open-ai/index.mjs ./dist/open-ai/index.d.ts --window 250 --timeout 60000",
57
57
  "dev:types": "tsc --emitDeclarationOnly --watch --preserveWatchOutput",
58
58
  "publish:latest": "pnpm run build && npm publish --tag latest --access public",
59
59
  "publish:next": "pnpm run build && npm publish --tag next --access public",