ugcinc-render 1.8.101 → 1.8.103
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 +34 -11
- package/dist/index.mjs +34 -11
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3544,7 +3544,7 @@ var DEFAULTS2 = {
|
|
|
3544
3544
|
bubbleRadiusGrouped: 12,
|
|
3545
3545
|
messageGapInGroup: 6,
|
|
3546
3546
|
messageGapSameUser: 35,
|
|
3547
|
-
messageGapDifferentUser:
|
|
3547
|
+
messageGapDifferentUser: 37,
|
|
3548
3548
|
recipientBubbleLeft: 168,
|
|
3549
3549
|
senderBubbleRight: 1182,
|
|
3550
3550
|
bubbleMaxWidth: 866,
|
|
@@ -3576,6 +3576,25 @@ function getInterpolatedSenderColor(bubbleCenter, messageAreaTop, messageAreaBot
|
|
|
3576
3576
|
return interpolateColor(gradientMiddle, gradientTop, (t - 0.5) * 2);
|
|
3577
3577
|
}
|
|
3578
3578
|
}
|
|
3579
|
+
var FONT_FAMILY = '"SF Pro", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif';
|
|
3580
|
+
function measureTextWidth(text, fontSize) {
|
|
3581
|
+
const measureSpan = document.createElement("span");
|
|
3582
|
+
measureSpan.style.cssText = `
|
|
3583
|
+
position: absolute;
|
|
3584
|
+
visibility: hidden;
|
|
3585
|
+
pointer-events: none;
|
|
3586
|
+
font-family: ${FONT_FAMILY};
|
|
3587
|
+
font-size: ${fontSize}px;
|
|
3588
|
+
font-weight: 400;
|
|
3589
|
+
letter-spacing: 0px;
|
|
3590
|
+
white-space: nowrap;
|
|
3591
|
+
`;
|
|
3592
|
+
document.body.appendChild(measureSpan);
|
|
3593
|
+
measureSpan.textContent = text;
|
|
3594
|
+
const width = measureSpan.getBoundingClientRect().width;
|
|
3595
|
+
document.body.removeChild(measureSpan);
|
|
3596
|
+
return width;
|
|
3597
|
+
}
|
|
3579
3598
|
function IgMessages({
|
|
3580
3599
|
messages = [],
|
|
3581
3600
|
messageAreaTop = DEFAULTS2.messageAreaTop,
|
|
@@ -3629,15 +3648,19 @@ function IgMessages({
|
|
|
3629
3648
|
gap = messageGapDifferentUser;
|
|
3630
3649
|
}
|
|
3631
3650
|
}
|
|
3632
|
-
const
|
|
3633
|
-
const
|
|
3634
|
-
|
|
3651
|
+
const actualTextWidth = measureTextWidth(message.text, messageFontSize);
|
|
3652
|
+
const fitsOnSingleLine = actualTextWidth <= maxTextWidth;
|
|
3653
|
+
let lineCount;
|
|
3654
|
+
if (fitsOnSingleLine) {
|
|
3655
|
+
lineCount = 1;
|
|
3656
|
+
} else {
|
|
3657
|
+
lineCount = Math.ceil(actualTextWidth / maxTextWidth);
|
|
3658
|
+
}
|
|
3635
3659
|
const textHeight = lineCount * messageLineHeight;
|
|
3636
3660
|
const bubbleHeight = textHeight + messagePaddingTop + messagePaddingBottom;
|
|
3637
3661
|
let bubbleWidth;
|
|
3638
|
-
if (
|
|
3639
|
-
|
|
3640
|
-
bubbleWidth = Math.min(estimatedTextWidth + messagePaddingLeft + messagePaddingRight, bubbleMaxWidth);
|
|
3662
|
+
if (fitsOnSingleLine) {
|
|
3663
|
+
bubbleWidth = actualTextWidth + messagePaddingLeft + messagePaddingRight;
|
|
3641
3664
|
} else {
|
|
3642
3665
|
bubbleWidth = bubbleMaxWidth;
|
|
3643
3666
|
}
|
|
@@ -3797,7 +3820,7 @@ function IgMessages({
|
|
|
3797
3820
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3798
3821
|
var defaultInstagramDmProps = {
|
|
3799
3822
|
showDebugOverlay: true,
|
|
3800
|
-
referenceImageUrl: "https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/8ff1462b-13d7-4abe-9325-0a6ad19004f0/
|
|
3823
|
+
referenceImageUrl: "https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/8ff1462b-13d7-4abe-9325-0a6ad19004f0/IMG_3177-twSYuZPHRoxH9PA2xhpDUeKIg2ny7p.png",
|
|
3801
3824
|
showReferenceImage: true,
|
|
3802
3825
|
referenceOpacity: 50,
|
|
3803
3826
|
width: 1206,
|
|
@@ -3892,7 +3915,7 @@ var defaultInstagramDmProps = {
|
|
|
3892
3915
|
bubbleRadiusGrouped: 12,
|
|
3893
3916
|
messageGapInGroup: DEFAULTS2.messageGapInGroup,
|
|
3894
3917
|
messageGapSameUser: DEFAULTS2.messageGapSameUser,
|
|
3895
|
-
messageGapDifferentUser:
|
|
3918
|
+
messageGapDifferentUser: 37,
|
|
3896
3919
|
recipientBubbleLeft: DEFAULTS2.recipientBubbleLeft,
|
|
3897
3920
|
senderBubbleRight: DEFAULTS2.senderBubbleRight,
|
|
3898
3921
|
bubbleMaxWidth: DEFAULTS2.bubbleMaxWidth,
|
|
@@ -5178,7 +5201,7 @@ var instagramDmSchema = import_zod.z.object({
|
|
|
5178
5201
|
// Debug overlay
|
|
5179
5202
|
showDebugOverlay: import_zod.z.boolean().optional().default(true).describe("Show debug overlay with mouse coordinates"),
|
|
5180
5203
|
// Reference overlay
|
|
5181
|
-
referenceImageUrl: import_zod.z.string().optional().default("https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/8ff1462b-13d7-4abe-9325-0a6ad19004f0/
|
|
5204
|
+
referenceImageUrl: import_zod.z.string().optional().default("https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/8ff1462b-13d7-4abe-9325-0a6ad19004f0/IMG_3177-twSYuZPHRoxH9PA2xhpDUeKIg2ny7p.png").describe("Reference screenshot URL"),
|
|
5182
5205
|
showReferenceImage: import_zod.z.boolean().optional().default(true).describe("Show/hide reference image"),
|
|
5183
5206
|
referenceOpacity: import_zod.z.number().min(0).max(100).optional().default(50).describe("Reference overlay opacity (0-100)"),
|
|
5184
5207
|
// Canvas
|
|
@@ -5270,7 +5293,7 @@ var instagramDmSchema = import_zod.z.object({
|
|
|
5270
5293
|
// Message spacing
|
|
5271
5294
|
messageGapInGroup: import_zod.z.number().optional().default(6).describe("Gap between messages in group"),
|
|
5272
5295
|
messageGapSameUser: import_zod.z.number().optional().default(35).describe("Gap between messages from same user"),
|
|
5273
|
-
messageGapDifferentUser: import_zod.z.number().optional().default(
|
|
5296
|
+
messageGapDifferentUser: import_zod.z.number().optional().default(37).describe("Gap between messages from different users"),
|
|
5274
5297
|
// Bubble positioning
|
|
5275
5298
|
recipientBubbleLeft: import_zod.z.number().optional().default(168).describe("Recipient bubble left X"),
|
|
5276
5299
|
senderBubbleRight: import_zod.z.number().optional().default(1182).describe("Sender bubble right X"),
|
package/dist/index.mjs
CHANGED
|
@@ -2613,7 +2613,7 @@ var DEFAULTS2 = {
|
|
|
2613
2613
|
bubbleRadiusGrouped: 12,
|
|
2614
2614
|
messageGapInGroup: 6,
|
|
2615
2615
|
messageGapSameUser: 35,
|
|
2616
|
-
messageGapDifferentUser:
|
|
2616
|
+
messageGapDifferentUser: 37,
|
|
2617
2617
|
recipientBubbleLeft: 168,
|
|
2618
2618
|
senderBubbleRight: 1182,
|
|
2619
2619
|
bubbleMaxWidth: 866,
|
|
@@ -2645,6 +2645,25 @@ function getInterpolatedSenderColor(bubbleCenter, messageAreaTop, messageAreaBot
|
|
|
2645
2645
|
return interpolateColor(gradientMiddle, gradientTop, (t - 0.5) * 2);
|
|
2646
2646
|
}
|
|
2647
2647
|
}
|
|
2648
|
+
var FONT_FAMILY = '"SF Pro", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif';
|
|
2649
|
+
function measureTextWidth(text, fontSize) {
|
|
2650
|
+
const measureSpan = document.createElement("span");
|
|
2651
|
+
measureSpan.style.cssText = `
|
|
2652
|
+
position: absolute;
|
|
2653
|
+
visibility: hidden;
|
|
2654
|
+
pointer-events: none;
|
|
2655
|
+
font-family: ${FONT_FAMILY};
|
|
2656
|
+
font-size: ${fontSize}px;
|
|
2657
|
+
font-weight: 400;
|
|
2658
|
+
letter-spacing: 0px;
|
|
2659
|
+
white-space: nowrap;
|
|
2660
|
+
`;
|
|
2661
|
+
document.body.appendChild(measureSpan);
|
|
2662
|
+
measureSpan.textContent = text;
|
|
2663
|
+
const width = measureSpan.getBoundingClientRect().width;
|
|
2664
|
+
document.body.removeChild(measureSpan);
|
|
2665
|
+
return width;
|
|
2666
|
+
}
|
|
2648
2667
|
function IgMessages({
|
|
2649
2668
|
messages = [],
|
|
2650
2669
|
messageAreaTop = DEFAULTS2.messageAreaTop,
|
|
@@ -2698,15 +2717,19 @@ function IgMessages({
|
|
|
2698
2717
|
gap = messageGapDifferentUser;
|
|
2699
2718
|
}
|
|
2700
2719
|
}
|
|
2701
|
-
const
|
|
2702
|
-
const
|
|
2703
|
-
|
|
2720
|
+
const actualTextWidth = measureTextWidth(message.text, messageFontSize);
|
|
2721
|
+
const fitsOnSingleLine = actualTextWidth <= maxTextWidth;
|
|
2722
|
+
let lineCount;
|
|
2723
|
+
if (fitsOnSingleLine) {
|
|
2724
|
+
lineCount = 1;
|
|
2725
|
+
} else {
|
|
2726
|
+
lineCount = Math.ceil(actualTextWidth / maxTextWidth);
|
|
2727
|
+
}
|
|
2704
2728
|
const textHeight = lineCount * messageLineHeight;
|
|
2705
2729
|
const bubbleHeight = textHeight + messagePaddingTop + messagePaddingBottom;
|
|
2706
2730
|
let bubbleWidth;
|
|
2707
|
-
if (
|
|
2708
|
-
|
|
2709
|
-
bubbleWidth = Math.min(estimatedTextWidth + messagePaddingLeft + messagePaddingRight, bubbleMaxWidth);
|
|
2731
|
+
if (fitsOnSingleLine) {
|
|
2732
|
+
bubbleWidth = actualTextWidth + messagePaddingLeft + messagePaddingRight;
|
|
2710
2733
|
} else {
|
|
2711
2734
|
bubbleWidth = bubbleMaxWidth;
|
|
2712
2735
|
}
|
|
@@ -2866,7 +2889,7 @@ function IgMessages({
|
|
|
2866
2889
|
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2867
2890
|
var defaultInstagramDmProps = {
|
|
2868
2891
|
showDebugOverlay: true,
|
|
2869
|
-
referenceImageUrl: "https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/8ff1462b-13d7-4abe-9325-0a6ad19004f0/
|
|
2892
|
+
referenceImageUrl: "https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/8ff1462b-13d7-4abe-9325-0a6ad19004f0/IMG_3177-twSYuZPHRoxH9PA2xhpDUeKIg2ny7p.png",
|
|
2870
2893
|
showReferenceImage: true,
|
|
2871
2894
|
referenceOpacity: 50,
|
|
2872
2895
|
width: 1206,
|
|
@@ -2961,7 +2984,7 @@ var defaultInstagramDmProps = {
|
|
|
2961
2984
|
bubbleRadiusGrouped: 12,
|
|
2962
2985
|
messageGapInGroup: DEFAULTS2.messageGapInGroup,
|
|
2963
2986
|
messageGapSameUser: DEFAULTS2.messageGapSameUser,
|
|
2964
|
-
messageGapDifferentUser:
|
|
2987
|
+
messageGapDifferentUser: 37,
|
|
2965
2988
|
recipientBubbleLeft: DEFAULTS2.recipientBubbleLeft,
|
|
2966
2989
|
senderBubbleRight: DEFAULTS2.senderBubbleRight,
|
|
2967
2990
|
bubbleMaxWidth: DEFAULTS2.bubbleMaxWidth,
|
|
@@ -3964,7 +3987,7 @@ var instagramDmSchema = z.object({
|
|
|
3964
3987
|
// Debug overlay
|
|
3965
3988
|
showDebugOverlay: z.boolean().optional().default(true).describe("Show debug overlay with mouse coordinates"),
|
|
3966
3989
|
// Reference overlay
|
|
3967
|
-
referenceImageUrl: z.string().optional().default("https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/8ff1462b-13d7-4abe-9325-0a6ad19004f0/
|
|
3990
|
+
referenceImageUrl: z.string().optional().default("https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/8ff1462b-13d7-4abe-9325-0a6ad19004f0/IMG_3177-twSYuZPHRoxH9PA2xhpDUeKIg2ny7p.png").describe("Reference screenshot URL"),
|
|
3968
3991
|
showReferenceImage: z.boolean().optional().default(true).describe("Show/hide reference image"),
|
|
3969
3992
|
referenceOpacity: z.number().min(0).max(100).optional().default(50).describe("Reference overlay opacity (0-100)"),
|
|
3970
3993
|
// Canvas
|
|
@@ -4056,7 +4079,7 @@ var instagramDmSchema = z.object({
|
|
|
4056
4079
|
// Message spacing
|
|
4057
4080
|
messageGapInGroup: z.number().optional().default(6).describe("Gap between messages in group"),
|
|
4058
4081
|
messageGapSameUser: z.number().optional().default(35).describe("Gap between messages from same user"),
|
|
4059
|
-
messageGapDifferentUser: z.number().optional().default(
|
|
4082
|
+
messageGapDifferentUser: z.number().optional().default(37).describe("Gap between messages from different users"),
|
|
4060
4083
|
// Bubble positioning
|
|
4061
4084
|
recipientBubbleLeft: z.number().optional().default(168).describe("Recipient bubble left X"),
|
|
4062
4085
|
senderBubbleRight: z.number().optional().default(1182).describe("Sender bubble right X"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ugcinc-render",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.103",
|
|
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",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@remotion/player": "^4.0.0",
|
|
59
|
-
"ugcinc-render": "^1.8.
|
|
59
|
+
"ugcinc-render": "^1.8.101",
|
|
60
60
|
"zod": "^3.22.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|