@imgly/plugin-ai-image-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.
@@ -0,0 +1,59 @@
1
+ import type { PropertyContext, ExtendPropertyContexts, CommonProviderConfiguration } from '@imgly/plugin-ai-generation-web';
2
+ import type { RecraftV3TextToImageInput } from '@fal-ai/client/endpoints';
3
+ type RecraftV3Output = {
4
+ kind: 'image';
5
+ url: string;
6
+ };
7
+ type Recraft20bOutput = {
8
+ kind: 'image';
9
+ url: string;
10
+ };
11
+ type Recraft20bInput = {
12
+ prompt: string;
13
+ image_size?: 'square_hd' | 'square' | 'portrait_4_3' | 'portrait_16_9' | 'landscape_4_3' | 'landscape_16_9' | {
14
+ width: number;
15
+ height: number;
16
+ };
17
+ style?: string;
18
+ colors?: Array<{
19
+ r: number;
20
+ g: number;
21
+ b: number;
22
+ }>;
23
+ };
24
+ /**
25
+ * Extended context for Recraft style property
26
+ */
27
+ export interface RecraftStyleContext extends PropertyContext {
28
+ /**
29
+ * Currently selected style type
30
+ */
31
+ type: 'image' | 'vector' | 'icon';
32
+ /**
33
+ * Available styles for the current type
34
+ */
35
+ availableStyles: string[];
36
+ /**
37
+ * Whether this is the initial render
38
+ */
39
+ isInitializing: boolean;
40
+ }
41
+ /**
42
+ * Configuration for RecraftV3 provider with extended style context
43
+ */
44
+ export interface RecraftV3Configuration extends Omit<CommonProviderConfiguration<RecraftV3TextToImageInput, RecraftV3Output>, 'properties'> {
45
+ properties?: ExtendPropertyContexts<RecraftV3TextToImageInput, {
46
+ style: RecraftStyleContext;
47
+ }>;
48
+ baseURL?: string;
49
+ }
50
+ /**
51
+ * Configuration for Recraft20b provider with extended style context
52
+ */
53
+ export interface Recraft20bConfiguration extends Omit<CommonProviderConfiguration<Recraft20bInput, Recraft20bOutput>, 'properties'> {
54
+ properties?: ExtendPropertyContexts<Recraft20bInput, {
55
+ style: RecraftStyleContext;
56
+ }>;
57
+ baseURL?: string;
58
+ }
59
+ export {};
@@ -0,0 +1,29 @@
1
+ import type CreativeEditorSDK from '@cesdk/cesdk-js';
2
+ import { CustomAssetSource } from '@imgly/plugin-utils';
3
+ import type { RecraftV3Configuration, Recraft20bConfiguration } from './recraftTypes';
4
+ /**
5
+ * Get available styles for a given style type
6
+ */
7
+ export declare function getAvailableStylesForType(type: 'image' | 'vector' | 'icon'): string[];
8
+ /**
9
+ * Resolve style default from configuration for RecraftV3
10
+ */
11
+ export declare function resolveStyleDefaultV3(config: RecraftV3Configuration, cesdk: CreativeEditorSDK, styleType: 'image' | 'vector'): string | undefined;
12
+ /**
13
+ * Resolve style default from configuration for Recraft20b
14
+ */
15
+ export declare function resolveStyleDefaultRecraft20b(config: Recraft20bConfiguration, cesdk: CreativeEditorSDK, styleType: 'image' | 'vector' | 'icon'): string | undefined;
16
+ /**
17
+ * Initialize a style asset source with configured default for RecraftV3
18
+ */
19
+ export declare function initializeStyleAssetSourceV3(cesdk: CreativeEditorSDK, config: RecraftV3Configuration, styleType: 'image' | 'vector', styles: Array<{
20
+ id: string;
21
+ label: string;
22
+ }>, sourceId: string, getStyleThumbnail: (id: string) => string, translateLabel?: (assetId: string, fallbackLabel: string, locale: string) => string): CustomAssetSource;
23
+ /**
24
+ * Initialize a style asset source with configured default for Recraft20b
25
+ */
26
+ export declare function initializeStyleAssetSourceRecraft20b(cesdk: CreativeEditorSDK, config: Recraft20bConfiguration, styleType: 'image' | 'vector' | 'icon', styles: Array<{
27
+ id: string;
28
+ label: string;
29
+ }>, sourceId: string, getStyleThumbnail: (id: string) => string, translateLabel?: (assetId: string, fallbackLabel: string, locale: string) => string): CustomAssetSource;
package/dist/index.d.ts CHANGED
@@ -2,9 +2,7 @@ import { Output } from '@imgly/plugin-ai-generation-web';
2
2
  import { DEFAULT_IMAGE_QUICK_ACTION_ORDER } from './plugin';
3
3
  import { type PluginConfiguration } from './types';
4
4
  declare const Plugin: <I, O extends Output>(pluginConfiguration: PluginConfiguration<I, O>) => {
5
- initialize: (context: import("@cesdk/engine").EnginePluginContext & {
6
- cesdk?: import("@cesdk/cesdk-js").default;
7
- }) => void;
5
+ initialize: (context: import("@cesdk/cesdk-js").EditorPluginContext) => void | Promise<void>;
8
6
  name: string;
9
7
  version: string;
10
8
  };