ugcinc-render 1.5.4 → 1.5.6

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,33 +517,28 @@ 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)(
520
+ if (autoWidth) {
521
+ const autoWidthTextAlign = boxAlign === "center" ? "center" : boxAlign === "right" ? "right" : "left";
522
+ const autoWidthTextStyle = {
523
+ ...textStyle,
524
+ // Override textAlign to match boxAlign for proper visual alignment
525
+ textAlign: autoWidthTextAlign
526
+ };
527
+ if (backgroundColor) {
528
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: positioningContainerStyle, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
524
529
  "div",
525
530
  {
526
531
  style: {
527
- position: "absolute",
528
- left: bgOffsetX,
529
- top: 0,
530
532
  width: calculatedWidth,
531
- height: "100%",
533
+ maxWidth: width,
532
534
  backgroundColor: hexToRgba(backgroundColor, backgroundOpacity),
533
- borderRadius: borderRadiusStyle,
534
- pointerEvents: "none"
535
- }
535
+ borderRadius: borderRadiusStyle
536
+ },
537
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: autoWidthTextStyle, children: segment.text })
536
538
  }
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 }) }) });
539
+ ) });
540
+ }
541
+ 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: autoWidthTextStyle, children: segment.text }) }) });
547
542
  }
548
543
  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 }) }) });
549
544
  }
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, jsxs } from "react/jsx-runtime";
222
+ import { jsx } from "react/jsx-runtime";
223
223
  function calculateAutoWidth({
224
224
  text,
225
225
  maxWidth,
@@ -443,33 +443,28 @@ 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(
446
+ if (autoWidth) {
447
+ const autoWidthTextAlign = boxAlign === "center" ? "center" : boxAlign === "right" ? "right" : "left";
448
+ const autoWidthTextStyle = {
449
+ ...textStyle,
450
+ // Override textAlign to match boxAlign for proper visual alignment
451
+ textAlign: autoWidthTextAlign
452
+ };
453
+ if (backgroundColor) {
454
+ return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx(
450
455
  "div",
451
456
  {
452
457
  style: {
453
- position: "absolute",
454
- left: bgOffsetX,
455
- top: 0,
456
458
  width: calculatedWidth,
457
- height: "100%",
459
+ maxWidth: width,
458
460
  backgroundColor: hexToRgba(backgroundColor, backgroundOpacity),
459
- borderRadius: borderRadiusStyle,
460
- pointerEvents: "none"
461
- }
461
+ borderRadius: borderRadiusStyle
462
+ },
463
+ children: /* @__PURE__ */ jsx("div", { style: autoWidthTextStyle, children: segment.text })
462
464
  }
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 }) }) });
465
+ ) });
466
+ }
467
+ return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx("div", { style: { width: calculatedWidth, maxWidth: width }, children: /* @__PURE__ */ jsx("div", { style: autoWidthTextStyle, children: segment.text }) }) });
473
468
  }
474
469
  return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx("div", { style: backgroundBoxStyle, children: /* @__PURE__ */ jsx("div", { style: textStyle, children: segment.text }) }) });
475
470
  }
@@ -978,7 +973,7 @@ function isDynamicCropEnabled(dynamicCrop) {
978
973
  }
979
974
 
980
975
  // src/compositions/ImageEditorComposition.tsx
981
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
976
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
982
977
  function getSortedSegments(config) {
983
978
  const allSegments = [];
984
979
  for (const channel of config.channels) {
@@ -1114,7 +1109,7 @@ function ImageEditorComposition({
1114
1109
  return void 0;
1115
1110
  };
1116
1111
  const containerBgColor = backgroundType === "color" && backgroundColor ? backgroundColor : "#000000";
1117
- return /* @__PURE__ */ jsx3(AbsoluteFill, { style: { backgroundColor: containerBgColor }, children: /* @__PURE__ */ jsxs2(
1112
+ return /* @__PURE__ */ jsx3(AbsoluteFill, { style: { backgroundColor: containerBgColor }, children: /* @__PURE__ */ jsxs(
1118
1113
  "div",
1119
1114
  {
1120
1115
  style: {
@@ -1288,7 +1283,7 @@ function VideoElement({
1288
1283
  }
1289
1284
 
1290
1285
  // src/compositions/VideoEditorComposition.tsx
1291
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1286
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
1292
1287
  function calculateSegmentTimings(config, fps) {
1293
1288
  const timings = [];
1294
1289
  const timingsMap = /* @__PURE__ */ new Map();
@@ -1392,7 +1387,7 @@ function VideoEditorComposition({
1392
1387
  const audioTimings = useMemo5(() => {
1393
1388
  return segmentTimings.filter(({ segment }) => segment.type === "audio");
1394
1389
  }, [segmentTimings]);
1395
- return /* @__PURE__ */ jsxs3(AbsoluteFill2, { style: { backgroundColor: "#000000" }, children: [
1390
+ return /* @__PURE__ */ jsxs2(AbsoluteFill2, { style: { backgroundColor: "#000000" }, children: [
1396
1391
  activeVisualSegments.map(({ segment, startFrame, durationInFrames: durationInFrames2 }) => {
1397
1392
  if (segment.type === "text") {
1398
1393
  const textSegment = segment;
@@ -1708,7 +1703,7 @@ function useResolvedPositions(elements, textValues) {
1708
1703
 
1709
1704
  // src/Root.tsx
1710
1705
  import { Composition } from "remotion";
1711
- import { Fragment, jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
1706
+ import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
1712
1707
  var defaultImageProps = {
1713
1708
  config: {
1714
1709
  width: 1080,
@@ -1732,7 +1727,7 @@ var defaultVideoProps = {
1732
1727
  var ImageComp = ImageEditorComposition;
1733
1728
  var VideoComp = VideoEditorComposition;
1734
1729
  var RenderRoot = () => {
1735
- return /* @__PURE__ */ jsxs4(Fragment, { children: [
1730
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
1736
1731
  /* @__PURE__ */ jsx6(
1737
1732
  Composition,
1738
1733
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc-render",
3
- "version": "1.5.4",
3
+ "version": "1.5.6",
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",