@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
|
@@ -2,5 +2,5 @@ import { BuilderRenderFunctionContext } from '@cesdk/cesdk-js';
|
|
|
2
2
|
import { GetPropertyInput, Property } from './types';
|
|
3
3
|
import Provider, { Output, OutputKind, PanelInputSchema } from '../core/provider';
|
|
4
4
|
import { UIOptions, CommonConfiguration } from '../types';
|
|
5
|
-
declare function renderProperty<K extends OutputKind, I, O extends Output>(context: BuilderRenderFunctionContext<any>, property: Property, provider: Provider<K, I, O>, panelInput: PanelInputSchema<K, I>, options: UIOptions, config: CommonConfiguration<I, O>, kind: K): GetPropertyInput | undefined;
|
|
5
|
+
declare function renderProperty<K extends OutputKind, I, O extends Output>(context: BuilderRenderFunctionContext<any>, property: Property, provider: Provider<K, I, O>, panelInput: PanelInputSchema<K, I>, options: UIOptions, config: CommonConfiguration<I, O>, kind: K, providerConfig?: any): GetPropertyInput | undefined;
|
|
6
6
|
export default renderProperty;
|
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type CreativeEngine } from '@cesdk/cesdk-js';
|
|
|
3
3
|
import type Provider from './core/provider';
|
|
4
4
|
import { Output, OutputKind, PanelInput, QuickActionSupport } from './core/provider';
|
|
5
5
|
import { Middleware } from './middleware/middleware';
|
|
6
|
+
import type { PropertiesConfiguration } from './core/propertyConfiguration';
|
|
6
7
|
/**
|
|
7
8
|
* A common configuration used by the plugins and the provider.
|
|
8
9
|
*/
|
|
@@ -72,6 +73,19 @@ export interface CommonProviderConfiguration<I, O extends Output> extends Common
|
|
|
72
73
|
supportedQuickActions?: {
|
|
73
74
|
[quickActionId: string]: Partial<QuickActionSupport<I>> | false | null;
|
|
74
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Configure property behavior and defaults
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* {
|
|
81
|
+
* properties: {
|
|
82
|
+
* style: { default: 'realistic_image' },
|
|
83
|
+
* prompt: { default: (ctx) => ctx.locale === 'de' ? 'Erstelle...' : 'Create...' }
|
|
84
|
+
* }
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
properties?: PropertiesConfiguration<I>;
|
|
75
89
|
}
|
|
76
90
|
/**
|
|
77
91
|
* Internal configuration interface for provider initialization.
|
|
@@ -96,6 +110,7 @@ export type InitializationContext<K extends OutputKind, I, O extends Output, P e
|
|
|
96
110
|
panelInput?: P;
|
|
97
111
|
options: UIOptions;
|
|
98
112
|
config: InternalPluginConfiguration<K, I, O>;
|
|
113
|
+
providerConfig?: any;
|
|
99
114
|
};
|
|
100
115
|
/**
|
|
101
116
|
* Options for UI interactions
|
|
@@ -5,5 +5,5 @@ import { Generate } from '../../generation/createGenerateFunction';
|
|
|
5
5
|
/**
|
|
6
6
|
* Creates a panel render function based on the schema definition in the provider.
|
|
7
7
|
*/
|
|
8
|
-
declare function createPanelRenderFunctionFromSchema<K extends OutputKind, I, O extends Output>({ options, provider, panelInput, config }: InitializationContext<K, I, O, PanelInputSchema<K, I>>, generate: Generate<I, O>): Promise<BuilderRenderFunction<any> | undefined>;
|
|
8
|
+
declare function createPanelRenderFunctionFromSchema<K extends OutputKind, I, O extends Output>({ options, provider, panelInput, config, providerConfig }: InitializationContext<K, I, O, PanelInputSchema<K, I>>, generate: Generate<I, O>): Promise<BuilderRenderFunction<any> | undefined>;
|
|
9
9
|
export default createPanelRenderFunctionFromSchema;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CreativeEngine } from '@cesdk/cesdk-js';
|
|
2
|
+
import type CreativeEditorSDK from '@cesdk/cesdk-js';
|
|
3
|
+
import type { PropertyContext } from '../core/propertyConfiguration';
|
|
4
|
+
/**
|
|
5
|
+
* Build the base property context from available sources
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildPropertyContext(engine: CreativeEngine, cesdk?: CreativeEditorSDK): PropertyContext;
|
|
8
|
+
/**
|
|
9
|
+
* Context cache for performance optimization
|
|
10
|
+
*/
|
|
11
|
+
export declare class PropertyContextCache {
|
|
12
|
+
private cache;
|
|
13
|
+
/**
|
|
14
|
+
* Get cached context or build new one
|
|
15
|
+
*/
|
|
16
|
+
getContext(engine: CreativeEngine, cesdk?: CreativeEditorSDK): PropertyContext;
|
|
17
|
+
/**
|
|
18
|
+
* Clear the cache (e.g., when locale changes)
|
|
19
|
+
*/
|
|
20
|
+
clear(): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PropertyConfig, PropertyContext } from '../core/propertyConfiguration';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the default value for a property
|
|
4
|
+
* @template T - The property value type
|
|
5
|
+
* @template C - The context type
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolvePropertyDefault<T, C extends PropertyContext = PropertyContext>(propertyId: string, propertyConfig: PropertyConfig<T, C> | undefined, context: C, schemaDefault?: T, fallback?: T): T | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Batch resolve multiple property defaults
|
|
10
|
+
*/
|
|
11
|
+
export declare function resolvePropertyDefaults<I, C extends PropertyContext = PropertyContext>(properties: Array<{
|
|
12
|
+
id: keyof I;
|
|
13
|
+
config?: PropertyConfig<I[keyof I], C>;
|
|
14
|
+
schemaDefault?: I[keyof I];
|
|
15
|
+
fallback?: I[keyof I];
|
|
16
|
+
}>, context: C): Partial<I>;
|