ugcinc-render 1.5.3 → 1.5.5

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.js CHANGED
@@ -517,6 +517,35 @@ function TextElement({ segment, scale = 1 }) {
517
517
  autoWidth,
518
518
  verticalAlign
519
519
  ]);
520
+ if (autoWidth && backgroundColor) {
521
+ const bgOffsetX = boxAlign === "center" ? (width - calculatedWidth) / 2 : boxAlign === "right" ? width - calculatedWidth : 0;
522
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: positioningContainerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { position: "relative", width }, children: [
523
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
524
+ "div",
525
+ {
526
+ style: {
527
+ position: "absolute",
528
+ left: bgOffsetX,
529
+ top: 0,
530
+ width: calculatedWidth,
531
+ height: "100%",
532
+ backgroundColor: hexToRgba(backgroundColor, backgroundOpacity),
533
+ borderRadius: borderRadiusStyle,
534
+ pointerEvents: "none",
535
+ zIndex: 0
536
+ }
537
+ }
538
+ ),
539
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { ...textStyle, position: "relative", zIndex: 1 }, children: segment.text })
540
+ ] }) });
541
+ }
542
+ if (autoWidth) {
543
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: positioningContainerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { width: calculatedWidth, maxWidth: width }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: {
544
+ ...textStyle,
545
+ width,
546
+ boxSizing: "border-box"
547
+ }, children: segment.text }) }) });
548
+ }
520
549
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: positioningContainerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: backgroundBoxStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: textStyle, children: segment.text }) }) });
521
550
  }
522
551
 
package/dist/index.mjs CHANGED
@@ -219,7 +219,7 @@ function hexToRgba(hex, opacity = 100) {
219
219
  }
220
220
 
221
221
  // src/components/TextElement.tsx
222
- import { jsx } from "react/jsx-runtime";
222
+ import { jsx, jsxs } from "react/jsx-runtime";
223
223
  function calculateAutoWidth({
224
224
  text,
225
225
  maxWidth,
@@ -443,6 +443,35 @@ function TextElement({ segment, scale = 1 }) {
443
443
  autoWidth,
444
444
  verticalAlign
445
445
  ]);
446
+ if (autoWidth && backgroundColor) {
447
+ const bgOffsetX = boxAlign === "center" ? (width - calculatedWidth) / 2 : boxAlign === "right" ? width - calculatedWidth : 0;
448
+ return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsxs("div", { style: { position: "relative", width }, children: [
449
+ /* @__PURE__ */ jsx(
450
+ "div",
451
+ {
452
+ style: {
453
+ position: "absolute",
454
+ left: bgOffsetX,
455
+ top: 0,
456
+ width: calculatedWidth,
457
+ height: "100%",
458
+ backgroundColor: hexToRgba(backgroundColor, backgroundOpacity),
459
+ borderRadius: borderRadiusStyle,
460
+ pointerEvents: "none",
461
+ zIndex: 0
462
+ }
463
+ }
464
+ ),
465
+ /* @__PURE__ */ jsx("div", { style: { ...textStyle, position: "relative", zIndex: 1 }, children: segment.text })
466
+ ] }) });
467
+ }
468
+ if (autoWidth) {
469
+ return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx("div", { style: { width: calculatedWidth, maxWidth: width }, children: /* @__PURE__ */ jsx("div", { style: {
470
+ ...textStyle,
471
+ width,
472
+ boxSizing: "border-box"
473
+ }, children: segment.text }) }) });
474
+ }
446
475
  return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx("div", { style: backgroundBoxStyle, children: /* @__PURE__ */ jsx("div", { style: textStyle, children: segment.text }) }) });
447
476
  }
448
477
 
@@ -950,7 +979,7 @@ function isDynamicCropEnabled(dynamicCrop) {
950
979
  }
951
980
 
952
981
  // src/compositions/ImageEditorComposition.tsx
953
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
982
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
954
983
  function getSortedSegments(config) {
955
984
  const allSegments = [];
956
985
  for (const channel of config.channels) {
@@ -1086,7 +1115,7 @@ function ImageEditorComposition({
1086
1115
  return void 0;
1087
1116
  };
1088
1117
  const containerBgColor = backgroundType === "color" && backgroundColor ? backgroundColor : "#000000";
1089
- return /* @__PURE__ */ jsx3(AbsoluteFill, { style: { backgroundColor: containerBgColor }, children: /* @__PURE__ */ jsxs(
1118
+ return /* @__PURE__ */ jsx3(AbsoluteFill, { style: { backgroundColor: containerBgColor }, children: /* @__PURE__ */ jsxs2(
1090
1119
  "div",
1091
1120
  {
1092
1121
  style: {
@@ -1260,7 +1289,7 @@ function VideoElement({
1260
1289
  }
1261
1290
 
1262
1291
  // src/compositions/VideoEditorComposition.tsx
1263
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
1292
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1264
1293
  function calculateSegmentTimings(config, fps) {
1265
1294
  const timings = [];
1266
1295
  const timingsMap = /* @__PURE__ */ new Map();
@@ -1364,7 +1393,7 @@ function VideoEditorComposition({
1364
1393
  const audioTimings = useMemo5(() => {
1365
1394
  return segmentTimings.filter(({ segment }) => segment.type === "audio");
1366
1395
  }, [segmentTimings]);
1367
- return /* @__PURE__ */ jsxs2(AbsoluteFill2, { style: { backgroundColor: "#000000" }, children: [
1396
+ return /* @__PURE__ */ jsxs3(AbsoluteFill2, { style: { backgroundColor: "#000000" }, children: [
1368
1397
  activeVisualSegments.map(({ segment, startFrame, durationInFrames: durationInFrames2 }) => {
1369
1398
  if (segment.type === "text") {
1370
1399
  const textSegment = segment;
@@ -1680,7 +1709,7 @@ function useResolvedPositions(elements, textValues) {
1680
1709
 
1681
1710
  // src/Root.tsx
1682
1711
  import { Composition } from "remotion";
1683
- import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
1712
+ import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1684
1713
  var defaultImageProps = {
1685
1714
  config: {
1686
1715
  width: 1080,
@@ -1704,7 +1733,7 @@ var defaultVideoProps = {
1704
1733
  var ImageComp = ImageEditorComposition;
1705
1734
  var VideoComp = VideoEditorComposition;
1706
1735
  var RenderRoot = () => {
1707
- return /* @__PURE__ */ jsxs3(Fragment, { children: [
1736
+ return /* @__PURE__ */ jsxs4(Fragment, { children: [
1708
1737
  /* @__PURE__ */ jsx6(
1709
1738
  Composition,
1710
1739
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc-render",
3
- "version": "1.5.3",
3
+ "version": "1.5.5",
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",