ugcinc-render 1.5.3 → 1.5.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/dist/index.js CHANGED
@@ -517,6 +517,34 @@ 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
+ }
536
+ }
537
+ ),
538
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: textStyle, children: segment.text })
539
+ ] }) });
540
+ }
541
+ if (autoWidth) {
542
+ 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: {
543
+ ...textStyle,
544
+ width,
545
+ boxSizing: "border-box"
546
+ }, children: segment.text }) }) });
547
+ }
520
548
  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
549
  }
522
550
 
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,34 @@ 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
+ }
462
+ }
463
+ ),
464
+ /* @__PURE__ */ jsx("div", { style: textStyle, children: segment.text })
465
+ ] }) });
466
+ }
467
+ if (autoWidth) {
468
+ return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx("div", { style: { width: calculatedWidth, maxWidth: width }, children: /* @__PURE__ */ jsx("div", { style: {
469
+ ...textStyle,
470
+ width,
471
+ boxSizing: "border-box"
472
+ }, children: segment.text }) }) });
473
+ }
446
474
  return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx("div", { style: backgroundBoxStyle, children: /* @__PURE__ */ jsx("div", { style: textStyle, children: segment.text }) }) });
447
475
  }
448
476
 
@@ -950,7 +978,7 @@ function isDynamicCropEnabled(dynamicCrop) {
950
978
  }
951
979
 
952
980
  // src/compositions/ImageEditorComposition.tsx
953
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
981
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
954
982
  function getSortedSegments(config) {
955
983
  const allSegments = [];
956
984
  for (const channel of config.channels) {
@@ -1086,7 +1114,7 @@ function ImageEditorComposition({
1086
1114
  return void 0;
1087
1115
  };
1088
1116
  const containerBgColor = backgroundType === "color" && backgroundColor ? backgroundColor : "#000000";
1089
- return /* @__PURE__ */ jsx3(AbsoluteFill, { style: { backgroundColor: containerBgColor }, children: /* @__PURE__ */ jsxs(
1117
+ return /* @__PURE__ */ jsx3(AbsoluteFill, { style: { backgroundColor: containerBgColor }, children: /* @__PURE__ */ jsxs2(
1090
1118
  "div",
1091
1119
  {
1092
1120
  style: {
@@ -1260,7 +1288,7 @@ function VideoElement({
1260
1288
  }
1261
1289
 
1262
1290
  // src/compositions/VideoEditorComposition.tsx
1263
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
1291
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1264
1292
  function calculateSegmentTimings(config, fps) {
1265
1293
  const timings = [];
1266
1294
  const timingsMap = /* @__PURE__ */ new Map();
@@ -1364,7 +1392,7 @@ function VideoEditorComposition({
1364
1392
  const audioTimings = useMemo5(() => {
1365
1393
  return segmentTimings.filter(({ segment }) => segment.type === "audio");
1366
1394
  }, [segmentTimings]);
1367
- return /* @__PURE__ */ jsxs2(AbsoluteFill2, { style: { backgroundColor: "#000000" }, children: [
1395
+ return /* @__PURE__ */ jsxs3(AbsoluteFill2, { style: { backgroundColor: "#000000" }, children: [
1368
1396
  activeVisualSegments.map(({ segment, startFrame, durationInFrames: durationInFrames2 }) => {
1369
1397
  if (segment.type === "text") {
1370
1398
  const textSegment = segment;
@@ -1680,7 +1708,7 @@ function useResolvedPositions(elements, textValues) {
1680
1708
 
1681
1709
  // src/Root.tsx
1682
1710
  import { Composition } from "remotion";
1683
- import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
1711
+ import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1684
1712
  var defaultImageProps = {
1685
1713
  config: {
1686
1714
  width: 1080,
@@ -1704,7 +1732,7 @@ var defaultVideoProps = {
1704
1732
  var ImageComp = ImageEditorComposition;
1705
1733
  var VideoComp = VideoEditorComposition;
1706
1734
  var RenderRoot = () => {
1707
- return /* @__PURE__ */ jsxs3(Fragment, { children: [
1735
+ return /* @__PURE__ */ jsxs4(Fragment, { children: [
1708
1736
  /* @__PURE__ */ jsx6(
1709
1737
  Composition,
1710
1738
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc-render",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
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",