ugcinc 4.5.13 → 4.5.15
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/dist/automations/nodes/image-composer.d.ts +3 -5
- package/dist/automations/nodes/image-composer.js +16 -8
- package/dist/automations/nodes/index.d.ts +3 -0
- package/dist/automations/nodes/screenshot-animation.d.ts +6 -0
- package/dist/automations/nodes/screenshot-animation.js +26 -14
- package/dist/render/types/element.d.ts +12 -4
- package/dist/render/types/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PortValue, ImageValue } from '../types';
|
|
2
|
-
import type { ImageEditorElement, DimensionPresetKey, FitMode, DynamicCropConfig } from '../../render/types';
|
|
2
|
+
import type { ImageEditorElement, DimensionPresetKey, FitMode, DynamicCropConfig, StaticMediaItem } from '../../render/types';
|
|
3
3
|
import { type OutputMode, type SelectionMode } from './types';
|
|
4
4
|
/** Image composer inputs are dynamic (element inputRefs). Input port IDs are user-defined. */
|
|
5
5
|
export type ImageComposerNodeInputs = Record<string, PortValue | PortValue[]>;
|
|
@@ -28,10 +28,8 @@ export interface ImageEditorNodeConfig {
|
|
|
28
28
|
backgroundType?: 'image' | 'color';
|
|
29
29
|
/** Whether background image comes from a variable input port (default: true for backwards compat) */
|
|
30
30
|
backgroundIsVariable?: boolean;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/** URL for static background image */
|
|
34
|
-
backgroundMediaUrl?: string | null;
|
|
31
|
+
/** Selected media items for static background image */
|
|
32
|
+
backgroundMedia?: StaticMediaItem[];
|
|
35
33
|
/** Background color (hex) when backgroundType is 'color' */
|
|
36
34
|
backgroundColor?: string;
|
|
37
35
|
/** How the background image fits the canvas */
|
|
@@ -104,8 +104,9 @@ const definition = (0, types_1.defineNode)({
|
|
|
104
104
|
const textContent = {};
|
|
105
105
|
// Add background URL: use static URL when not variable, otherwise use preview URL
|
|
106
106
|
if (editorConfig.backgroundIsVariable === false) {
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
const url = editorConfig.backgroundMedia?.[0]?.url;
|
|
108
|
+
if (url) {
|
|
109
|
+
sources['background'] = url;
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
else {
|
|
@@ -118,8 +119,9 @@ const definition = (0, types_1.defineNode)({
|
|
|
118
119
|
for (const elem of editorConfig.elements) {
|
|
119
120
|
if (elem.type === 'image' && elem.inputId) {
|
|
120
121
|
if (elem.imageIsVariable === false) {
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
const url = elem.imageMedia?.[0]?.url;
|
|
123
|
+
if (url) {
|
|
124
|
+
sources[elem.id] = url;
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
else {
|
|
@@ -178,8 +180,11 @@ function prepareImageComposerInput(editorConfig, inputs) {
|
|
|
178
180
|
const textValues = {};
|
|
179
181
|
// Add background URL: use static URL when not variable, otherwise from inputs
|
|
180
182
|
if (editorConfig.backgroundIsVariable === false) {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
const items = editorConfig.backgroundMedia;
|
|
184
|
+
if (items?.length) {
|
|
185
|
+
const pick = items[Math.floor(Math.random() * items.length)];
|
|
186
|
+
if (pick?.url)
|
|
187
|
+
imageUrls.background = pick.url;
|
|
183
188
|
}
|
|
184
189
|
}
|
|
185
190
|
else {
|
|
@@ -192,8 +197,11 @@ function prepareImageComposerInput(editorConfig, inputs) {
|
|
|
192
197
|
for (const elem of editorConfig.elements) {
|
|
193
198
|
if (elem.type === 'image' && elem.inputId) {
|
|
194
199
|
if (elem.imageIsVariable === false) {
|
|
195
|
-
|
|
196
|
-
|
|
200
|
+
const items = elem.imageMedia;
|
|
201
|
+
if (items?.length) {
|
|
202
|
+
const pick = items[Math.floor(Math.random() * items.length)];
|
|
203
|
+
if (pick?.url)
|
|
204
|
+
imageUrls[elem.inputId] = pick.url;
|
|
197
205
|
}
|
|
198
206
|
}
|
|
199
207
|
else {
|
|
@@ -298,6 +298,9 @@ export declare const nodeDefinitions: {
|
|
|
298
298
|
};
|
|
299
299
|
readonly 'screenshot-animation': NodeDefinition<"screenshot-animation", "generator", {
|
|
300
300
|
holdDurationMs: number;
|
|
301
|
+
imageIsVariable: boolean;
|
|
302
|
+
imageMediaId: string | null;
|
|
303
|
+
imageMediaUrl: string | null;
|
|
301
304
|
outputMode: import("./types").OutputMode;
|
|
302
305
|
selectionMode: import("./types").SelectionMode | null;
|
|
303
306
|
}, import("./screenshot-animation").ScreenshotAnimationNodeInputs, import("./screenshot-animation").ScreenshotAnimationNodeOutputs, false> & {
|
|
@@ -8,6 +8,12 @@ export interface ScreenshotAnimationNodeOutputs {
|
|
|
8
8
|
}
|
|
9
9
|
declare const definition: import("./types").NodeDefinition<"screenshot-animation", "generator", {
|
|
10
10
|
holdDurationMs: number;
|
|
11
|
+
/** Whether image comes from a variable input port (default: true for backwards compat) */
|
|
12
|
+
imageIsVariable: boolean;
|
|
13
|
+
/** Media library ID for static image selection */
|
|
14
|
+
imageMediaId: string | null;
|
|
15
|
+
/** URL for static image selection */
|
|
16
|
+
imageMediaUrl: string | null;
|
|
11
17
|
outputMode: OutputMode;
|
|
12
18
|
selectionMode: SelectionMode | null;
|
|
13
19
|
}, ScreenshotAnimationNodeInputs, ScreenshotAnimationNodeOutputs, false>;
|
|
@@ -14,27 +14,39 @@ const definition = (0, types_1.defineNode)({
|
|
|
14
14
|
selectionModes: null,
|
|
15
15
|
defaults: {
|
|
16
16
|
holdDurationMs: 500,
|
|
17
|
+
/** Whether image comes from a variable input port (default: true for backwards compat) */
|
|
18
|
+
imageIsVariable: false,
|
|
19
|
+
/** Media library ID for static image selection */
|
|
20
|
+
imageMediaId: null,
|
|
21
|
+
/** URL for static image selection */
|
|
22
|
+
imageMediaUrl: null,
|
|
17
23
|
outputMode: 'per-input',
|
|
18
24
|
selectionMode: null,
|
|
19
25
|
},
|
|
20
|
-
computePorts: () =>
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
computePorts: ({ config }) => {
|
|
27
|
+
const imageIsVariable = config?.imageIsVariable ?? true;
|
|
28
|
+
const inputs = [];
|
|
29
|
+
// Only add image port when variable
|
|
30
|
+
if (imageIsVariable) {
|
|
31
|
+
inputs.push({
|
|
23
32
|
id: 'image',
|
|
24
33
|
type: 'image',
|
|
25
34
|
isArray: false,
|
|
26
35
|
required: true,
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
inputs,
|
|
40
|
+
outputs: [
|
|
41
|
+
{
|
|
42
|
+
id: 'output',
|
|
43
|
+
type: 'video',
|
|
44
|
+
isArray: false,
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
},
|
|
38
50
|
generatePreview: (_config, _ctx, cachedOutputs) => {
|
|
39
51
|
return (0, types_1.preview)({
|
|
40
52
|
output: cachedOutputs?.output ?? null,
|
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { FitMode, BorderRadiusConfig, FontType, FontWeight, TextAlignment, VerticalAlignment } from './base';
|
|
9
9
|
import type { RelativePositionConfigX, RelativePositionConfigY } from './position';
|
|
10
|
+
/**
|
|
11
|
+
* Lightweight media reference stored in editor configs.
|
|
12
|
+
* Structurally compatible with the full Media type from ugcinc.
|
|
13
|
+
*/
|
|
14
|
+
export interface StaticMediaItem {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string | null;
|
|
17
|
+
url: string | null;
|
|
18
|
+
type: string | null;
|
|
19
|
+
}
|
|
10
20
|
/**
|
|
11
21
|
* Dimension preset keys for image editor
|
|
12
22
|
*/
|
|
@@ -99,10 +109,8 @@ export interface ImageEditorElement {
|
|
|
99
109
|
inputId?: string;
|
|
100
110
|
/** Whether this image comes from a variable input port (default: true for backwards compat) */
|
|
101
111
|
imageIsVariable?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
/** URL for static image selection */
|
|
105
|
-
imageMediaUrl?: string | null;
|
|
112
|
+
/** Selected media items for static image selection */
|
|
113
|
+
imageMedia?: StaticMediaItem[];
|
|
106
114
|
/** How the image fits its container */
|
|
107
115
|
fit?: FitMode;
|
|
108
116
|
/** Opacity percentage 0-100 */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type { TimeValue, BorderRadiusConfig, FitMode, SegmentType, FontType, FontWeight, TextAlignment, VerticalAlignment, TextDirection, TextWrap, WordBreak, Hyphenation, TextOverflow, TextStyleProperties, } from './base';
|
|
8
8
|
export type { VerticalAnchor, HorizontalAnchor, HorizontalSelfAnchor, VerticalSelfAnchor, RelativePositionConfigX, RelativePositionConfigY, } from './position';
|
|
9
|
-
export type { ImageEditorElement, DimensionPresetKey, DimensionPreset, } from './element';
|
|
9
|
+
export type { ImageEditorElement, StaticMediaItem, DimensionPresetKey, DimensionPreset, } from './element';
|
|
10
10
|
export { DIMENSION_PRESETS } from './element';
|
|
11
11
|
export type { TimeMode, VideoEditorBaseSegment, VideoEditorVisualSegment, VideoEditorVideoSegment, VideoEditorAudioSegment, VideoEditorImageSegment, VideoEditorTextSegment, VideoEditorImageSequenceSegment, VideoEditorVideoSequenceSegment, VideoEditorSegment, VideoEditorChannel, VideoEditorNodeConfig, SegmentTimelinePosition, } from './video';
|
|
12
12
|
export type { BaseSegment, VisualSegment, PictureSegment, VideoSegment, ImageSegment, TextSegment, AudioSegment, ImageSequenceSegment, VideoSequenceSegment, Segment, VisualSegmentUnion, StaticSegment, } from './segment';
|