@imgly/plugin-ai-generation-web 0.2.2 → 0.2.4
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 +219 -11
- package/dist/__tests__/mergeQuickActionsConfig.test.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +4 -4
- package/dist/openapi/defaultTranslations.d.ts +11 -0
- package/dist/openapi/extractSchemaTranslations.d.ts +11 -0
- package/dist/openapi/renderProperty.d.ts +1 -1
- package/dist/types.d.ts +18 -1
- package/dist/utils/mergeQuickActionsConfig.d.ts +10 -0
- package/package.json +1 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default translations for AI generation properties and enum values.
|
|
3
|
+
* These are automatically applied as fallback translations for all AI providers.
|
|
4
|
+
*
|
|
5
|
+
* Structure:
|
|
6
|
+
* - Property translations: `ly.img.plugin-ai-generation-web.defaults.property.${property.id}`
|
|
7
|
+
* - Enum value translations: `ly.img.plugin-ai-generation-web.defaults.property.${property.id}.${enumValue}`
|
|
8
|
+
*
|
|
9
|
+
* Based on actual OpenAPI Input schemas from all AI provider packages.
|
|
10
|
+
*/
|
|
11
|
+
export declare const defaultTranslations: Record<string, string>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Property } from './types';
|
|
2
|
+
import Provider, { Output, OutputKind } from '../core/provider';
|
|
3
|
+
import { UIOptions } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Extracts translations from OpenAPI schema properties and sets them via cesdk.i18n
|
|
6
|
+
* This includes:
|
|
7
|
+
* - Schema property titles as `ly.img.plugin-ai-${kind}-generation-web.${provider.id}.defaults.property.${property.id}`
|
|
8
|
+
* - Enum value labels as `ly.img.plugin-ai-${kind}-generation-web.${provider.id}.defaults.property.${property.id}.${valueId}`
|
|
9
|
+
* - AnyOf enum value labels with the same pattern
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractAndSetSchemaTranslations<K extends OutputKind, I, O extends Output>(properties: Property[], provider: Provider<K, I, O>, options: UIOptions, kind: K): void;
|
|
@@ -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
|
|
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;
|
|
6
6
|
export default renderProperty;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type CreativeEditorSDK from '@cesdk/cesdk-js';
|
|
2
2
|
import { type CreativeEngine } from '@cesdk/cesdk-js';
|
|
3
3
|
import type Provider from './core/provider';
|
|
4
|
-
import { Output, OutputKind, PanelInput } from './core/provider';
|
|
4
|
+
import { Output, OutputKind, PanelInput, QuickActionSupport } from './core/provider';
|
|
5
5
|
import { Middleware } from './middleware/middleware';
|
|
6
6
|
/**
|
|
7
7
|
* A common configuration used by the plugins and the provider.
|
|
@@ -55,6 +55,23 @@ export interface CommonProviderConfiguration<I, O extends Output> extends Common
|
|
|
55
55
|
* @deprecated Use `middlewares` instead.
|
|
56
56
|
*/
|
|
57
57
|
middleware?: Middleware<I, O>[];
|
|
58
|
+
/**
|
|
59
|
+
* Override provider's default history asset source that is used to show the generation history
|
|
60
|
+
*
|
|
61
|
+
* - false: Disable history storage
|
|
62
|
+
* - '@imgly/local': Use temporary local storage (not persistent)
|
|
63
|
+
* - '@imgly/indexedDB': Use browser storage that is persistent across sessions in the same browser
|
|
64
|
+
* - string: Use your own custom asset source ID
|
|
65
|
+
*/
|
|
66
|
+
history?: false | '@imgly/local' | '@imgly/indexedDB' | (string & {});
|
|
67
|
+
/**
|
|
68
|
+
* Configure supported quick actions
|
|
69
|
+
* - Set to false/null to disable a quick action
|
|
70
|
+
* - Partial<QuickActionSupport<I>> to override the default configuration
|
|
71
|
+
*/
|
|
72
|
+
supportedQuickActions?: {
|
|
73
|
+
[quickActionId: string]: Partial<QuickActionSupport<I>> | false | null;
|
|
74
|
+
};
|
|
58
75
|
}
|
|
59
76
|
/**
|
|
60
77
|
* Internal configuration interface for provider initialization.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Merge quick actions configuration by combining provider defaults with user configuration overrides
|
|
3
|
+
*
|
|
4
|
+
* @param providerDefaults - The default quick actions from the provider
|
|
5
|
+
* @param userConfig - The user's configuration overrides
|
|
6
|
+
* @returns Merged quick actions configuration
|
|
7
|
+
*/
|
|
8
|
+
export declare function mergeQuickActionsConfig<T extends Record<string, any>>(providerDefaults: T, userConfig?: {
|
|
9
|
+
[quickActionId: string]: any | false | null;
|
|
10
|
+
}): T;
|