ugcinc-render 1.4.0 → 1.5.0
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/index.d.mts +55 -18
- package/dist/index.d.ts +55 -18
- package/dist/index.js +2 -3
- package/dist/index.mjs +2 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -337,27 +337,47 @@ interface ImageEditorNodeConfig {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
/**
|
|
340
|
-
* Video editor types for
|
|
340
|
+
* Video editor types for the WEBAPP UI
|
|
341
|
+
*
|
|
342
|
+
* These types include UI-only fields (marked with comments).
|
|
343
|
+
* The renderer uses types from editor.ts and segment.ts instead.
|
|
344
|
+
*
|
|
345
|
+
* UI-only fields are stripped before sending to renderer:
|
|
346
|
+
* - timeMode: UI helper for displaying timing mode
|
|
347
|
+
* - inputRef/textInputRef: Resolved to source/text before rendering
|
|
348
|
+
* - dimensionPreset: Renderer uses width/height directly
|
|
349
|
+
* - previewUrls/previewTextValues: Only for UI preview
|
|
341
350
|
*/
|
|
342
351
|
|
|
343
352
|
/**
|
|
344
|
-
* UI helper for timing mode
|
|
353
|
+
* UI helper for timing mode - not sent to renderer
|
|
345
354
|
*/
|
|
346
355
|
type TimeMode = 'fixed' | 'flexible';
|
|
347
356
|
/**
|
|
348
|
-
* Base properties for all video editor segments
|
|
357
|
+
* Base properties for all video editor segments (UI)
|
|
349
358
|
*/
|
|
350
359
|
interface VideoEditorBaseSegment {
|
|
360
|
+
/** Unique segment identifier */
|
|
351
361
|
id: string;
|
|
362
|
+
/** Order in the channel (0-based) */
|
|
352
363
|
order: number;
|
|
364
|
+
/** Time offset from previous segment or absolute position */
|
|
353
365
|
offset: TimeValue;
|
|
366
|
+
/** Segment duration - required for sequential playback */
|
|
354
367
|
duration?: TimeValue;
|
|
368
|
+
/** Trim from start in milliseconds */
|
|
355
369
|
startTrim?: number;
|
|
370
|
+
/** Trim from end in milliseconds */
|
|
356
371
|
endTrim?: number;
|
|
372
|
+
/** UI-only: helper for timing mode display - stripped before rendering */
|
|
357
373
|
timeMode?: TimeMode;
|
|
374
|
+
/** Parent segment ID for overlays */
|
|
358
375
|
parentId?: string;
|
|
376
|
+
/** Relative start (0-1) within parent for overlays */
|
|
359
377
|
relativeStart?: number;
|
|
378
|
+
/** Relative end (0-1) within parent for overlays */
|
|
360
379
|
relativeEnd?: number;
|
|
380
|
+
/** Fade-in duration in milliseconds */
|
|
361
381
|
fadeIn?: number;
|
|
362
382
|
}
|
|
363
383
|
/**
|
|
@@ -374,11 +394,13 @@ interface VideoEditorVisualSegment extends VideoEditorBaseSegment {
|
|
|
374
394
|
opacity?: number;
|
|
375
395
|
}
|
|
376
396
|
/**
|
|
377
|
-
* Video segment
|
|
397
|
+
* Video segment (UI)
|
|
378
398
|
*/
|
|
379
399
|
interface VideoEditorVideoSegment extends VideoEditorVisualSegment {
|
|
380
400
|
type: 'video';
|
|
401
|
+
/** UI-only: reference to input node - resolved to source before rendering */
|
|
381
402
|
inputRef?: string;
|
|
403
|
+
/** Actual source URL (set after inputRef is resolved) */
|
|
382
404
|
source?: string;
|
|
383
405
|
fit?: FitMode;
|
|
384
406
|
speed?: number;
|
|
@@ -386,31 +408,37 @@ interface VideoEditorVideoSegment extends VideoEditorVisualSegment {
|
|
|
386
408
|
borderRadius?: number | BorderRadiusConfig;
|
|
387
409
|
}
|
|
388
410
|
/**
|
|
389
|
-
* Audio segment
|
|
411
|
+
* Audio segment (UI)
|
|
390
412
|
*/
|
|
391
413
|
interface VideoEditorAudioSegment extends VideoEditorBaseSegment {
|
|
392
414
|
type: 'audio';
|
|
415
|
+
/** UI-only: reference to input node - resolved to source before rendering */
|
|
393
416
|
inputRef?: string;
|
|
417
|
+
/** Actual source URL (set after inputRef is resolved) */
|
|
394
418
|
source?: string;
|
|
395
419
|
volume?: number;
|
|
396
420
|
}
|
|
397
421
|
/**
|
|
398
|
-
* Image segment
|
|
422
|
+
* Image segment (UI)
|
|
399
423
|
*/
|
|
400
424
|
interface VideoEditorImageSegment extends VideoEditorVisualSegment {
|
|
401
425
|
type: 'image';
|
|
426
|
+
/** UI-only: reference to input node - resolved to source before rendering */
|
|
402
427
|
inputRef?: string;
|
|
428
|
+
/** Actual source URL (set after inputRef is resolved) */
|
|
403
429
|
source?: string;
|
|
404
430
|
fit?: FitMode;
|
|
405
431
|
loop?: boolean;
|
|
406
432
|
borderRadius?: number | BorderRadiusConfig;
|
|
407
433
|
}
|
|
408
434
|
/**
|
|
409
|
-
* Text segment
|
|
435
|
+
* Text segment (UI)
|
|
410
436
|
*/
|
|
411
437
|
interface VideoEditorTextSegment extends VideoEditorVisualSegment {
|
|
412
438
|
type: 'text';
|
|
439
|
+
/** UI-only: reference to text input - resolved to text before rendering */
|
|
413
440
|
textInputRef?: string;
|
|
441
|
+
/** Actual text content (set after textInputRef is resolved) */
|
|
414
442
|
text?: string;
|
|
415
443
|
alignment?: 'left' | 'center' | 'right' | 'justify';
|
|
416
444
|
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
@@ -445,16 +473,25 @@ interface VideoEditorChannel {
|
|
|
445
473
|
segments: VideoEditorSegment[];
|
|
446
474
|
}
|
|
447
475
|
/**
|
|
448
|
-
* Video editor node configuration
|
|
476
|
+
* Video editor node configuration for WEBAPP UI
|
|
477
|
+
*
|
|
478
|
+
* Duration is NOT stored - it's calculated from segment durations.
|
|
479
|
+
* dimensionPreset, previewUrls, previewTextValues are UI-only.
|
|
449
480
|
*/
|
|
450
481
|
interface VideoEditorNodeConfig {
|
|
482
|
+
/** Canvas width in pixels */
|
|
451
483
|
width: number;
|
|
484
|
+
/** Canvas height in pixels */
|
|
452
485
|
height: number;
|
|
486
|
+
/** Frames per second */
|
|
453
487
|
fps: number;
|
|
454
|
-
|
|
488
|
+
/** UI-only: dimension preset selector */
|
|
455
489
|
dimensionPreset: DimensionPresetKey;
|
|
490
|
+
/** Channels containing segments */
|
|
456
491
|
channels: VideoEditorChannel[];
|
|
492
|
+
/** UI-only: preview URLs for displaying in editor */
|
|
457
493
|
previewUrls?: Record<string, string>;
|
|
494
|
+
/** UI-only: preview text values for displaying in editor */
|
|
458
495
|
previewTextValues?: Record<string, string>;
|
|
459
496
|
}
|
|
460
497
|
/**
|
|
@@ -644,15 +681,16 @@ type VisualSegmentUnion = VideoSegment | ImageSegment | TextSegment;
|
|
|
644
681
|
type StaticSegment = ImageSegment | TextSegment;
|
|
645
682
|
|
|
646
683
|
/**
|
|
647
|
-
* Editor configuration types
|
|
684
|
+
* Editor configuration types for RENDERING
|
|
685
|
+
*
|
|
686
|
+
* These types define what the renderer receives.
|
|
687
|
+
* Duration is always calculated from segments - there is no duration field.
|
|
648
688
|
*
|
|
649
|
-
*
|
|
650
|
-
* timing, and channels containing segments.
|
|
689
|
+
* Note: UI-specific types (with previewUrls, dimensionPreset, etc.) are in video.ts
|
|
651
690
|
*/
|
|
652
691
|
|
|
653
692
|
/**
|
|
654
|
-
* A channel (track) containing segments
|
|
655
|
-
* Channels allow for parallel playback of segments
|
|
693
|
+
* A channel (track) containing segments for rendering
|
|
656
694
|
*/
|
|
657
695
|
interface Channel<T extends Segment = Segment> {
|
|
658
696
|
/** Unique channel identifier */
|
|
@@ -661,17 +699,16 @@ interface Channel<T extends Segment = Segment> {
|
|
|
661
699
|
segments: T[];
|
|
662
700
|
}
|
|
663
701
|
/**
|
|
664
|
-
* Base editor configuration
|
|
702
|
+
* Base editor configuration for rendering
|
|
703
|
+
* Duration is calculated from segments, not stored.
|
|
665
704
|
*/
|
|
666
705
|
interface BaseEditorConfig {
|
|
667
706
|
/** Canvas width in pixels */
|
|
668
707
|
width: number;
|
|
669
708
|
/** Canvas height in pixels */
|
|
670
709
|
height: number;
|
|
671
|
-
/** Frames per second
|
|
710
|
+
/** Frames per second */
|
|
672
711
|
fps: number;
|
|
673
|
-
/** Total duration in milliseconds (auto-calculated if 0 or undefined) */
|
|
674
|
-
duration?: number;
|
|
675
712
|
}
|
|
676
713
|
/**
|
|
677
714
|
* Full editor configuration with all segment types
|
package/dist/index.d.ts
CHANGED
|
@@ -337,27 +337,47 @@ interface ImageEditorNodeConfig {
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
/**
|
|
340
|
-
* Video editor types for
|
|
340
|
+
* Video editor types for the WEBAPP UI
|
|
341
|
+
*
|
|
342
|
+
* These types include UI-only fields (marked with comments).
|
|
343
|
+
* The renderer uses types from editor.ts and segment.ts instead.
|
|
344
|
+
*
|
|
345
|
+
* UI-only fields are stripped before sending to renderer:
|
|
346
|
+
* - timeMode: UI helper for displaying timing mode
|
|
347
|
+
* - inputRef/textInputRef: Resolved to source/text before rendering
|
|
348
|
+
* - dimensionPreset: Renderer uses width/height directly
|
|
349
|
+
* - previewUrls/previewTextValues: Only for UI preview
|
|
341
350
|
*/
|
|
342
351
|
|
|
343
352
|
/**
|
|
344
|
-
* UI helper for timing mode
|
|
353
|
+
* UI helper for timing mode - not sent to renderer
|
|
345
354
|
*/
|
|
346
355
|
type TimeMode = 'fixed' | 'flexible';
|
|
347
356
|
/**
|
|
348
|
-
* Base properties for all video editor segments
|
|
357
|
+
* Base properties for all video editor segments (UI)
|
|
349
358
|
*/
|
|
350
359
|
interface VideoEditorBaseSegment {
|
|
360
|
+
/** Unique segment identifier */
|
|
351
361
|
id: string;
|
|
362
|
+
/** Order in the channel (0-based) */
|
|
352
363
|
order: number;
|
|
364
|
+
/** Time offset from previous segment or absolute position */
|
|
353
365
|
offset: TimeValue;
|
|
366
|
+
/** Segment duration - required for sequential playback */
|
|
354
367
|
duration?: TimeValue;
|
|
368
|
+
/** Trim from start in milliseconds */
|
|
355
369
|
startTrim?: number;
|
|
370
|
+
/** Trim from end in milliseconds */
|
|
356
371
|
endTrim?: number;
|
|
372
|
+
/** UI-only: helper for timing mode display - stripped before rendering */
|
|
357
373
|
timeMode?: TimeMode;
|
|
374
|
+
/** Parent segment ID for overlays */
|
|
358
375
|
parentId?: string;
|
|
376
|
+
/** Relative start (0-1) within parent for overlays */
|
|
359
377
|
relativeStart?: number;
|
|
378
|
+
/** Relative end (0-1) within parent for overlays */
|
|
360
379
|
relativeEnd?: number;
|
|
380
|
+
/** Fade-in duration in milliseconds */
|
|
361
381
|
fadeIn?: number;
|
|
362
382
|
}
|
|
363
383
|
/**
|
|
@@ -374,11 +394,13 @@ interface VideoEditorVisualSegment extends VideoEditorBaseSegment {
|
|
|
374
394
|
opacity?: number;
|
|
375
395
|
}
|
|
376
396
|
/**
|
|
377
|
-
* Video segment
|
|
397
|
+
* Video segment (UI)
|
|
378
398
|
*/
|
|
379
399
|
interface VideoEditorVideoSegment extends VideoEditorVisualSegment {
|
|
380
400
|
type: 'video';
|
|
401
|
+
/** UI-only: reference to input node - resolved to source before rendering */
|
|
381
402
|
inputRef?: string;
|
|
403
|
+
/** Actual source URL (set after inputRef is resolved) */
|
|
382
404
|
source?: string;
|
|
383
405
|
fit?: FitMode;
|
|
384
406
|
speed?: number;
|
|
@@ -386,31 +408,37 @@ interface VideoEditorVideoSegment extends VideoEditorVisualSegment {
|
|
|
386
408
|
borderRadius?: number | BorderRadiusConfig;
|
|
387
409
|
}
|
|
388
410
|
/**
|
|
389
|
-
* Audio segment
|
|
411
|
+
* Audio segment (UI)
|
|
390
412
|
*/
|
|
391
413
|
interface VideoEditorAudioSegment extends VideoEditorBaseSegment {
|
|
392
414
|
type: 'audio';
|
|
415
|
+
/** UI-only: reference to input node - resolved to source before rendering */
|
|
393
416
|
inputRef?: string;
|
|
417
|
+
/** Actual source URL (set after inputRef is resolved) */
|
|
394
418
|
source?: string;
|
|
395
419
|
volume?: number;
|
|
396
420
|
}
|
|
397
421
|
/**
|
|
398
|
-
* Image segment
|
|
422
|
+
* Image segment (UI)
|
|
399
423
|
*/
|
|
400
424
|
interface VideoEditorImageSegment extends VideoEditorVisualSegment {
|
|
401
425
|
type: 'image';
|
|
426
|
+
/** UI-only: reference to input node - resolved to source before rendering */
|
|
402
427
|
inputRef?: string;
|
|
428
|
+
/** Actual source URL (set after inputRef is resolved) */
|
|
403
429
|
source?: string;
|
|
404
430
|
fit?: FitMode;
|
|
405
431
|
loop?: boolean;
|
|
406
432
|
borderRadius?: number | BorderRadiusConfig;
|
|
407
433
|
}
|
|
408
434
|
/**
|
|
409
|
-
* Text segment
|
|
435
|
+
* Text segment (UI)
|
|
410
436
|
*/
|
|
411
437
|
interface VideoEditorTextSegment extends VideoEditorVisualSegment {
|
|
412
438
|
type: 'text';
|
|
439
|
+
/** UI-only: reference to text input - resolved to text before rendering */
|
|
413
440
|
textInputRef?: string;
|
|
441
|
+
/** Actual text content (set after textInputRef is resolved) */
|
|
414
442
|
text?: string;
|
|
415
443
|
alignment?: 'left' | 'center' | 'right' | 'justify';
|
|
416
444
|
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
@@ -445,16 +473,25 @@ interface VideoEditorChannel {
|
|
|
445
473
|
segments: VideoEditorSegment[];
|
|
446
474
|
}
|
|
447
475
|
/**
|
|
448
|
-
* Video editor node configuration
|
|
476
|
+
* Video editor node configuration for WEBAPP UI
|
|
477
|
+
*
|
|
478
|
+
* Duration is NOT stored - it's calculated from segment durations.
|
|
479
|
+
* dimensionPreset, previewUrls, previewTextValues are UI-only.
|
|
449
480
|
*/
|
|
450
481
|
interface VideoEditorNodeConfig {
|
|
482
|
+
/** Canvas width in pixels */
|
|
451
483
|
width: number;
|
|
484
|
+
/** Canvas height in pixels */
|
|
452
485
|
height: number;
|
|
486
|
+
/** Frames per second */
|
|
453
487
|
fps: number;
|
|
454
|
-
|
|
488
|
+
/** UI-only: dimension preset selector */
|
|
455
489
|
dimensionPreset: DimensionPresetKey;
|
|
490
|
+
/** Channels containing segments */
|
|
456
491
|
channels: VideoEditorChannel[];
|
|
492
|
+
/** UI-only: preview URLs for displaying in editor */
|
|
457
493
|
previewUrls?: Record<string, string>;
|
|
494
|
+
/** UI-only: preview text values for displaying in editor */
|
|
458
495
|
previewTextValues?: Record<string, string>;
|
|
459
496
|
}
|
|
460
497
|
/**
|
|
@@ -644,15 +681,16 @@ type VisualSegmentUnion = VideoSegment | ImageSegment | TextSegment;
|
|
|
644
681
|
type StaticSegment = ImageSegment | TextSegment;
|
|
645
682
|
|
|
646
683
|
/**
|
|
647
|
-
* Editor configuration types
|
|
684
|
+
* Editor configuration types for RENDERING
|
|
685
|
+
*
|
|
686
|
+
* These types define what the renderer receives.
|
|
687
|
+
* Duration is always calculated from segments - there is no duration field.
|
|
648
688
|
*
|
|
649
|
-
*
|
|
650
|
-
* timing, and channels containing segments.
|
|
689
|
+
* Note: UI-specific types (with previewUrls, dimensionPreset, etc.) are in video.ts
|
|
651
690
|
*/
|
|
652
691
|
|
|
653
692
|
/**
|
|
654
|
-
* A channel (track) containing segments
|
|
655
|
-
* Channels allow for parallel playback of segments
|
|
693
|
+
* A channel (track) containing segments for rendering
|
|
656
694
|
*/
|
|
657
695
|
interface Channel<T extends Segment = Segment> {
|
|
658
696
|
/** Unique channel identifier */
|
|
@@ -661,17 +699,16 @@ interface Channel<T extends Segment = Segment> {
|
|
|
661
699
|
segments: T[];
|
|
662
700
|
}
|
|
663
701
|
/**
|
|
664
|
-
* Base editor configuration
|
|
702
|
+
* Base editor configuration for rendering
|
|
703
|
+
* Duration is calculated from segments, not stored.
|
|
665
704
|
*/
|
|
666
705
|
interface BaseEditorConfig {
|
|
667
706
|
/** Canvas width in pixels */
|
|
668
707
|
width: number;
|
|
669
708
|
/** Canvas height in pixels */
|
|
670
709
|
height: number;
|
|
671
|
-
/** Frames per second
|
|
710
|
+
/** Frames per second */
|
|
672
711
|
fps: number;
|
|
673
|
-
/** Total duration in milliseconds (auto-calculated if 0 or undefined) */
|
|
674
|
-
duration?: number;
|
|
675
712
|
}
|
|
676
713
|
/**
|
|
677
714
|
* Full editor configuration with all segment types
|
package/dist/index.js
CHANGED
|
@@ -1245,9 +1245,9 @@ function calculateSegmentTimings(config, fps) {
|
|
|
1245
1245
|
const startFrame = currentFrame + offsetFrames;
|
|
1246
1246
|
let durationMs;
|
|
1247
1247
|
if (segment.duration) {
|
|
1248
|
-
durationMs = segment.duration.type === "absolute" ? segment.duration.value :
|
|
1248
|
+
durationMs = segment.duration.type === "absolute" ? segment.duration.value : 5e3;
|
|
1249
1249
|
} else {
|
|
1250
|
-
durationMs =
|
|
1250
|
+
durationMs = 5e3;
|
|
1251
1251
|
}
|
|
1252
1252
|
const durationInFrames = Math.max(1, Math.round(durationMs / 1e3 * fps));
|
|
1253
1253
|
const endFrame = startFrame + durationInFrames;
|
|
@@ -1666,7 +1666,6 @@ var defaultVideoProps = {
|
|
|
1666
1666
|
width: 1080,
|
|
1667
1667
|
height: 1920,
|
|
1668
1668
|
fps: 30,
|
|
1669
|
-
duration: 5e3,
|
|
1670
1669
|
channels: []
|
|
1671
1670
|
},
|
|
1672
1671
|
sources: {},
|
package/dist/index.mjs
CHANGED
|
@@ -1171,9 +1171,9 @@ function calculateSegmentTimings(config, fps) {
|
|
|
1171
1171
|
const startFrame = currentFrame + offsetFrames;
|
|
1172
1172
|
let durationMs;
|
|
1173
1173
|
if (segment.duration) {
|
|
1174
|
-
durationMs = segment.duration.type === "absolute" ? segment.duration.value :
|
|
1174
|
+
durationMs = segment.duration.type === "absolute" ? segment.duration.value : 5e3;
|
|
1175
1175
|
} else {
|
|
1176
|
-
durationMs =
|
|
1176
|
+
durationMs = 5e3;
|
|
1177
1177
|
}
|
|
1178
1178
|
const durationInFrames = Math.max(1, Math.round(durationMs / 1e3 * fps));
|
|
1179
1179
|
const endFrame = startFrame + durationInFrames;
|
|
@@ -1592,7 +1592,6 @@ var defaultVideoProps = {
|
|
|
1592
1592
|
width: 1080,
|
|
1593
1593
|
height: 1920,
|
|
1594
1594
|
fps: 30,
|
|
1595
|
-
duration: 5e3,
|
|
1596
1595
|
channels: []
|
|
1597
1596
|
},
|
|
1598
1597
|
sources: {},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ugcinc-render",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Unified rendering package for UGC Inc - shared types, components, and compositions for pixel-perfect client/server rendering",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|