ugcinc-render 1.8.161 → 1.8.162
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.d.mts +15 -14
- package/dist/index.d.ts +15 -14
- package/dist/index.js +194 -108
- package/dist/index.mjs +194 -108
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1080,25 +1080,26 @@ interface IMessageDmCompositionProps {
|
|
|
1080
1080
|
messageTextLetterSpacing?: number;
|
|
1081
1081
|
messageTextColor?: string;
|
|
1082
1082
|
messageText?: string;
|
|
1083
|
+
messageAreaTop?: number;
|
|
1084
|
+
messageAreaBottom?: number;
|
|
1083
1085
|
senderBubbleColor?: string;
|
|
1084
1086
|
recipientBubbleColor?: string;
|
|
1085
1087
|
bubbleTextColor?: string;
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1088
|
+
messageFontSize?: number;
|
|
1089
|
+
messageLineHeight?: number;
|
|
1090
|
+
messageLetterSpacing?: number;
|
|
1091
|
+
messagePaddingTop?: number;
|
|
1092
|
+
messagePaddingBottom?: number;
|
|
1093
|
+
messagePaddingLeft?: number;
|
|
1094
|
+
messagePaddingRight?: number;
|
|
1095
|
+
bubbleRadiusNormal?: number;
|
|
1096
|
+
bubbleRadiusGrouped?: number;
|
|
1097
|
+
messageGapInGroup?: number;
|
|
1093
1098
|
messageGapSameUser?: number;
|
|
1094
1099
|
messageGapDifferentUser?: number;
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
receivedMessagePaddingRight?: number;
|
|
1099
|
-
multiLineSentMessagePaddingLeft?: number;
|
|
1100
|
-
multiLineReceivedMessagePaddingRight?: number;
|
|
1101
|
-
messagesAnchorY?: number;
|
|
1100
|
+
recipientBubbleLeft?: number;
|
|
1101
|
+
senderBubbleRight?: number;
|
|
1102
|
+
bubbleMaxWidth?: number;
|
|
1102
1103
|
messages?: ImMessage[];
|
|
1103
1104
|
}
|
|
1104
1105
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1080,25 +1080,26 @@ interface IMessageDmCompositionProps {
|
|
|
1080
1080
|
messageTextLetterSpacing?: number;
|
|
1081
1081
|
messageTextColor?: string;
|
|
1082
1082
|
messageText?: string;
|
|
1083
|
+
messageAreaTop?: number;
|
|
1084
|
+
messageAreaBottom?: number;
|
|
1083
1085
|
senderBubbleColor?: string;
|
|
1084
1086
|
recipientBubbleColor?: string;
|
|
1085
1087
|
bubbleTextColor?: string;
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1088
|
+
messageFontSize?: number;
|
|
1089
|
+
messageLineHeight?: number;
|
|
1090
|
+
messageLetterSpacing?: number;
|
|
1091
|
+
messagePaddingTop?: number;
|
|
1092
|
+
messagePaddingBottom?: number;
|
|
1093
|
+
messagePaddingLeft?: number;
|
|
1094
|
+
messagePaddingRight?: number;
|
|
1095
|
+
bubbleRadiusNormal?: number;
|
|
1096
|
+
bubbleRadiusGrouped?: number;
|
|
1097
|
+
messageGapInGroup?: number;
|
|
1093
1098
|
messageGapSameUser?: number;
|
|
1094
1099
|
messageGapDifferentUser?: number;
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
receivedMessagePaddingRight?: number;
|
|
1099
|
-
multiLineSentMessagePaddingLeft?: number;
|
|
1100
|
-
multiLineReceivedMessagePaddingRight?: number;
|
|
1101
|
-
messagesAnchorY?: number;
|
|
1100
|
+
recipientBubbleLeft?: number;
|
|
1101
|
+
senderBubbleRight?: number;
|
|
1102
|
+
bubbleMaxWidth?: number;
|
|
1102
1103
|
messages?: ImMessage[];
|
|
1103
1104
|
}
|
|
1104
1105
|
|
package/dist/index.js
CHANGED
|
@@ -5255,22 +5255,32 @@ var import_remotion10 = require("remotion");
|
|
|
5255
5255
|
|
|
5256
5256
|
// src/compositions/IMessageDmComposition/convertPropsToElements.ts
|
|
5257
5257
|
var MESSAGE_DEFAULTS2 = {
|
|
5258
|
+
// Message area bounds
|
|
5259
|
+
messageAreaTop: 450,
|
|
5260
|
+
messageAreaBottom: 2310,
|
|
5261
|
+
// Message colors
|
|
5258
5262
|
senderBubbleColor: "#1a42d5",
|
|
5259
5263
|
recipientBubbleColor: "#303032",
|
|
5260
5264
|
bubbleTextColor: "#ffffff",
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
|
|
5264
|
-
|
|
5265
|
-
|
|
5266
|
-
|
|
5265
|
+
// Message typography
|
|
5266
|
+
messageFontSize: 48,
|
|
5267
|
+
messageLineHeight: 60,
|
|
5268
|
+
messageLetterSpacing: 0.5,
|
|
5269
|
+
// Message padding (inside bubble)
|
|
5270
|
+
messagePaddingTop: 20,
|
|
5271
|
+
messagePaddingBottom: 20,
|
|
5272
|
+
messagePaddingLeft: 39,
|
|
5273
|
+
messagePaddingRight: 39,
|
|
5274
|
+
// Bubble corner radii
|
|
5275
|
+
bubbleRadiusNormal: 40,
|
|
5276
|
+
bubbleRadiusGrouped: 10,
|
|
5277
|
+
// Message spacing
|
|
5278
|
+
messageGapInGroup: 6,
|
|
5267
5279
|
messageGapSameUser: 8,
|
|
5268
5280
|
messageGapDifferentUser: 36,
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
receivedMessagePaddingRight: 270,
|
|
5273
|
-
messagesAnchorY: 2310,
|
|
5281
|
+
// Bubble positioning
|
|
5282
|
+
recipientBubbleLeft: 48,
|
|
5283
|
+
senderBubbleRight: 1178,
|
|
5274
5284
|
bubbleMaxWidth: 900,
|
|
5275
5285
|
// Image message defaults
|
|
5276
5286
|
imageMaxWidth: 600,
|
|
@@ -5375,133 +5385,193 @@ function calculateAutoWidthAndLines3({
|
|
|
5375
5385
|
function calculateMessagePositions2(props) {
|
|
5376
5386
|
const messages = props.messages ?? [];
|
|
5377
5387
|
if (messages.length === 0) return [];
|
|
5378
|
-
const
|
|
5379
|
-
const
|
|
5388
|
+
const messageAreaBottom = props.messageAreaBottom ?? MESSAGE_DEFAULTS2.messageAreaBottom;
|
|
5389
|
+
const messageFontSize = props.messageFontSize ?? MESSAGE_DEFAULTS2.messageFontSize;
|
|
5390
|
+
const messageLineHeight = props.messageLineHeight ?? MESSAGE_DEFAULTS2.messageLineHeight;
|
|
5391
|
+
const messageLetterSpacing = props.messageLetterSpacing ?? MESSAGE_DEFAULTS2.messageLetterSpacing;
|
|
5392
|
+
const messagePaddingTop = props.messagePaddingTop ?? MESSAGE_DEFAULTS2.messagePaddingTop;
|
|
5393
|
+
const messagePaddingBottom = props.messagePaddingBottom ?? MESSAGE_DEFAULTS2.messagePaddingBottom;
|
|
5394
|
+
const messagePaddingLeft = props.messagePaddingLeft ?? MESSAGE_DEFAULTS2.messagePaddingLeft;
|
|
5395
|
+
const messagePaddingRight = props.messagePaddingRight ?? MESSAGE_DEFAULTS2.messagePaddingRight;
|
|
5396
|
+
const messageGapInGroup = props.messageGapInGroup ?? MESSAGE_DEFAULTS2.messageGapInGroup;
|
|
5380
5397
|
const messageGapSameUser = props.messageGapSameUser ?? MESSAGE_DEFAULTS2.messageGapSameUser;
|
|
5381
5398
|
const messageGapDifferentUser = props.messageGapDifferentUser ?? MESSAGE_DEFAULTS2.messageGapDifferentUser;
|
|
5382
|
-
const
|
|
5383
|
-
const
|
|
5384
|
-
const bubbleTextFontSize = props.bubbleTextFontSize ?? MESSAGE_DEFAULTS2.bubbleTextFontSize;
|
|
5385
|
-
const bubbleTextLetterSpacing = props.bubbleTextLetterSpacing ?? MESSAGE_DEFAULTS2.bubbleTextLetterSpacing;
|
|
5386
|
-
const bubbleTextLineHeight = props.bubbleTextLineHeight ?? MESSAGE_DEFAULTS2.bubbleTextLineHeight;
|
|
5399
|
+
const recipientBubbleLeft = props.recipientBubbleLeft ?? MESSAGE_DEFAULTS2.recipientBubbleLeft;
|
|
5400
|
+
const senderBubbleRight = props.senderBubbleRight ?? MESSAGE_DEFAULTS2.senderBubbleRight;
|
|
5387
5401
|
const bubbleMaxWidth = props.bubbleMaxWidth ?? MESSAGE_DEFAULTS2.bubbleMaxWidth;
|
|
5388
5402
|
const imageMaxWidth = MESSAGE_DEFAULTS2.imageMaxWidth;
|
|
5389
5403
|
const imageAspectRatio = MESSAGE_DEFAULTS2.imageAspectRatio;
|
|
5390
5404
|
const imageGapToText = MESSAGE_DEFAULTS2.imageGapToText;
|
|
5391
5405
|
const calculatedMessages = [];
|
|
5392
|
-
let
|
|
5406
|
+
let currentBottom = messageAreaBottom;
|
|
5393
5407
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
5394
|
-
const
|
|
5395
|
-
if (!
|
|
5396
|
-
const
|
|
5397
|
-
|
|
5408
|
+
const message = messages[i];
|
|
5409
|
+
if (!message) continue;
|
|
5410
|
+
const prevMessage = i > 0 ? messages[i - 1] : null;
|
|
5411
|
+
const nextMessage = i < messages.length - 1 ? messages[i + 1] : null;
|
|
5412
|
+
const isGroupedWithPrev = message.groupWithPrevious && prevMessage?.sender === message.sender;
|
|
5413
|
+
const isGroupedWithNext = nextMessage?.groupWithPrevious && nextMessage?.sender === message.sender;
|
|
5414
|
+
const isFirstInGroup = !isGroupedWithPrev;
|
|
5415
|
+
const isLastInGroup = !isGroupedWithNext;
|
|
5416
|
+
const isSingleMessage = isFirstInGroup && isLastInGroup;
|
|
5417
|
+
let gap = 0;
|
|
5418
|
+
if (i < messages.length - 1) {
|
|
5419
|
+
const belowMessage = messages[i + 1];
|
|
5420
|
+
if (belowMessage?.groupWithPrevious && belowMessage.sender === message.sender) {
|
|
5421
|
+
gap = messageGapInGroup;
|
|
5422
|
+
} else if (belowMessage?.sender === message.sender) {
|
|
5423
|
+
gap = messageGapSameUser;
|
|
5424
|
+
} else {
|
|
5425
|
+
gap = messageGapDifferentUser;
|
|
5426
|
+
}
|
|
5427
|
+
}
|
|
5428
|
+
const { width: bubbleWidth, lines } = calculateAutoWidthAndLines3({
|
|
5429
|
+
text: message.text,
|
|
5398
5430
|
maxWidth: bubbleMaxWidth,
|
|
5399
|
-
paddingLeft:
|
|
5400
|
-
paddingRight:
|
|
5401
|
-
fontSize:
|
|
5402
|
-
letterSpacing:
|
|
5431
|
+
paddingLeft: messagePaddingLeft,
|
|
5432
|
+
paddingRight: messagePaddingRight,
|
|
5433
|
+
fontSize: messageFontSize,
|
|
5434
|
+
letterSpacing: messageLetterSpacing
|
|
5403
5435
|
});
|
|
5404
5436
|
const lineCount = lines.length;
|
|
5405
|
-
const
|
|
5406
|
-
const
|
|
5407
|
-
const
|
|
5437
|
+
const textHeight = lineCount * messageLineHeight;
|
|
5438
|
+
const bubbleHeight = textHeight + messagePaddingTop + messagePaddingBottom;
|
|
5439
|
+
const bubbleBottom = currentBottom - gap;
|
|
5440
|
+
const bubbleTop = bubbleBottom - bubbleHeight;
|
|
5441
|
+
let bubbleLeft;
|
|
5442
|
+
if (message.sender === "recipient") {
|
|
5443
|
+
bubbleLeft = recipientBubbleLeft;
|
|
5444
|
+
} else {
|
|
5445
|
+
bubbleLeft = senderBubbleRight - bubbleWidth;
|
|
5446
|
+
}
|
|
5408
5447
|
let imageWidth;
|
|
5409
5448
|
let imageHeight;
|
|
5410
5449
|
let imageY;
|
|
5411
|
-
if (
|
|
5450
|
+
if (message.imageUrl) {
|
|
5412
5451
|
imageWidth = Math.min(imageMaxWidth, bubbleMaxWidth);
|
|
5413
5452
|
imageHeight = imageWidth / imageAspectRatio;
|
|
5414
|
-
}
|
|
5415
|
-
const bubbleTop = currentY - bubbleHeight;
|
|
5416
|
-
if (msg.imageUrl && imageHeight) {
|
|
5417
5453
|
imageY = bubbleTop - imageGapToText - imageHeight;
|
|
5418
5454
|
}
|
|
5419
5455
|
calculatedMessages.unshift({
|
|
5420
|
-
message
|
|
5456
|
+
message,
|
|
5421
5457
|
top: bubbleTop,
|
|
5458
|
+
bottom: bubbleBottom,
|
|
5459
|
+
left: bubbleLeft,
|
|
5460
|
+
width: bubbleWidth,
|
|
5422
5461
|
height: bubbleHeight,
|
|
5423
5462
|
lines,
|
|
5463
|
+
isFirstInGroup,
|
|
5464
|
+
isLastInGroup,
|
|
5465
|
+
isSingleMessage,
|
|
5424
5466
|
imageWidth,
|
|
5425
5467
|
imageHeight,
|
|
5426
5468
|
imageY
|
|
5427
5469
|
});
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5470
|
+
if (message.imageUrl && imageY !== void 0) {
|
|
5471
|
+
currentBottom = imageY;
|
|
5472
|
+
} else {
|
|
5473
|
+
currentBottom = bubbleTop;
|
|
5474
|
+
}
|
|
5432
5475
|
}
|
|
5433
5476
|
return calculatedMessages;
|
|
5434
5477
|
}
|
|
5478
|
+
function getCornerRadii2(cm, bubbleRadiusNormal, bubbleRadiusGrouped) {
|
|
5479
|
+
const isUser = cm.message.sender === "user";
|
|
5480
|
+
if (cm.isSingleMessage) {
|
|
5481
|
+
return {
|
|
5482
|
+
topLeft: bubbleRadiusNormal,
|
|
5483
|
+
topRight: bubbleRadiusNormal,
|
|
5484
|
+
bottomLeft: bubbleRadiusNormal,
|
|
5485
|
+
bottomRight: bubbleRadiusNormal
|
|
5486
|
+
};
|
|
5487
|
+
}
|
|
5488
|
+
if (isUser) {
|
|
5489
|
+
return {
|
|
5490
|
+
topLeft: bubbleRadiusNormal,
|
|
5491
|
+
topRight: cm.isFirstInGroup ? bubbleRadiusNormal : bubbleRadiusGrouped,
|
|
5492
|
+
bottomLeft: bubbleRadiusNormal,
|
|
5493
|
+
bottomRight: cm.isLastInGroup ? bubbleRadiusNormal : bubbleRadiusGrouped
|
|
5494
|
+
};
|
|
5495
|
+
} else {
|
|
5496
|
+
return {
|
|
5497
|
+
topLeft: cm.isFirstInGroup ? bubbleRadiusNormal : bubbleRadiusGrouped,
|
|
5498
|
+
topRight: bubbleRadiusNormal,
|
|
5499
|
+
bottomLeft: cm.isLastInGroup ? bubbleRadiusNormal : bubbleRadiusGrouped,
|
|
5500
|
+
bottomRight: bubbleRadiusNormal
|
|
5501
|
+
};
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5435
5504
|
function generateMessageElements2(props, calculatedMessages) {
|
|
5505
|
+
if (calculatedMessages.length === 0) {
|
|
5506
|
+
return [];
|
|
5507
|
+
}
|
|
5436
5508
|
const elements = [];
|
|
5437
5509
|
const canvasWidth = props.width ?? 1206;
|
|
5438
5510
|
const senderBubbleColor = props.senderBubbleColor ?? MESSAGE_DEFAULTS2.senderBubbleColor;
|
|
5439
5511
|
const recipientBubbleColor = props.recipientBubbleColor ?? MESSAGE_DEFAULTS2.recipientBubbleColor;
|
|
5440
5512
|
const bubbleTextColor = props.bubbleTextColor ?? MESSAGE_DEFAULTS2.bubbleTextColor;
|
|
5441
|
-
const
|
|
5442
|
-
const
|
|
5443
|
-
const
|
|
5444
|
-
const
|
|
5445
|
-
const
|
|
5446
|
-
const
|
|
5513
|
+
const messageFontSize = props.messageFontSize ?? MESSAGE_DEFAULTS2.messageFontSize;
|
|
5514
|
+
const messageLineHeight = props.messageLineHeight ?? MESSAGE_DEFAULTS2.messageLineHeight;
|
|
5515
|
+
const messageLetterSpacing = props.messageLetterSpacing ?? MESSAGE_DEFAULTS2.messageLetterSpacing;
|
|
5516
|
+
const messagePaddingTop = props.messagePaddingTop ?? MESSAGE_DEFAULTS2.messagePaddingTop;
|
|
5517
|
+
const messagePaddingBottom = props.messagePaddingBottom ?? MESSAGE_DEFAULTS2.messagePaddingBottom;
|
|
5518
|
+
const messagePaddingLeft = props.messagePaddingLeft ?? MESSAGE_DEFAULTS2.messagePaddingLeft;
|
|
5519
|
+
const messagePaddingRight = props.messagePaddingRight ?? MESSAGE_DEFAULTS2.messagePaddingRight;
|
|
5520
|
+
const bubbleRadiusNormal = props.bubbleRadiusNormal ?? MESSAGE_DEFAULTS2.bubbleRadiusNormal;
|
|
5521
|
+
const bubbleRadiusGrouped = props.bubbleRadiusGrouped ?? MESSAGE_DEFAULTS2.bubbleRadiusGrouped;
|
|
5447
5522
|
const bubbleMaxWidth = props.bubbleMaxWidth ?? MESSAGE_DEFAULTS2.bubbleMaxWidth;
|
|
5523
|
+
const recipientBubbleLeft = props.recipientBubbleLeft ?? MESSAGE_DEFAULTS2.recipientBubbleLeft;
|
|
5524
|
+
const senderBubbleRight = props.senderBubbleRight ?? MESSAGE_DEFAULTS2.senderBubbleRight;
|
|
5448
5525
|
const imageBorderRadius = MESSAGE_DEFAULTS2.imageBorderRadius;
|
|
5449
|
-
const
|
|
5450
|
-
const receivedMessagePaddingLeft = props.receivedMessagePaddingLeft ?? MESSAGE_DEFAULTS2.receivedMessagePaddingLeft;
|
|
5451
|
-
const senderBubbleRight = canvasWidth - sentMessagePaddingRight;
|
|
5526
|
+
const lineHeightMultiplier = messageLineHeight / messageFontSize;
|
|
5452
5527
|
for (let i = 0; i < calculatedMessages.length; i++) {
|
|
5453
|
-
const
|
|
5454
|
-
const
|
|
5455
|
-
const
|
|
5456
|
-
|
|
5457
|
-
|
|
5458
|
-
const imageX = isSender ? canvasWidth - sentMessagePaddingRight - imageWidth : receivedMessagePaddingLeft;
|
|
5528
|
+
const cm = calculatedMessages[i];
|
|
5529
|
+
const isUser = cm.message.sender === "user";
|
|
5530
|
+
const bubbleColor = isUser ? senderBubbleColor : recipientBubbleColor;
|
|
5531
|
+
if (cm.message.imageUrl && cm.imageWidth && cm.imageHeight && cm.imageY !== void 0) {
|
|
5532
|
+
const imageX = isUser ? senderBubbleRight - cm.imageWidth : recipientBubbleLeft;
|
|
5459
5533
|
elements.push({
|
|
5460
|
-
id: `image-${message.id}`,
|
|
5534
|
+
id: `image-${cm.message.id}`,
|
|
5461
5535
|
type: "image",
|
|
5462
5536
|
x: imageX,
|
|
5463
|
-
y: imageY,
|
|
5464
|
-
width: imageWidth,
|
|
5465
|
-
height: imageHeight,
|
|
5466
|
-
zIndex:
|
|
5467
|
-
url: message.imageUrl,
|
|
5537
|
+
y: cm.imageY,
|
|
5538
|
+
width: cm.imageWidth,
|
|
5539
|
+
height: cm.imageHeight,
|
|
5540
|
+
zIndex: 5 + i,
|
|
5541
|
+
url: cm.message.imageUrl,
|
|
5468
5542
|
borderRadius: imageBorderRadius,
|
|
5469
5543
|
objectFit: "cover"
|
|
5470
5544
|
});
|
|
5471
5545
|
}
|
|
5472
|
-
const
|
|
5473
|
-
const
|
|
5546
|
+
const radii = getCornerRadii2(cm, bubbleRadiusNormal, bubbleRadiusGrouped);
|
|
5547
|
+
const elementX = isUser ? senderBubbleRight - bubbleMaxWidth : recipientBubbleLeft;
|
|
5548
|
+
const textContent = cm.lines.join("\n");
|
|
5474
5549
|
elements.push({
|
|
5475
|
-
id: `message-${message.id}`,
|
|
5550
|
+
id: `message-${cm.message.id}`,
|
|
5476
5551
|
type: "text",
|
|
5477
5552
|
x: elementX,
|
|
5478
|
-
y: top,
|
|
5553
|
+
y: cm.top,
|
|
5479
5554
|
width: bubbleMaxWidth,
|
|
5480
|
-
height,
|
|
5481
|
-
zIndex:
|
|
5555
|
+
height: cm.height,
|
|
5556
|
+
zIndex: 5 + i,
|
|
5482
5557
|
text: textContent,
|
|
5483
5558
|
font: "apple",
|
|
5484
5559
|
fontWeight: 400,
|
|
5485
|
-
fontSize:
|
|
5486
|
-
letterSpacing:
|
|
5487
|
-
lineHeight:
|
|
5560
|
+
fontSize: messageFontSize,
|
|
5561
|
+
letterSpacing: messageLetterSpacing,
|
|
5562
|
+
lineHeight: lineHeightMultiplier,
|
|
5488
5563
|
color: bubbleTextColor,
|
|
5489
5564
|
textAlign: "left",
|
|
5490
5565
|
verticalAlign: "middle",
|
|
5491
5566
|
backgroundColor: bubbleColor,
|
|
5492
5567
|
backgroundOpacity: 100,
|
|
5493
|
-
backgroundBorderRadius:
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
},
|
|
5499
|
-
paddingTop: bubblePaddingY,
|
|
5500
|
-
paddingRight: bubblePaddingX,
|
|
5501
|
-
paddingBottom: bubblePaddingY,
|
|
5502
|
-
paddingLeft: bubblePaddingX,
|
|
5568
|
+
backgroundBorderRadius: radii,
|
|
5569
|
+
paddingTop: messagePaddingTop,
|
|
5570
|
+
paddingRight: messagePaddingRight,
|
|
5571
|
+
paddingBottom: messagePaddingBottom,
|
|
5572
|
+
paddingLeft: messagePaddingLeft,
|
|
5503
5573
|
autoWidth: true,
|
|
5504
|
-
boxAlign:
|
|
5574
|
+
boxAlign: isUser ? "right" : "left"
|
|
5505
5575
|
});
|
|
5506
5576
|
}
|
|
5507
5577
|
return elements;
|
|
@@ -5621,24 +5691,33 @@ var defaultIMessageDmProps = {
|
|
|
5621
5691
|
homeIndicatorLeft: 387,
|
|
5622
5692
|
homeIndicatorRight: 818,
|
|
5623
5693
|
homeIndicatorColor: "#ffffff",
|
|
5624
|
-
// Message
|
|
5694
|
+
// Message area bounds
|
|
5695
|
+
messageAreaTop: 450,
|
|
5696
|
+
messageAreaBottom: 2310,
|
|
5697
|
+
// Message colors
|
|
5625
5698
|
senderBubbleColor: "#1a42d5",
|
|
5626
5699
|
recipientBubbleColor: "#303032",
|
|
5627
5700
|
bubbleTextColor: "#ffffff",
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5701
|
+
// Message typography
|
|
5702
|
+
messageFontSize: 48,
|
|
5703
|
+
messageLineHeight: 60,
|
|
5704
|
+
messageLetterSpacing: 0.5,
|
|
5705
|
+
// Message padding (inside bubble)
|
|
5706
|
+
messagePaddingTop: 20,
|
|
5707
|
+
messagePaddingBottom: 20,
|
|
5708
|
+
messagePaddingLeft: 39,
|
|
5709
|
+
messagePaddingRight: 39,
|
|
5710
|
+
// Bubble corner radii
|
|
5711
|
+
bubbleRadiusNormal: 40,
|
|
5712
|
+
bubbleRadiusGrouped: 10,
|
|
5713
|
+
// Message spacing
|
|
5714
|
+
messageGapInGroup: 6,
|
|
5633
5715
|
messageGapSameUser: 8,
|
|
5634
5716
|
messageGapDifferentUser: 36,
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
multiLineSentMessagePaddingLeft: 31,
|
|
5640
|
-
multiLineReceivedMessagePaddingRight: 31,
|
|
5641
|
-
messagesAnchorY: 2340,
|
|
5717
|
+
// Bubble positioning
|
|
5718
|
+
recipientBubbleLeft: 48,
|
|
5719
|
+
senderBubbleRight: 1178,
|
|
5720
|
+
bubbleMaxWidth: 900,
|
|
5642
5721
|
// Example messages
|
|
5643
5722
|
messages: [
|
|
5644
5723
|
{ id: "msg-1", sender: "user", text: "heyyy fae, help me slide on this baddie pls \u{1F64F}", imageUrl: "https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/06c3ed1c-eefb-4a60-b0c4-5fb872811ba0/pinterest-1766175214139-0-JpXmGIxVWdjEJ3qxGyoC4DAi2KAZrg.jpg" },
|
|
@@ -6801,26 +6880,33 @@ var iMessageDmPropsSchema = import_zod.z.object({
|
|
|
6801
6880
|
messageTextLetterSpacing: import_zod.z.number().optional(),
|
|
6802
6881
|
messageTextColor: import_zod.z.string().optional(),
|
|
6803
6882
|
messageText: import_zod.z.string().optional(),
|
|
6804
|
-
// Message
|
|
6883
|
+
// Message area bounds
|
|
6884
|
+
messageAreaTop: import_zod.z.number().optional(),
|
|
6885
|
+
messageAreaBottom: import_zod.z.number().optional(),
|
|
6886
|
+
// Message colors
|
|
6805
6887
|
senderBubbleColor: import_zod.z.string().optional(),
|
|
6806
6888
|
recipientBubbleColor: import_zod.z.string().optional(),
|
|
6807
6889
|
bubbleTextColor: import_zod.z.string().optional(),
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
6811
|
-
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6890
|
+
// Message typography
|
|
6891
|
+
messageFontSize: import_zod.z.number().optional(),
|
|
6892
|
+
messageLineHeight: import_zod.z.number().optional(),
|
|
6893
|
+
messageLetterSpacing: import_zod.z.number().optional(),
|
|
6894
|
+
// Message padding (inside bubble)
|
|
6895
|
+
messagePaddingTop: import_zod.z.number().optional(),
|
|
6896
|
+
messagePaddingBottom: import_zod.z.number().optional(),
|
|
6897
|
+
messagePaddingLeft: import_zod.z.number().optional(),
|
|
6898
|
+
messagePaddingRight: import_zod.z.number().optional(),
|
|
6899
|
+
// Bubble corner radii
|
|
6900
|
+
bubbleRadiusNormal: import_zod.z.number().optional(),
|
|
6901
|
+
bubbleRadiusGrouped: import_zod.z.number().optional(),
|
|
6902
|
+
// Message spacing
|
|
6903
|
+
messageGapInGroup: import_zod.z.number().optional(),
|
|
6815
6904
|
messageGapSameUser: import_zod.z.number().optional(),
|
|
6816
6905
|
messageGapDifferentUser: import_zod.z.number().optional(),
|
|
6817
|
-
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
multiLineSentMessagePaddingLeft: import_zod.z.number().optional(),
|
|
6822
|
-
multiLineReceivedMessagePaddingRight: import_zod.z.number().optional(),
|
|
6823
|
-
messagesAnchorY: import_zod.z.number().optional(),
|
|
6906
|
+
// Bubble positioning
|
|
6907
|
+
recipientBubbleLeft: import_zod.z.number().optional(),
|
|
6908
|
+
senderBubbleRight: import_zod.z.number().optional(),
|
|
6909
|
+
bubbleMaxWidth: import_zod.z.number().optional(),
|
|
6824
6910
|
// Messages
|
|
6825
6911
|
messages: import_zod.z.array(import_zod.z.object({
|
|
6826
6912
|
id: import_zod.z.string(),
|
package/dist/index.mjs
CHANGED
|
@@ -4301,22 +4301,32 @@ import { Img as Img5, staticFile as staticFile3 } from "remotion";
|
|
|
4301
4301
|
|
|
4302
4302
|
// src/compositions/IMessageDmComposition/convertPropsToElements.ts
|
|
4303
4303
|
var MESSAGE_DEFAULTS2 = {
|
|
4304
|
+
// Message area bounds
|
|
4305
|
+
messageAreaTop: 450,
|
|
4306
|
+
messageAreaBottom: 2310,
|
|
4307
|
+
// Message colors
|
|
4304
4308
|
senderBubbleColor: "#1a42d5",
|
|
4305
4309
|
recipientBubbleColor: "#303032",
|
|
4306
4310
|
bubbleTextColor: "#ffffff",
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4311
|
+
// Message typography
|
|
4312
|
+
messageFontSize: 48,
|
|
4313
|
+
messageLineHeight: 60,
|
|
4314
|
+
messageLetterSpacing: 0.5,
|
|
4315
|
+
// Message padding (inside bubble)
|
|
4316
|
+
messagePaddingTop: 20,
|
|
4317
|
+
messagePaddingBottom: 20,
|
|
4318
|
+
messagePaddingLeft: 39,
|
|
4319
|
+
messagePaddingRight: 39,
|
|
4320
|
+
// Bubble corner radii
|
|
4321
|
+
bubbleRadiusNormal: 40,
|
|
4322
|
+
bubbleRadiusGrouped: 10,
|
|
4323
|
+
// Message spacing
|
|
4324
|
+
messageGapInGroup: 6,
|
|
4313
4325
|
messageGapSameUser: 8,
|
|
4314
4326
|
messageGapDifferentUser: 36,
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
receivedMessagePaddingRight: 270,
|
|
4319
|
-
messagesAnchorY: 2310,
|
|
4327
|
+
// Bubble positioning
|
|
4328
|
+
recipientBubbleLeft: 48,
|
|
4329
|
+
senderBubbleRight: 1178,
|
|
4320
4330
|
bubbleMaxWidth: 900,
|
|
4321
4331
|
// Image message defaults
|
|
4322
4332
|
imageMaxWidth: 600,
|
|
@@ -4421,133 +4431,193 @@ function calculateAutoWidthAndLines3({
|
|
|
4421
4431
|
function calculateMessagePositions2(props) {
|
|
4422
4432
|
const messages = props.messages ?? [];
|
|
4423
4433
|
if (messages.length === 0) return [];
|
|
4424
|
-
const
|
|
4425
|
-
const
|
|
4434
|
+
const messageAreaBottom = props.messageAreaBottom ?? MESSAGE_DEFAULTS2.messageAreaBottom;
|
|
4435
|
+
const messageFontSize = props.messageFontSize ?? MESSAGE_DEFAULTS2.messageFontSize;
|
|
4436
|
+
const messageLineHeight = props.messageLineHeight ?? MESSAGE_DEFAULTS2.messageLineHeight;
|
|
4437
|
+
const messageLetterSpacing = props.messageLetterSpacing ?? MESSAGE_DEFAULTS2.messageLetterSpacing;
|
|
4438
|
+
const messagePaddingTop = props.messagePaddingTop ?? MESSAGE_DEFAULTS2.messagePaddingTop;
|
|
4439
|
+
const messagePaddingBottom = props.messagePaddingBottom ?? MESSAGE_DEFAULTS2.messagePaddingBottom;
|
|
4440
|
+
const messagePaddingLeft = props.messagePaddingLeft ?? MESSAGE_DEFAULTS2.messagePaddingLeft;
|
|
4441
|
+
const messagePaddingRight = props.messagePaddingRight ?? MESSAGE_DEFAULTS2.messagePaddingRight;
|
|
4442
|
+
const messageGapInGroup = props.messageGapInGroup ?? MESSAGE_DEFAULTS2.messageGapInGroup;
|
|
4426
4443
|
const messageGapSameUser = props.messageGapSameUser ?? MESSAGE_DEFAULTS2.messageGapSameUser;
|
|
4427
4444
|
const messageGapDifferentUser = props.messageGapDifferentUser ?? MESSAGE_DEFAULTS2.messageGapDifferentUser;
|
|
4428
|
-
const
|
|
4429
|
-
const
|
|
4430
|
-
const bubbleTextFontSize = props.bubbleTextFontSize ?? MESSAGE_DEFAULTS2.bubbleTextFontSize;
|
|
4431
|
-
const bubbleTextLetterSpacing = props.bubbleTextLetterSpacing ?? MESSAGE_DEFAULTS2.bubbleTextLetterSpacing;
|
|
4432
|
-
const bubbleTextLineHeight = props.bubbleTextLineHeight ?? MESSAGE_DEFAULTS2.bubbleTextLineHeight;
|
|
4445
|
+
const recipientBubbleLeft = props.recipientBubbleLeft ?? MESSAGE_DEFAULTS2.recipientBubbleLeft;
|
|
4446
|
+
const senderBubbleRight = props.senderBubbleRight ?? MESSAGE_DEFAULTS2.senderBubbleRight;
|
|
4433
4447
|
const bubbleMaxWidth = props.bubbleMaxWidth ?? MESSAGE_DEFAULTS2.bubbleMaxWidth;
|
|
4434
4448
|
const imageMaxWidth = MESSAGE_DEFAULTS2.imageMaxWidth;
|
|
4435
4449
|
const imageAspectRatio = MESSAGE_DEFAULTS2.imageAspectRatio;
|
|
4436
4450
|
const imageGapToText = MESSAGE_DEFAULTS2.imageGapToText;
|
|
4437
4451
|
const calculatedMessages = [];
|
|
4438
|
-
let
|
|
4452
|
+
let currentBottom = messageAreaBottom;
|
|
4439
4453
|
for (let i = messages.length - 1; i >= 0; i--) {
|
|
4440
|
-
const
|
|
4441
|
-
if (!
|
|
4442
|
-
const
|
|
4443
|
-
|
|
4454
|
+
const message = messages[i];
|
|
4455
|
+
if (!message) continue;
|
|
4456
|
+
const prevMessage = i > 0 ? messages[i - 1] : null;
|
|
4457
|
+
const nextMessage = i < messages.length - 1 ? messages[i + 1] : null;
|
|
4458
|
+
const isGroupedWithPrev = message.groupWithPrevious && prevMessage?.sender === message.sender;
|
|
4459
|
+
const isGroupedWithNext = nextMessage?.groupWithPrevious && nextMessage?.sender === message.sender;
|
|
4460
|
+
const isFirstInGroup = !isGroupedWithPrev;
|
|
4461
|
+
const isLastInGroup = !isGroupedWithNext;
|
|
4462
|
+
const isSingleMessage = isFirstInGroup && isLastInGroup;
|
|
4463
|
+
let gap = 0;
|
|
4464
|
+
if (i < messages.length - 1) {
|
|
4465
|
+
const belowMessage = messages[i + 1];
|
|
4466
|
+
if (belowMessage?.groupWithPrevious && belowMessage.sender === message.sender) {
|
|
4467
|
+
gap = messageGapInGroup;
|
|
4468
|
+
} else if (belowMessage?.sender === message.sender) {
|
|
4469
|
+
gap = messageGapSameUser;
|
|
4470
|
+
} else {
|
|
4471
|
+
gap = messageGapDifferentUser;
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
4474
|
+
const { width: bubbleWidth, lines } = calculateAutoWidthAndLines3({
|
|
4475
|
+
text: message.text,
|
|
4444
4476
|
maxWidth: bubbleMaxWidth,
|
|
4445
|
-
paddingLeft:
|
|
4446
|
-
paddingRight:
|
|
4447
|
-
fontSize:
|
|
4448
|
-
letterSpacing:
|
|
4477
|
+
paddingLeft: messagePaddingLeft,
|
|
4478
|
+
paddingRight: messagePaddingRight,
|
|
4479
|
+
fontSize: messageFontSize,
|
|
4480
|
+
letterSpacing: messageLetterSpacing
|
|
4449
4481
|
});
|
|
4450
4482
|
const lineCount = lines.length;
|
|
4451
|
-
const
|
|
4452
|
-
const
|
|
4453
|
-
const
|
|
4483
|
+
const textHeight = lineCount * messageLineHeight;
|
|
4484
|
+
const bubbleHeight = textHeight + messagePaddingTop + messagePaddingBottom;
|
|
4485
|
+
const bubbleBottom = currentBottom - gap;
|
|
4486
|
+
const bubbleTop = bubbleBottom - bubbleHeight;
|
|
4487
|
+
let bubbleLeft;
|
|
4488
|
+
if (message.sender === "recipient") {
|
|
4489
|
+
bubbleLeft = recipientBubbleLeft;
|
|
4490
|
+
} else {
|
|
4491
|
+
bubbleLeft = senderBubbleRight - bubbleWidth;
|
|
4492
|
+
}
|
|
4454
4493
|
let imageWidth;
|
|
4455
4494
|
let imageHeight;
|
|
4456
4495
|
let imageY;
|
|
4457
|
-
if (
|
|
4496
|
+
if (message.imageUrl) {
|
|
4458
4497
|
imageWidth = Math.min(imageMaxWidth, bubbleMaxWidth);
|
|
4459
4498
|
imageHeight = imageWidth / imageAspectRatio;
|
|
4460
|
-
}
|
|
4461
|
-
const bubbleTop = currentY - bubbleHeight;
|
|
4462
|
-
if (msg.imageUrl && imageHeight) {
|
|
4463
4499
|
imageY = bubbleTop - imageGapToText - imageHeight;
|
|
4464
4500
|
}
|
|
4465
4501
|
calculatedMessages.unshift({
|
|
4466
|
-
message
|
|
4502
|
+
message,
|
|
4467
4503
|
top: bubbleTop,
|
|
4504
|
+
bottom: bubbleBottom,
|
|
4505
|
+
left: bubbleLeft,
|
|
4506
|
+
width: bubbleWidth,
|
|
4468
4507
|
height: bubbleHeight,
|
|
4469
4508
|
lines,
|
|
4509
|
+
isFirstInGroup,
|
|
4510
|
+
isLastInGroup,
|
|
4511
|
+
isSingleMessage,
|
|
4470
4512
|
imageWidth,
|
|
4471
4513
|
imageHeight,
|
|
4472
4514
|
imageY
|
|
4473
4515
|
});
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4516
|
+
if (message.imageUrl && imageY !== void 0) {
|
|
4517
|
+
currentBottom = imageY;
|
|
4518
|
+
} else {
|
|
4519
|
+
currentBottom = bubbleTop;
|
|
4520
|
+
}
|
|
4478
4521
|
}
|
|
4479
4522
|
return calculatedMessages;
|
|
4480
4523
|
}
|
|
4524
|
+
function getCornerRadii2(cm, bubbleRadiusNormal, bubbleRadiusGrouped) {
|
|
4525
|
+
const isUser = cm.message.sender === "user";
|
|
4526
|
+
if (cm.isSingleMessage) {
|
|
4527
|
+
return {
|
|
4528
|
+
topLeft: bubbleRadiusNormal,
|
|
4529
|
+
topRight: bubbleRadiusNormal,
|
|
4530
|
+
bottomLeft: bubbleRadiusNormal,
|
|
4531
|
+
bottomRight: bubbleRadiusNormal
|
|
4532
|
+
};
|
|
4533
|
+
}
|
|
4534
|
+
if (isUser) {
|
|
4535
|
+
return {
|
|
4536
|
+
topLeft: bubbleRadiusNormal,
|
|
4537
|
+
topRight: cm.isFirstInGroup ? bubbleRadiusNormal : bubbleRadiusGrouped,
|
|
4538
|
+
bottomLeft: bubbleRadiusNormal,
|
|
4539
|
+
bottomRight: cm.isLastInGroup ? bubbleRadiusNormal : bubbleRadiusGrouped
|
|
4540
|
+
};
|
|
4541
|
+
} else {
|
|
4542
|
+
return {
|
|
4543
|
+
topLeft: cm.isFirstInGroup ? bubbleRadiusNormal : bubbleRadiusGrouped,
|
|
4544
|
+
topRight: bubbleRadiusNormal,
|
|
4545
|
+
bottomLeft: cm.isLastInGroup ? bubbleRadiusNormal : bubbleRadiusGrouped,
|
|
4546
|
+
bottomRight: bubbleRadiusNormal
|
|
4547
|
+
};
|
|
4548
|
+
}
|
|
4549
|
+
}
|
|
4481
4550
|
function generateMessageElements2(props, calculatedMessages) {
|
|
4551
|
+
if (calculatedMessages.length === 0) {
|
|
4552
|
+
return [];
|
|
4553
|
+
}
|
|
4482
4554
|
const elements = [];
|
|
4483
4555
|
const canvasWidth = props.width ?? 1206;
|
|
4484
4556
|
const senderBubbleColor = props.senderBubbleColor ?? MESSAGE_DEFAULTS2.senderBubbleColor;
|
|
4485
4557
|
const recipientBubbleColor = props.recipientBubbleColor ?? MESSAGE_DEFAULTS2.recipientBubbleColor;
|
|
4486
4558
|
const bubbleTextColor = props.bubbleTextColor ?? MESSAGE_DEFAULTS2.bubbleTextColor;
|
|
4487
|
-
const
|
|
4488
|
-
const
|
|
4489
|
-
const
|
|
4490
|
-
const
|
|
4491
|
-
const
|
|
4492
|
-
const
|
|
4559
|
+
const messageFontSize = props.messageFontSize ?? MESSAGE_DEFAULTS2.messageFontSize;
|
|
4560
|
+
const messageLineHeight = props.messageLineHeight ?? MESSAGE_DEFAULTS2.messageLineHeight;
|
|
4561
|
+
const messageLetterSpacing = props.messageLetterSpacing ?? MESSAGE_DEFAULTS2.messageLetterSpacing;
|
|
4562
|
+
const messagePaddingTop = props.messagePaddingTop ?? MESSAGE_DEFAULTS2.messagePaddingTop;
|
|
4563
|
+
const messagePaddingBottom = props.messagePaddingBottom ?? MESSAGE_DEFAULTS2.messagePaddingBottom;
|
|
4564
|
+
const messagePaddingLeft = props.messagePaddingLeft ?? MESSAGE_DEFAULTS2.messagePaddingLeft;
|
|
4565
|
+
const messagePaddingRight = props.messagePaddingRight ?? MESSAGE_DEFAULTS2.messagePaddingRight;
|
|
4566
|
+
const bubbleRadiusNormal = props.bubbleRadiusNormal ?? MESSAGE_DEFAULTS2.bubbleRadiusNormal;
|
|
4567
|
+
const bubbleRadiusGrouped = props.bubbleRadiusGrouped ?? MESSAGE_DEFAULTS2.bubbleRadiusGrouped;
|
|
4493
4568
|
const bubbleMaxWidth = props.bubbleMaxWidth ?? MESSAGE_DEFAULTS2.bubbleMaxWidth;
|
|
4569
|
+
const recipientBubbleLeft = props.recipientBubbleLeft ?? MESSAGE_DEFAULTS2.recipientBubbleLeft;
|
|
4570
|
+
const senderBubbleRight = props.senderBubbleRight ?? MESSAGE_DEFAULTS2.senderBubbleRight;
|
|
4494
4571
|
const imageBorderRadius = MESSAGE_DEFAULTS2.imageBorderRadius;
|
|
4495
|
-
const
|
|
4496
|
-
const receivedMessagePaddingLeft = props.receivedMessagePaddingLeft ?? MESSAGE_DEFAULTS2.receivedMessagePaddingLeft;
|
|
4497
|
-
const senderBubbleRight = canvasWidth - sentMessagePaddingRight;
|
|
4572
|
+
const lineHeightMultiplier = messageLineHeight / messageFontSize;
|
|
4498
4573
|
for (let i = 0; i < calculatedMessages.length; i++) {
|
|
4499
|
-
const
|
|
4500
|
-
const
|
|
4501
|
-
const
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
const imageX = isSender ? canvasWidth - sentMessagePaddingRight - imageWidth : receivedMessagePaddingLeft;
|
|
4574
|
+
const cm = calculatedMessages[i];
|
|
4575
|
+
const isUser = cm.message.sender === "user";
|
|
4576
|
+
const bubbleColor = isUser ? senderBubbleColor : recipientBubbleColor;
|
|
4577
|
+
if (cm.message.imageUrl && cm.imageWidth && cm.imageHeight && cm.imageY !== void 0) {
|
|
4578
|
+
const imageX = isUser ? senderBubbleRight - cm.imageWidth : recipientBubbleLeft;
|
|
4505
4579
|
elements.push({
|
|
4506
|
-
id: `image-${message.id}`,
|
|
4580
|
+
id: `image-${cm.message.id}`,
|
|
4507
4581
|
type: "image",
|
|
4508
4582
|
x: imageX,
|
|
4509
|
-
y: imageY,
|
|
4510
|
-
width: imageWidth,
|
|
4511
|
-
height: imageHeight,
|
|
4512
|
-
zIndex:
|
|
4513
|
-
url: message.imageUrl,
|
|
4583
|
+
y: cm.imageY,
|
|
4584
|
+
width: cm.imageWidth,
|
|
4585
|
+
height: cm.imageHeight,
|
|
4586
|
+
zIndex: 5 + i,
|
|
4587
|
+
url: cm.message.imageUrl,
|
|
4514
4588
|
borderRadius: imageBorderRadius,
|
|
4515
4589
|
objectFit: "cover"
|
|
4516
4590
|
});
|
|
4517
4591
|
}
|
|
4518
|
-
const
|
|
4519
|
-
const
|
|
4592
|
+
const radii = getCornerRadii2(cm, bubbleRadiusNormal, bubbleRadiusGrouped);
|
|
4593
|
+
const elementX = isUser ? senderBubbleRight - bubbleMaxWidth : recipientBubbleLeft;
|
|
4594
|
+
const textContent = cm.lines.join("\n");
|
|
4520
4595
|
elements.push({
|
|
4521
|
-
id: `message-${message.id}`,
|
|
4596
|
+
id: `message-${cm.message.id}`,
|
|
4522
4597
|
type: "text",
|
|
4523
4598
|
x: elementX,
|
|
4524
|
-
y: top,
|
|
4599
|
+
y: cm.top,
|
|
4525
4600
|
width: bubbleMaxWidth,
|
|
4526
|
-
height,
|
|
4527
|
-
zIndex:
|
|
4601
|
+
height: cm.height,
|
|
4602
|
+
zIndex: 5 + i,
|
|
4528
4603
|
text: textContent,
|
|
4529
4604
|
font: "apple",
|
|
4530
4605
|
fontWeight: 400,
|
|
4531
|
-
fontSize:
|
|
4532
|
-
letterSpacing:
|
|
4533
|
-
lineHeight:
|
|
4606
|
+
fontSize: messageFontSize,
|
|
4607
|
+
letterSpacing: messageLetterSpacing,
|
|
4608
|
+
lineHeight: lineHeightMultiplier,
|
|
4534
4609
|
color: bubbleTextColor,
|
|
4535
4610
|
textAlign: "left",
|
|
4536
4611
|
verticalAlign: "middle",
|
|
4537
4612
|
backgroundColor: bubbleColor,
|
|
4538
4613
|
backgroundOpacity: 100,
|
|
4539
|
-
backgroundBorderRadius:
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
},
|
|
4545
|
-
paddingTop: bubblePaddingY,
|
|
4546
|
-
paddingRight: bubblePaddingX,
|
|
4547
|
-
paddingBottom: bubblePaddingY,
|
|
4548
|
-
paddingLeft: bubblePaddingX,
|
|
4614
|
+
backgroundBorderRadius: radii,
|
|
4615
|
+
paddingTop: messagePaddingTop,
|
|
4616
|
+
paddingRight: messagePaddingRight,
|
|
4617
|
+
paddingBottom: messagePaddingBottom,
|
|
4618
|
+
paddingLeft: messagePaddingLeft,
|
|
4549
4619
|
autoWidth: true,
|
|
4550
|
-
boxAlign:
|
|
4620
|
+
boxAlign: isUser ? "right" : "left"
|
|
4551
4621
|
});
|
|
4552
4622
|
}
|
|
4553
4623
|
return elements;
|
|
@@ -4667,24 +4737,33 @@ var defaultIMessageDmProps = {
|
|
|
4667
4737
|
homeIndicatorLeft: 387,
|
|
4668
4738
|
homeIndicatorRight: 818,
|
|
4669
4739
|
homeIndicatorColor: "#ffffff",
|
|
4670
|
-
// Message
|
|
4740
|
+
// Message area bounds
|
|
4741
|
+
messageAreaTop: 450,
|
|
4742
|
+
messageAreaBottom: 2310,
|
|
4743
|
+
// Message colors
|
|
4671
4744
|
senderBubbleColor: "#1a42d5",
|
|
4672
4745
|
recipientBubbleColor: "#303032",
|
|
4673
4746
|
bubbleTextColor: "#ffffff",
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4747
|
+
// Message typography
|
|
4748
|
+
messageFontSize: 48,
|
|
4749
|
+
messageLineHeight: 60,
|
|
4750
|
+
messageLetterSpacing: 0.5,
|
|
4751
|
+
// Message padding (inside bubble)
|
|
4752
|
+
messagePaddingTop: 20,
|
|
4753
|
+
messagePaddingBottom: 20,
|
|
4754
|
+
messagePaddingLeft: 39,
|
|
4755
|
+
messagePaddingRight: 39,
|
|
4756
|
+
// Bubble corner radii
|
|
4757
|
+
bubbleRadiusNormal: 40,
|
|
4758
|
+
bubbleRadiusGrouped: 10,
|
|
4759
|
+
// Message spacing
|
|
4760
|
+
messageGapInGroup: 6,
|
|
4679
4761
|
messageGapSameUser: 8,
|
|
4680
4762
|
messageGapDifferentUser: 36,
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
multiLineSentMessagePaddingLeft: 31,
|
|
4686
|
-
multiLineReceivedMessagePaddingRight: 31,
|
|
4687
|
-
messagesAnchorY: 2340,
|
|
4763
|
+
// Bubble positioning
|
|
4764
|
+
recipientBubbleLeft: 48,
|
|
4765
|
+
senderBubbleRight: 1178,
|
|
4766
|
+
bubbleMaxWidth: 900,
|
|
4688
4767
|
// Example messages
|
|
4689
4768
|
messages: [
|
|
4690
4769
|
{ id: "msg-1", sender: "user", text: "heyyy fae, help me slide on this baddie pls \u{1F64F}", imageUrl: "https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/06c3ed1c-eefb-4a60-b0c4-5fb872811ba0/pinterest-1766175214139-0-JpXmGIxVWdjEJ3qxGyoC4DAi2KAZrg.jpg" },
|
|
@@ -5564,26 +5643,33 @@ var iMessageDmPropsSchema = z.object({
|
|
|
5564
5643
|
messageTextLetterSpacing: z.number().optional(),
|
|
5565
5644
|
messageTextColor: z.string().optional(),
|
|
5566
5645
|
messageText: z.string().optional(),
|
|
5567
|
-
// Message
|
|
5646
|
+
// Message area bounds
|
|
5647
|
+
messageAreaTop: z.number().optional(),
|
|
5648
|
+
messageAreaBottom: z.number().optional(),
|
|
5649
|
+
// Message colors
|
|
5568
5650
|
senderBubbleColor: z.string().optional(),
|
|
5569
5651
|
recipientBubbleColor: z.string().optional(),
|
|
5570
5652
|
bubbleTextColor: z.string().optional(),
|
|
5571
|
-
|
|
5572
|
-
|
|
5573
|
-
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5653
|
+
// Message typography
|
|
5654
|
+
messageFontSize: z.number().optional(),
|
|
5655
|
+
messageLineHeight: z.number().optional(),
|
|
5656
|
+
messageLetterSpacing: z.number().optional(),
|
|
5657
|
+
// Message padding (inside bubble)
|
|
5658
|
+
messagePaddingTop: z.number().optional(),
|
|
5659
|
+
messagePaddingBottom: z.number().optional(),
|
|
5660
|
+
messagePaddingLeft: z.number().optional(),
|
|
5661
|
+
messagePaddingRight: z.number().optional(),
|
|
5662
|
+
// Bubble corner radii
|
|
5663
|
+
bubbleRadiusNormal: z.number().optional(),
|
|
5664
|
+
bubbleRadiusGrouped: z.number().optional(),
|
|
5665
|
+
// Message spacing
|
|
5666
|
+
messageGapInGroup: z.number().optional(),
|
|
5578
5667
|
messageGapSameUser: z.number().optional(),
|
|
5579
5668
|
messageGapDifferentUser: z.number().optional(),
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
multiLineSentMessagePaddingLeft: z.number().optional(),
|
|
5585
|
-
multiLineReceivedMessagePaddingRight: z.number().optional(),
|
|
5586
|
-
messagesAnchorY: z.number().optional(),
|
|
5669
|
+
// Bubble positioning
|
|
5670
|
+
recipientBubbleLeft: z.number().optional(),
|
|
5671
|
+
senderBubbleRight: z.number().optional(),
|
|
5672
|
+
bubbleMaxWidth: z.number().optional(),
|
|
5587
5673
|
// Messages
|
|
5588
5674
|
messages: z.array(z.object({
|
|
5589
5675
|
id: z.string(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ugcinc-render",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.162",
|
|
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",
|