ugcinc-render 1.3.5 → 1.3.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/dist/index.d.mts +9 -11
- package/dist/index.d.ts +9 -11
- package/dist/index.js +13 -11
- package/dist/index.mjs +12 -10
- package/package.json +4 -5
package/dist/index.d.mts
CHANGED
|
@@ -762,8 +762,7 @@ interface ImageEditorCompositionProps {
|
|
|
762
762
|
*
|
|
763
763
|
* @example
|
|
764
764
|
* ```tsx
|
|
765
|
-
* import {
|
|
766
|
-
* import { ImageEditorComposition } from '@ugcinc/remotion';
|
|
765
|
+
* import { ImageEditorComposition } from 'ugcinc-render/compositions';
|
|
767
766
|
*
|
|
768
767
|
* // NEW: Pass raw elements directly (preferred)
|
|
769
768
|
* <Player
|
|
@@ -808,8 +807,7 @@ interface VideoEditorCompositionProps {
|
|
|
808
807
|
*
|
|
809
808
|
* @example
|
|
810
809
|
* ```tsx
|
|
811
|
-
* import {
|
|
812
|
-
* import { VideoEditorComposition } from '@ugcinc/remotion';
|
|
810
|
+
* import { VideoEditorComposition } from 'ugcinc-render/compositions';
|
|
813
811
|
*
|
|
814
812
|
* <Player
|
|
815
813
|
* component={VideoEditorComposition}
|
|
@@ -915,7 +913,7 @@ declare const FONT_URLS: {
|
|
|
915
913
|
};
|
|
916
914
|
};
|
|
917
915
|
/**
|
|
918
|
-
* Preload fonts for
|
|
916
|
+
* Preload fonts for rendering
|
|
919
917
|
* Call this in your Root component or composition
|
|
920
918
|
*/
|
|
921
919
|
declare function preloadFonts(): Promise<void>;
|
|
@@ -1139,7 +1137,7 @@ declare function getReferenceElementX(elements: ImageEditorElement[], elementId:
|
|
|
1139
1137
|
declare function getReferenceElementY(elements: ImageEditorElement[], elementId: string): ImageEditorElement | null;
|
|
1140
1138
|
|
|
1141
1139
|
/**
|
|
1142
|
-
* Hook exports for
|
|
1140
|
+
* Hook exports for ugcinc-render
|
|
1143
1141
|
*
|
|
1144
1142
|
* Hooks for common operations like font loading, media preloading,
|
|
1145
1143
|
* and position resolution.
|
|
@@ -1189,12 +1187,12 @@ declare function useImagePreloader(sources: Record<string, string>): {
|
|
|
1189
1187
|
declare function useResolvedPositions(elements: ImageEditorElement[], textValues?: Record<string, string>): PositionResolutionResult;
|
|
1190
1188
|
|
|
1191
1189
|
/**
|
|
1192
|
-
*
|
|
1190
|
+
* Render Root Component
|
|
1193
1191
|
*
|
|
1194
|
-
* This file registers all available compositions with
|
|
1195
|
-
* It serves as the entry point for the
|
|
1192
|
+
* This file registers all available compositions with the renderer.
|
|
1193
|
+
* It serves as the entry point for the renderer bundler.
|
|
1196
1194
|
*/
|
|
1197
1195
|
|
|
1198
|
-
declare const
|
|
1196
|
+
declare const RenderRoot: React.FC;
|
|
1199
1197
|
|
|
1200
|
-
export { type AudioSegment, type BaseEditorConfig, type BaseSegment, type BorderRadiusConfig, type Channel, type CropAxisConfig, type CropBoundary, type CropBounds, DIMENSION_PRESETS, type DimensionPreset, type DimensionPresetKey, type DynamicCropConfig, type EditorConfig, type EditorSegment, FONT_FAMILIES, FONT_URLS, type FitDimensions, type FitMode, type FontType, type FontWeight, type HorizontalAnchor, type HorizontalSelfAnchor, type Hyphenation, IMAGE_DEFAULTS, ImageEditorComposition, type ImageEditorCompositionProps, type ImageEditorConfig, type ImageEditorElement, type ImageEditorNodeConfig, ImageElement, type ImageElementProps, type ImageSegment, type PictureSegment, type PositionResolutionError, type PositionResolutionResult, type RelativePositionConfigX, type RelativePositionConfigY,
|
|
1198
|
+
export { type AudioSegment, type BaseEditorConfig, type BaseSegment, type BorderRadiusConfig, type Channel, type CropAxisConfig, type CropBoundary, type CropBounds, DIMENSION_PRESETS, type DimensionPreset, type DimensionPresetKey, type DynamicCropConfig, type EditorConfig, type EditorSegment, FONT_FAMILIES, FONT_URLS, type FitDimensions, type FitMode, type FontType, type FontWeight, type HorizontalAnchor, type HorizontalSelfAnchor, type Hyphenation, IMAGE_DEFAULTS, ImageEditorComposition, type ImageEditorCompositionProps, type ImageEditorConfig, type ImageEditorElement, type ImageEditorNodeConfig, ImageElement, type ImageElementProps, type ImageSegment, type PictureSegment, type PositionResolutionError, type PositionResolutionResult, type RelativePositionConfigX, type RelativePositionConfigY, RenderRoot, type Segment, type SegmentType, type StaticSegment, TEXT_DEFAULTS, type TextAlignment, type TextDirection, TextElement, type TextElementProps, type TextOverflow, type TextSegment, type TextWrap, type TimeMode, type TimeValue, VIDEO_DEFAULTS, VISUAL_DEFAULTS, type VerticalAlignment, type VerticalAnchor, type VerticalSelfAnchor, type VideoEditorAudioSegment, type VideoEditorBaseSegment, type VideoEditorChannel, VideoEditorComposition, type VideoEditorCompositionProps, type VideoEditorConfig, type VideoEditorImageSegment, type VideoEditorNodeConfig, type VideoEditorSegment, type VideoEditorTextSegment, type VideoEditorVideoSegment, type VideoEditorVisualSegment, VideoElement, type VideoElementProps, type VideoSegment, type VisualSegment, type VisualSegmentUnion, type WordBreak, applyImageDefaults, applyTextDefaults, applyVideoDefaults, areFontsLoaded, buildFontString, calculateAutoWidthDimensions, calculateFitDimensions, calculateLineWidth, canSetAsReference, getBorderRadii, getDependentElements, getFontFamily, getReferenceElementX, getReferenceElementY, hexToRgba, parseHexColor, preloadFonts, resolveElementPositions, useFontsLoaded, useImageLoader, useImagePreloader, useResolvedPositions, wrapText };
|
package/dist/index.d.ts
CHANGED
|
@@ -762,8 +762,7 @@ interface ImageEditorCompositionProps {
|
|
|
762
762
|
*
|
|
763
763
|
* @example
|
|
764
764
|
* ```tsx
|
|
765
|
-
* import {
|
|
766
|
-
* import { ImageEditorComposition } from '@ugcinc/remotion';
|
|
765
|
+
* import { ImageEditorComposition } from 'ugcinc-render/compositions';
|
|
767
766
|
*
|
|
768
767
|
* // NEW: Pass raw elements directly (preferred)
|
|
769
768
|
* <Player
|
|
@@ -808,8 +807,7 @@ interface VideoEditorCompositionProps {
|
|
|
808
807
|
*
|
|
809
808
|
* @example
|
|
810
809
|
* ```tsx
|
|
811
|
-
* import {
|
|
812
|
-
* import { VideoEditorComposition } from '@ugcinc/remotion';
|
|
810
|
+
* import { VideoEditorComposition } from 'ugcinc-render/compositions';
|
|
813
811
|
*
|
|
814
812
|
* <Player
|
|
815
813
|
* component={VideoEditorComposition}
|
|
@@ -915,7 +913,7 @@ declare const FONT_URLS: {
|
|
|
915
913
|
};
|
|
916
914
|
};
|
|
917
915
|
/**
|
|
918
|
-
* Preload fonts for
|
|
916
|
+
* Preload fonts for rendering
|
|
919
917
|
* Call this in your Root component or composition
|
|
920
918
|
*/
|
|
921
919
|
declare function preloadFonts(): Promise<void>;
|
|
@@ -1139,7 +1137,7 @@ declare function getReferenceElementX(elements: ImageEditorElement[], elementId:
|
|
|
1139
1137
|
declare function getReferenceElementY(elements: ImageEditorElement[], elementId: string): ImageEditorElement | null;
|
|
1140
1138
|
|
|
1141
1139
|
/**
|
|
1142
|
-
* Hook exports for
|
|
1140
|
+
* Hook exports for ugcinc-render
|
|
1143
1141
|
*
|
|
1144
1142
|
* Hooks for common operations like font loading, media preloading,
|
|
1145
1143
|
* and position resolution.
|
|
@@ -1189,12 +1187,12 @@ declare function useImagePreloader(sources: Record<string, string>): {
|
|
|
1189
1187
|
declare function useResolvedPositions(elements: ImageEditorElement[], textValues?: Record<string, string>): PositionResolutionResult;
|
|
1190
1188
|
|
|
1191
1189
|
/**
|
|
1192
|
-
*
|
|
1190
|
+
* Render Root Component
|
|
1193
1191
|
*
|
|
1194
|
-
* This file registers all available compositions with
|
|
1195
|
-
* It serves as the entry point for the
|
|
1192
|
+
* This file registers all available compositions with the renderer.
|
|
1193
|
+
* It serves as the entry point for the renderer bundler.
|
|
1196
1194
|
*/
|
|
1197
1195
|
|
|
1198
|
-
declare const
|
|
1196
|
+
declare const RenderRoot: React.FC;
|
|
1199
1197
|
|
|
1200
|
-
export { type AudioSegment, type BaseEditorConfig, type BaseSegment, type BorderRadiusConfig, type Channel, type CropAxisConfig, type CropBoundary, type CropBounds, DIMENSION_PRESETS, type DimensionPreset, type DimensionPresetKey, type DynamicCropConfig, type EditorConfig, type EditorSegment, FONT_FAMILIES, FONT_URLS, type FitDimensions, type FitMode, type FontType, type FontWeight, type HorizontalAnchor, type HorizontalSelfAnchor, type Hyphenation, IMAGE_DEFAULTS, ImageEditorComposition, type ImageEditorCompositionProps, type ImageEditorConfig, type ImageEditorElement, type ImageEditorNodeConfig, ImageElement, type ImageElementProps, type ImageSegment, type PictureSegment, type PositionResolutionError, type PositionResolutionResult, type RelativePositionConfigX, type RelativePositionConfigY,
|
|
1198
|
+
export { type AudioSegment, type BaseEditorConfig, type BaseSegment, type BorderRadiusConfig, type Channel, type CropAxisConfig, type CropBoundary, type CropBounds, DIMENSION_PRESETS, type DimensionPreset, type DimensionPresetKey, type DynamicCropConfig, type EditorConfig, type EditorSegment, FONT_FAMILIES, FONT_URLS, type FitDimensions, type FitMode, type FontType, type FontWeight, type HorizontalAnchor, type HorizontalSelfAnchor, type Hyphenation, IMAGE_DEFAULTS, ImageEditorComposition, type ImageEditorCompositionProps, type ImageEditorConfig, type ImageEditorElement, type ImageEditorNodeConfig, ImageElement, type ImageElementProps, type ImageSegment, type PictureSegment, type PositionResolutionError, type PositionResolutionResult, type RelativePositionConfigX, type RelativePositionConfigY, RenderRoot, type Segment, type SegmentType, type StaticSegment, TEXT_DEFAULTS, type TextAlignment, type TextDirection, TextElement, type TextElementProps, type TextOverflow, type TextSegment, type TextWrap, type TimeMode, type TimeValue, VIDEO_DEFAULTS, VISUAL_DEFAULTS, type VerticalAlignment, type VerticalAnchor, type VerticalSelfAnchor, type VideoEditorAudioSegment, type VideoEditorBaseSegment, type VideoEditorChannel, VideoEditorComposition, type VideoEditorCompositionProps, type VideoEditorConfig, type VideoEditorImageSegment, type VideoEditorNodeConfig, type VideoEditorSegment, type VideoEditorTextSegment, type VideoEditorVideoSegment, type VideoEditorVisualSegment, VideoElement, type VideoElementProps, type VideoSegment, type VisualSegment, type VisualSegmentUnion, type WordBreak, applyImageDefaults, applyTextDefaults, applyVideoDefaults, areFontsLoaded, buildFontString, calculateAutoWidthDimensions, calculateFitDimensions, calculateLineWidth, canSetAsReference, getBorderRadii, getDependentElements, getFontFamily, getReferenceElementX, getReferenceElementY, hexToRgba, parseHexColor, preloadFonts, resolveElementPositions, useFontsLoaded, useImageLoader, useImagePreloader, useResolvedPositions, wrapText };
|
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
IMAGE_DEFAULTS: () => IMAGE_DEFAULTS,
|
|
27
27
|
ImageEditorComposition: () => ImageEditorComposition,
|
|
28
28
|
ImageElement: () => ImageElement,
|
|
29
|
-
|
|
29
|
+
RenderRoot: () => RenderRoot,
|
|
30
30
|
TEXT_DEFAULTS: () => TEXT_DEFAULTS,
|
|
31
31
|
TextElement: () => TextElement,
|
|
32
32
|
VIDEO_DEFAULTS: () => VIDEO_DEFAULTS,
|
|
@@ -318,19 +318,15 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
318
318
|
position: "absolute",
|
|
319
319
|
left: x,
|
|
320
320
|
top: y,
|
|
321
|
-
width
|
|
322
|
-
maxWidth: width,
|
|
321
|
+
width,
|
|
323
322
|
height: autoWidth ? "auto" : height,
|
|
324
323
|
transform: rotation !== 0 ? `rotate(${rotation}deg)` : void 0,
|
|
325
324
|
transformOrigin: "center center",
|
|
326
325
|
display: "flex",
|
|
327
326
|
flexDirection: "column",
|
|
328
327
|
justifyContent: verticalAlign === "top" ? "flex-start" : verticalAlign === "bottom" ? "flex-end" : "center",
|
|
329
|
-
//
|
|
330
|
-
|
|
331
|
-
left: boxAlign === "center" ? x + width / 2 : boxAlign === "right" ? x + width : x,
|
|
332
|
-
transform: rotation !== 0 ? `translateX(${boxAlign === "center" ? "-50%" : boxAlign === "right" ? "-100%" : "0"}) rotate(${rotation}deg)` : boxAlign === "center" ? "translateX(-50%)" : boxAlign === "right" ? "translateX(-100%)" : void 0
|
|
333
|
-
}
|
|
328
|
+
// When autoWidth is enabled, align the inner content using flexbox
|
|
329
|
+
alignItems: autoWidth ? boxAlign === "center" ? "center" : boxAlign === "right" ? "flex-end" : "flex-start" : "stretch"
|
|
334
330
|
}), [x, y, width, height, rotation, verticalAlign, autoWidth, boxAlign]);
|
|
335
331
|
const backgroundStyle = (0, import_react.useMemo)(() => {
|
|
336
332
|
if (!backgroundColor) return {};
|
|
@@ -350,6 +346,11 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
350
346
|
padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
|
|
351
347
|
whiteSpace: "pre-wrap",
|
|
352
348
|
wordBreak: "break-word",
|
|
349
|
+
// When autoWidth is enabled, shrink to fit content but respect max width
|
|
350
|
+
...autoWidth && {
|
|
351
|
+
width: "fit-content",
|
|
352
|
+
maxWidth: "100%"
|
|
353
|
+
},
|
|
353
354
|
// Text stroke using text-shadow for cross-browser support
|
|
354
355
|
...strokeWidth > 0 && strokeColor && {
|
|
355
356
|
textShadow: `
|
|
@@ -379,7 +380,8 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
379
380
|
paddingBottom,
|
|
380
381
|
paddingLeft,
|
|
381
382
|
strokeWidth,
|
|
382
|
-
strokeColor
|
|
383
|
+
strokeColor,
|
|
384
|
+
autoWidth
|
|
383
385
|
]);
|
|
384
386
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...containerStyle, ...backgroundStyle }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: textStyle, children: segment.text }) });
|
|
385
387
|
}
|
|
@@ -1418,7 +1420,7 @@ var defaultVideoProps = {
|
|
|
1418
1420
|
};
|
|
1419
1421
|
var ImageComp = ImageEditorComposition;
|
|
1420
1422
|
var VideoComp = VideoEditorComposition;
|
|
1421
|
-
var
|
|
1423
|
+
var RenderRoot = () => {
|
|
1422
1424
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
1423
1425
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
1424
1426
|
import_remotion5.Composition,
|
|
@@ -1454,7 +1456,7 @@ var RemotionRoot = () => {
|
|
|
1454
1456
|
IMAGE_DEFAULTS,
|
|
1455
1457
|
ImageEditorComposition,
|
|
1456
1458
|
ImageElement,
|
|
1457
|
-
|
|
1459
|
+
RenderRoot,
|
|
1458
1460
|
TEXT_DEFAULTS,
|
|
1459
1461
|
TextElement,
|
|
1460
1462
|
VIDEO_DEFAULTS,
|
package/dist/index.mjs
CHANGED
|
@@ -257,19 +257,15 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
257
257
|
position: "absolute",
|
|
258
258
|
left: x,
|
|
259
259
|
top: y,
|
|
260
|
-
width
|
|
261
|
-
maxWidth: width,
|
|
260
|
+
width,
|
|
262
261
|
height: autoWidth ? "auto" : height,
|
|
263
262
|
transform: rotation !== 0 ? `rotate(${rotation}deg)` : void 0,
|
|
264
263
|
transformOrigin: "center center",
|
|
265
264
|
display: "flex",
|
|
266
265
|
flexDirection: "column",
|
|
267
266
|
justifyContent: verticalAlign === "top" ? "flex-start" : verticalAlign === "bottom" ? "flex-end" : "center",
|
|
268
|
-
//
|
|
269
|
-
|
|
270
|
-
left: boxAlign === "center" ? x + width / 2 : boxAlign === "right" ? x + width : x,
|
|
271
|
-
transform: rotation !== 0 ? `translateX(${boxAlign === "center" ? "-50%" : boxAlign === "right" ? "-100%" : "0"}) rotate(${rotation}deg)` : boxAlign === "center" ? "translateX(-50%)" : boxAlign === "right" ? "translateX(-100%)" : void 0
|
|
272
|
-
}
|
|
267
|
+
// When autoWidth is enabled, align the inner content using flexbox
|
|
268
|
+
alignItems: autoWidth ? boxAlign === "center" ? "center" : boxAlign === "right" ? "flex-end" : "flex-start" : "stretch"
|
|
273
269
|
}), [x, y, width, height, rotation, verticalAlign, autoWidth, boxAlign]);
|
|
274
270
|
const backgroundStyle = useMemo(() => {
|
|
275
271
|
if (!backgroundColor) return {};
|
|
@@ -289,6 +285,11 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
289
285
|
padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,
|
|
290
286
|
whiteSpace: "pre-wrap",
|
|
291
287
|
wordBreak: "break-word",
|
|
288
|
+
// When autoWidth is enabled, shrink to fit content but respect max width
|
|
289
|
+
...autoWidth && {
|
|
290
|
+
width: "fit-content",
|
|
291
|
+
maxWidth: "100%"
|
|
292
|
+
},
|
|
292
293
|
// Text stroke using text-shadow for cross-browser support
|
|
293
294
|
...strokeWidth > 0 && strokeColor && {
|
|
294
295
|
textShadow: `
|
|
@@ -318,7 +319,8 @@ function TextElement({ segment, scale = 1 }) {
|
|
|
318
319
|
paddingBottom,
|
|
319
320
|
paddingLeft,
|
|
320
321
|
strokeWidth,
|
|
321
|
-
strokeColor
|
|
322
|
+
strokeColor,
|
|
323
|
+
autoWidth
|
|
322
324
|
]);
|
|
323
325
|
return /* @__PURE__ */ jsx("div", { style: { ...containerStyle, ...backgroundStyle }, children: /* @__PURE__ */ jsx("div", { style: textStyle, children: segment.text }) });
|
|
324
326
|
}
|
|
@@ -1357,7 +1359,7 @@ var defaultVideoProps = {
|
|
|
1357
1359
|
};
|
|
1358
1360
|
var ImageComp = ImageEditorComposition;
|
|
1359
1361
|
var VideoComp = VideoEditorComposition;
|
|
1360
|
-
var
|
|
1362
|
+
var RenderRoot = () => {
|
|
1361
1363
|
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1362
1364
|
/* @__PURE__ */ jsx6(
|
|
1363
1365
|
Composition,
|
|
@@ -1392,7 +1394,7 @@ export {
|
|
|
1392
1394
|
IMAGE_DEFAULTS,
|
|
1393
1395
|
ImageEditorComposition,
|
|
1394
1396
|
ImageElement,
|
|
1395
|
-
|
|
1397
|
+
RenderRoot,
|
|
1396
1398
|
TEXT_DEFAULTS,
|
|
1397
1399
|
TextElement,
|
|
1398
1400
|
VIDEO_DEFAULTS,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ugcinc-render",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"description": "Unified
|
|
3
|
+
"version": "1.3.7",
|
|
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",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"keywords": [
|
|
41
|
-
"remotion",
|
|
42
41
|
"video-rendering",
|
|
43
42
|
"canvas",
|
|
44
|
-
"react"
|
|
43
|
+
"react",
|
|
44
|
+
"rendering"
|
|
45
45
|
],
|
|
46
46
|
"author": "UGC Inc",
|
|
47
47
|
"license": "MIT",
|
|
@@ -63,4 +63,3 @@
|
|
|
63
63
|
"typescript": "^5.3.0"
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
|