ugcinc-render 1.5.5 → 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,34 +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
- zIndex: 0
536
- }
535
+ borderRadius: borderRadiusStyle
536
+ },
537
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: autoWidthTextStyle, children: segment.text })
537
538
  }
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 }) }) });
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 }) }) });
548
542
  }
549
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 }) }) });
550
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,34 +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
- zIndex: 0
462
- }
461
+ borderRadius: borderRadiusStyle
462
+ },
463
+ children: /* @__PURE__ */ jsx("div", { style: autoWidthTextStyle, children: segment.text })
463
464
  }
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 }) }) });
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 }) }) });
474
468
  }
475
469
  return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx("div", { style: backgroundBoxStyle, children: /* @__PURE__ */ jsx("div", { style: textStyle, children: segment.text }) }) });
476
470
  }
@@ -979,7 +973,7 @@ function isDynamicCropEnabled(dynamicCrop) {
979
973
  }
980
974
 
981
975
  // src/compositions/ImageEditorComposition.tsx
982
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
976
+ import { jsx as jsx3, jsxs } from "react/jsx-runtime";
983
977
  function getSortedSegments(config) {
984
978
  const allSegments = [];
985
979
  for (const channel of config.channels) {
@@ -1115,7 +1109,7 @@ function ImageEditorComposition({
1115
1109
  return void 0;
1116
1110
  };
1117
1111
  const containerBgColor = backgroundType === "color" && backgroundColor ? backgroundColor : "#000000";
1118
- return /* @__PURE__ */ jsx3(AbsoluteFill, { style: { backgroundColor: containerBgColor }, children: /* @__PURE__ */ jsxs2(
1112
+ return /* @__PURE__ */ jsx3(AbsoluteFill, { style: { backgroundColor: containerBgColor }, children: /* @__PURE__ */ jsxs(
1119
1113
  "div",
1120
1114
  {
1121
1115
  style: {
@@ -1289,7 +1283,7 @@ function VideoElement({
1289
1283
  }
1290
1284
 
1291
1285
  // src/compositions/VideoEditorComposition.tsx
1292
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
1286
+ import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
1293
1287
  function calculateSegmentTimings(config, fps) {
1294
1288
  const timings = [];
1295
1289
  const timingsMap = /* @__PURE__ */ new Map();
@@ -1393,7 +1387,7 @@ function VideoEditorComposition({
1393
1387
  const audioTimings = useMemo5(() => {
1394
1388
  return segmentTimings.filter(({ segment }) => segment.type === "audio");
1395
1389
  }, [segmentTimings]);
1396
- return /* @__PURE__ */ jsxs3(AbsoluteFill2, { style: { backgroundColor: "#000000" }, children: [
1390
+ return /* @__PURE__ */ jsxs2(AbsoluteFill2, { style: { backgroundColor: "#000000" }, children: [
1397
1391
  activeVisualSegments.map(({ segment, startFrame, durationInFrames: durationInFrames2 }) => {
1398
1392
  if (segment.type === "text") {
1399
1393
  const textSegment = segment;
@@ -1709,7 +1703,7 @@ function useResolvedPositions(elements, textValues) {
1709
1703
 
1710
1704
  // src/Root.tsx
1711
1705
  import { Composition } from "remotion";
1712
- 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";
1713
1707
  var defaultImageProps = {
1714
1708
  config: {
1715
1709
  width: 1080,
@@ -1733,7 +1727,7 @@ var defaultVideoProps = {
1733
1727
  var ImageComp = ImageEditorComposition;
1734
1728
  var VideoComp = VideoEditorComposition;
1735
1729
  var RenderRoot = () => {
1736
- return /* @__PURE__ */ jsxs4(Fragment, { children: [
1730
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
1737
1731
  /* @__PURE__ */ jsx6(
1738
1732
  Composition,
1739
1733
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc-render",
3
- "version": "1.5.5",
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",