ugcinc-render 1.5.30 → 1.5.31

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
@@ -388,51 +388,6 @@ function hexToRgba(hex, opacity = 100) {
388
388
  return `rgba(${r}, ${g}, ${b}, ${opacity / 100})`;
389
389
  }
390
390
 
391
- // src/utils/emoji.ts
392
- var APPLE_EMOJI_CDN_BASE = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64/";
393
- function emojiToUnified(emoji) {
394
- const codePoints = [];
395
- for (const codePoint of emoji) {
396
- const hex = codePoint.codePointAt(0)?.toString(16);
397
- if (hex) {
398
- codePoints.push(hex);
399
- }
400
- }
401
- return codePoints.join("-");
402
- }
403
- function getAppleEmojiUrl(emoji) {
404
- const unified = emojiToUnified(emoji);
405
- return `${APPLE_EMOJI_CDN_BASE}${unified}.png`;
406
- }
407
- var EMOJI_REGEX = /(?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F)(?:\p{Emoji_Modifier}|\uFE0F|\u200D(?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F)(?:\p{Emoji_Modifier})?)*|\p{Regional_Indicator}{2}/gu;
408
- function splitTextAndEmojis(text) {
409
- const segments = [];
410
- let lastIndex = 0;
411
- EMOJI_REGEX.lastIndex = 0;
412
- let match;
413
- while ((match = EMOJI_REGEX.exec(text)) !== null) {
414
- if (match.index > lastIndex) {
415
- segments.push({
416
- type: "text",
417
- content: text.slice(lastIndex, match.index)
418
- });
419
- }
420
- segments.push({
421
- type: "emoji",
422
- content: match[0],
423
- imageUrl: getAppleEmojiUrl(match[0])
424
- });
425
- lastIndex = match.index + match[0].length;
426
- }
427
- if (lastIndex < text.length) {
428
- segments.push({
429
- type: "text",
430
- content: text.slice(lastIndex)
431
- });
432
- }
433
- return segments;
434
- }
435
-
436
391
  // src/components/TextElement.tsx
437
392
  var import_jsx_runtime = require("react/jsx-runtime");
438
393
  function calculateAutoWidthAndLines({
@@ -731,37 +686,9 @@ function TextElement({ segment, scale = 1 }) {
731
686
  autoWidth,
732
687
  verticalAlign
733
688
  ]);
734
- const hasStroke = strokeWidth > 0 && strokeColor;
735
- const renderTextWithEmojis = (text) => {
736
- if (!hasStroke) {
737
- return text;
738
- }
739
- const segments = splitTextAndEmojis(text);
740
- if (segments.every((s) => s.type === "text")) {
741
- return text;
742
- }
743
- return segments.map((segment2, i) => {
744
- if (segment2.type === "text") {
745
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Fragment, { children: segment2.content }, i);
746
- }
747
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
748
- "span",
749
- {
750
- style: {
751
- textShadow: "none",
752
- WebkitTextStroke: "initial",
753
- // Ensure emoji renders properly
754
- display: "inline"
755
- },
756
- children: segment2.content
757
- },
758
- i
759
- );
760
- });
761
- };
762
689
  if (autoWidth) {
763
690
  const textContent = calculatedLines.map((line, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.default.Fragment, { children: [
764
- renderTextWithEmojis(line),
691
+ line,
765
692
  index < calculatedLines.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})
766
693
  ] }, index));
767
694
  if (backgroundColor) {
@@ -780,7 +707,7 @@ function TextElement({ segment, scale = 1 }) {
780
707
  }
781
708
  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: textStyle, children: textContent }) }) });
782
709
  }
783
- 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: renderTextWithEmojis(segment.text) }) }) });
710
+ 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 }) }) });
784
711
  }
785
712
 
786
713
  // src/components/ImageElement.tsx
@@ -1677,11 +1604,11 @@ function BackgroundImage({
1677
1604
  }
1678
1605
 
1679
1606
  // src/compositions/VideoEditorComposition.tsx
1680
- var import_react5 = require("react");
1607
+ var import_react5 = __toESM(require("react"));
1681
1608
  var import_remotion4 = require("remotion");
1682
1609
 
1683
1610
  // src/components/VideoElement.tsx
1684
- var import_react4 = require("react");
1611
+ var import_react4 = __toESM(require("react"));
1685
1612
  var import_remotion3 = require("remotion");
1686
1613
  var import_jsx_runtime4 = require("react/jsx-runtime");
1687
1614
  function fitModeToCss2(fit) {
@@ -1696,6 +1623,17 @@ function VideoElement({
1696
1623
  }) {
1697
1624
  const frame = (0, import_remotion3.useCurrentFrame)();
1698
1625
  const { fps } = (0, import_remotion3.useVideoConfig)();
1626
+ import_react4.default.useEffect(() => {
1627
+ console.log(`[VideoElement] Rendering segment ${segment.id}:`, {
1628
+ src,
1629
+ startFrame,
1630
+ durationInFrames,
1631
+ width: segment.width,
1632
+ height: segment.height,
1633
+ fit: segment.fit,
1634
+ startTrim: segment.startTrim
1635
+ });
1636
+ }, [segment, src, startFrame, durationInFrames]);
1699
1637
  const fit = segment.fit ?? VIDEO_DEFAULTS.fit;
1700
1638
  const speed = segment.speed ?? VIDEO_DEFAULTS.speed;
1701
1639
  const volume = (segment.volume ?? VIDEO_DEFAULTS.volume) / 100;
@@ -1818,6 +1756,21 @@ function VideoEditorComposition({
1818
1756
  }) {
1819
1757
  const frame = (0, import_remotion4.useCurrentFrame)();
1820
1758
  const { fps, durationInFrames } = (0, import_remotion4.useVideoConfig)();
1759
+ import_react5.default.useEffect(() => {
1760
+ console.log("[VideoEditorComposition] Mounted with:", {
1761
+ configChannels: config.channels.length,
1762
+ sources,
1763
+ textContent,
1764
+ fps,
1765
+ durationInFrames,
1766
+ segments: config.channels.flatMap((c) => c.segments.map((s) => ({
1767
+ id: s.id,
1768
+ type: s.type,
1769
+ source: s.source,
1770
+ inputRef: s.inputRef
1771
+ })))
1772
+ });
1773
+ }, [config, sources, textContent, fps, durationInFrames]);
1821
1774
  const segmentTimings = (0, import_react5.useMemo)(
1822
1775
  () => calculateSegmentTimings(config, fps),
1823
1776
  [config, fps]
@@ -1876,6 +1829,11 @@ function VideoEditorComposition({
1876
1829
  }
1877
1830
  if (segment.type === "image") {
1878
1831
  const src = getSource(segment);
1832
+ console.log(`[VideoEditorComposition] Image segment ${segment.id}:`, {
1833
+ inputRef: segment.inputRef,
1834
+ src,
1835
+ hasSource: !!src
1836
+ });
1879
1837
  if (!src) {
1880
1838
  console.warn(`No source found for image segment: ${segment.id}`);
1881
1839
  return null;
@@ -1893,6 +1851,11 @@ function VideoEditorComposition({
1893
1851
  }
1894
1852
  if (segment.type === "video") {
1895
1853
  const src = getSource(segment);
1854
+ console.log(`[VideoEditorComposition] Video segment ${segment.id}:`, {
1855
+ inputRef: segment.inputRef,
1856
+ src,
1857
+ hasSource: !!src
1858
+ });
1896
1859
  if (!src) {
1897
1860
  console.warn(`No source found for video segment: ${segment.id}`);
1898
1861
  return null;
package/dist/index.mjs CHANGED
@@ -302,51 +302,6 @@ function hexToRgba(hex, opacity = 100) {
302
302
  return `rgba(${r}, ${g}, ${b}, ${opacity / 100})`;
303
303
  }
304
304
 
305
- // src/utils/emoji.ts
306
- var APPLE_EMOJI_CDN_BASE = "https://cdn.jsdelivr.net/npm/emoji-datasource-apple/img/apple/64/";
307
- function emojiToUnified(emoji) {
308
- const codePoints = [];
309
- for (const codePoint of emoji) {
310
- const hex = codePoint.codePointAt(0)?.toString(16);
311
- if (hex) {
312
- codePoints.push(hex);
313
- }
314
- }
315
- return codePoints.join("-");
316
- }
317
- function getAppleEmojiUrl(emoji) {
318
- const unified = emojiToUnified(emoji);
319
- return `${APPLE_EMOJI_CDN_BASE}${unified}.png`;
320
- }
321
- var EMOJI_REGEX = /(?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F)(?:\p{Emoji_Modifier}|\uFE0F|\u200D(?:\p{Emoji_Presentation}|\p{Emoji}\uFE0F)(?:\p{Emoji_Modifier})?)*|\p{Regional_Indicator}{2}/gu;
322
- function splitTextAndEmojis(text) {
323
- const segments = [];
324
- let lastIndex = 0;
325
- EMOJI_REGEX.lastIndex = 0;
326
- let match;
327
- while ((match = EMOJI_REGEX.exec(text)) !== null) {
328
- if (match.index > lastIndex) {
329
- segments.push({
330
- type: "text",
331
- content: text.slice(lastIndex, match.index)
332
- });
333
- }
334
- segments.push({
335
- type: "emoji",
336
- content: match[0],
337
- imageUrl: getAppleEmojiUrl(match[0])
338
- });
339
- lastIndex = match.index + match[0].length;
340
- }
341
- if (lastIndex < text.length) {
342
- segments.push({
343
- type: "text",
344
- content: text.slice(lastIndex)
345
- });
346
- }
347
- return segments;
348
- }
349
-
350
305
  // src/components/TextElement.tsx
351
306
  import { jsx, jsxs } from "react/jsx-runtime";
352
307
  function calculateAutoWidthAndLines({
@@ -645,37 +600,9 @@ function TextElement({ segment, scale = 1 }) {
645
600
  autoWidth,
646
601
  verticalAlign
647
602
  ]);
648
- const hasStroke = strokeWidth > 0 && strokeColor;
649
- const renderTextWithEmojis = (text) => {
650
- if (!hasStroke) {
651
- return text;
652
- }
653
- const segments = splitTextAndEmojis(text);
654
- if (segments.every((s) => s.type === "text")) {
655
- return text;
656
- }
657
- return segments.map((segment2, i) => {
658
- if (segment2.type === "text") {
659
- return /* @__PURE__ */ jsx(React.Fragment, { children: segment2.content }, i);
660
- }
661
- return /* @__PURE__ */ jsx(
662
- "span",
663
- {
664
- style: {
665
- textShadow: "none",
666
- WebkitTextStroke: "initial",
667
- // Ensure emoji renders properly
668
- display: "inline"
669
- },
670
- children: segment2.content
671
- },
672
- i
673
- );
674
- });
675
- };
676
603
  if (autoWidth) {
677
604
  const textContent = calculatedLines.map((line, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
678
- renderTextWithEmojis(line),
605
+ line,
679
606
  index < calculatedLines.length - 1 && /* @__PURE__ */ jsx("br", {})
680
607
  ] }, index));
681
608
  if (backgroundColor) {
@@ -694,7 +621,7 @@ function TextElement({ segment, scale = 1 }) {
694
621
  }
695
622
  return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx("div", { style: { width: calculatedWidth, maxWidth: width }, children: /* @__PURE__ */ jsx("div", { style: textStyle, children: textContent }) }) });
696
623
  }
697
- return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx("div", { style: backgroundBoxStyle, children: /* @__PURE__ */ jsx("div", { style: textStyle, children: renderTextWithEmojis(segment.text) }) }) });
624
+ return /* @__PURE__ */ jsx("div", { style: positioningContainerStyle, children: /* @__PURE__ */ jsx("div", { style: backgroundBoxStyle, children: /* @__PURE__ */ jsx("div", { style: textStyle, children: segment.text }) }) });
698
625
  }
699
626
 
700
627
  // src/components/ImageElement.tsx
@@ -1591,11 +1518,11 @@ function BackgroundImage({
1591
1518
  }
1592
1519
 
1593
1520
  // src/compositions/VideoEditorComposition.tsx
1594
- import { useMemo as useMemo5 } from "react";
1521
+ import React5, { useMemo as useMemo5 } from "react";
1595
1522
  import { AbsoluteFill as AbsoluteFill2, useCurrentFrame as useCurrentFrame3, useVideoConfig as useVideoConfig3, Sequence, Audio } from "remotion";
1596
1523
 
1597
1524
  // src/components/VideoElement.tsx
1598
- import { useMemo as useMemo4 } from "react";
1525
+ import React4, { useMemo as useMemo4 } from "react";
1599
1526
  import { OffthreadVideo, useCurrentFrame as useCurrentFrame2, useVideoConfig as useVideoConfig2 } from "remotion";
1600
1527
  import { jsx as jsx4 } from "react/jsx-runtime";
1601
1528
  function fitModeToCss2(fit) {
@@ -1610,6 +1537,17 @@ function VideoElement({
1610
1537
  }) {
1611
1538
  const frame = useCurrentFrame2();
1612
1539
  const { fps } = useVideoConfig2();
1540
+ React4.useEffect(() => {
1541
+ console.log(`[VideoElement] Rendering segment ${segment.id}:`, {
1542
+ src,
1543
+ startFrame,
1544
+ durationInFrames,
1545
+ width: segment.width,
1546
+ height: segment.height,
1547
+ fit: segment.fit,
1548
+ startTrim: segment.startTrim
1549
+ });
1550
+ }, [segment, src, startFrame, durationInFrames]);
1613
1551
  const fit = segment.fit ?? VIDEO_DEFAULTS.fit;
1614
1552
  const speed = segment.speed ?? VIDEO_DEFAULTS.speed;
1615
1553
  const volume = (segment.volume ?? VIDEO_DEFAULTS.volume) / 100;
@@ -1732,6 +1670,21 @@ function VideoEditorComposition({
1732
1670
  }) {
1733
1671
  const frame = useCurrentFrame3();
1734
1672
  const { fps, durationInFrames } = useVideoConfig3();
1673
+ React5.useEffect(() => {
1674
+ console.log("[VideoEditorComposition] Mounted with:", {
1675
+ configChannels: config.channels.length,
1676
+ sources,
1677
+ textContent,
1678
+ fps,
1679
+ durationInFrames,
1680
+ segments: config.channels.flatMap((c) => c.segments.map((s) => ({
1681
+ id: s.id,
1682
+ type: s.type,
1683
+ source: s.source,
1684
+ inputRef: s.inputRef
1685
+ })))
1686
+ });
1687
+ }, [config, sources, textContent, fps, durationInFrames]);
1735
1688
  const segmentTimings = useMemo5(
1736
1689
  () => calculateSegmentTimings(config, fps),
1737
1690
  [config, fps]
@@ -1790,6 +1743,11 @@ function VideoEditorComposition({
1790
1743
  }
1791
1744
  if (segment.type === "image") {
1792
1745
  const src = getSource(segment);
1746
+ console.log(`[VideoEditorComposition] Image segment ${segment.id}:`, {
1747
+ inputRef: segment.inputRef,
1748
+ src,
1749
+ hasSource: !!src
1750
+ });
1793
1751
  if (!src) {
1794
1752
  console.warn(`No source found for image segment: ${segment.id}`);
1795
1753
  return null;
@@ -1807,6 +1765,11 @@ function VideoEditorComposition({
1807
1765
  }
1808
1766
  if (segment.type === "video") {
1809
1767
  const src = getSource(segment);
1768
+ console.log(`[VideoEditorComposition] Video segment ${segment.id}:`, {
1769
+ inputRef: segment.inputRef,
1770
+ src,
1771
+ hasSource: !!src
1772
+ });
1810
1773
  if (!src) {
1811
1774
  console.warn(`No source found for video segment: ${segment.id}`);
1812
1775
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc-render",
3
- "version": "1.5.30",
3
+ "version": "1.5.31",
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",