ugcinc-render 1.8.112 → 1.8.114

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 CHANGED
@@ -753,6 +753,10 @@ interface InstagramDmCompositionProps {
753
753
  messagePaddingBottom?: number;
754
754
  /** Right padding for multi-line sender messages */
755
755
  multiLineSentMessagePaddingRight?: number;
756
+ /** Left padding for multi-line sender messages */
757
+ multiLineSentMessagePaddingLeft?: number;
758
+ /** Right padding for multi-line recipient messages */
759
+ multiLineRecMessagePaddingRight?: number;
756
760
  bubbleRadiusNormal?: number;
757
761
  bubbleRadiusGrouped?: number;
758
762
  messageGapInGroup?: number;
package/dist/index.d.ts CHANGED
@@ -753,6 +753,10 @@ interface InstagramDmCompositionProps {
753
753
  messagePaddingBottom?: number;
754
754
  /** Right padding for multi-line sender messages */
755
755
  multiLineSentMessagePaddingRight?: number;
756
+ /** Left padding for multi-line sender messages */
757
+ multiLineSentMessagePaddingLeft?: number;
758
+ /** Right padding for multi-line recipient messages */
759
+ multiLineRecMessagePaddingRight?: number;
756
760
  bubbleRadiusNormal?: number;
757
761
  bubbleRadiusGrouped?: number;
758
762
  messageGapInGroup?: number;
package/dist/index.js CHANGED
@@ -3535,11 +3535,13 @@ var MESSAGE_DEFAULTS = {
3535
3535
  messagePaddingRight: 38,
3536
3536
  messagePaddingTop: 27,
3537
3537
  messagePaddingBottom: 33,
3538
- multiLineSentMessagePaddingRight: 38,
3538
+ multiLineSentMessagePaddingRight: 35,
3539
+ multiLineSentMessagePaddingLeft: 37,
3540
+ multiLineRecMessagePaddingRight: 38,
3539
3541
  bubbleRadiusNormal: 57,
3540
3542
  bubbleRadiusGrouped: 12,
3541
3543
  messageGapInGroup: 6,
3542
- messageGapSameUser: 66,
3544
+ messageGapSameUser: 36,
3543
3545
  messageGapDifferentUser: 37,
3544
3546
  recipientBubbleLeft: 168,
3545
3547
  senderBubbleRight: 1182,
@@ -3601,9 +3603,11 @@ function calculateAutoWidthAndLines2({
3601
3603
  const testLine = currentLine + word;
3602
3604
  const testWidth = measureText(testLine);
3603
3605
  const WRAP_TOLERANCE = 0.5;
3604
- if (testWidth > availableWidth + WRAP_TOLERANCE && currentLine.trim()) {
3605
- lines.push(currentLine.trimEnd());
3606
- currentLine = word;
3606
+ if (testWidth > availableWidth + WRAP_TOLERANCE) {
3607
+ if (currentLine.trim()) {
3608
+ lines.push(currentLine.trimEnd());
3609
+ currentLine = "";
3610
+ }
3607
3611
  const wordWidth = measureText(word);
3608
3612
  if (wordWidth > availableWidth) {
3609
3613
  let remainingWord = word;
@@ -3625,6 +3629,8 @@ function calculateAutoWidthAndLines2({
3625
3629
  remainingWord = remainingWord.substring(breakPoint);
3626
3630
  }
3627
3631
  }
3632
+ } else {
3633
+ currentLine = word;
3628
3634
  }
3629
3635
  } else {
3630
3636
  currentLine = testLine;
@@ -3793,6 +3799,8 @@ function generateMessageElements(props, calculatedMessages) {
3793
3799
  const messagePaddingTop = props.messagePaddingTop ?? MESSAGE_DEFAULTS.messagePaddingTop;
3794
3800
  const messagePaddingBottom = props.messagePaddingBottom ?? MESSAGE_DEFAULTS.messagePaddingBottom;
3795
3801
  const multiLineSentMessagePaddingRight = props.multiLineSentMessagePaddingRight ?? MESSAGE_DEFAULTS.multiLineSentMessagePaddingRight;
3802
+ const multiLineSentMessagePaddingLeft = props.multiLineSentMessagePaddingLeft ?? MESSAGE_DEFAULTS.multiLineSentMessagePaddingLeft;
3803
+ const multiLineRecMessagePaddingRight = props.multiLineRecMessagePaddingRight ?? MESSAGE_DEFAULTS.multiLineRecMessagePaddingRight;
3796
3804
  const bubbleRadiusNormal = props.bubbleRadiusNormal ?? MESSAGE_DEFAULTS.bubbleRadiusNormal;
3797
3805
  const bubbleRadiusGrouped = props.bubbleRadiusGrouped ?? MESSAGE_DEFAULTS.bubbleRadiusGrouped;
3798
3806
  const bubbleMaxWidth = props.bubbleMaxWidth ?? MESSAGE_DEFAULTS.bubbleMaxWidth;
@@ -3820,7 +3828,16 @@ function generateMessageElements(props, calculatedMessages) {
3820
3828
  const elementX = isUser ? senderBubbleRight - bubbleMaxWidth : cm.left;
3821
3829
  const textContent = cm.lines.join("\n");
3822
3830
  const isMultiLine = cm.lines.length > 1;
3823
- const effectivePaddingRight = isUser && isMultiLine ? multiLineSentMessagePaddingRight : messagePaddingRight;
3831
+ let effectivePaddingRight = messagePaddingRight;
3832
+ let effectivePaddingLeft = messagePaddingLeft;
3833
+ if (isMultiLine) {
3834
+ if (isUser) {
3835
+ effectivePaddingRight = multiLineSentMessagePaddingRight;
3836
+ effectivePaddingLeft = multiLineSentMessagePaddingLeft;
3837
+ } else {
3838
+ effectivePaddingRight = multiLineRecMessagePaddingRight;
3839
+ }
3840
+ }
3824
3841
  elements.push({
3825
3842
  id: `message-${cm.message.id}`,
3826
3843
  type: "text",
@@ -3845,7 +3862,7 @@ function generateMessageElements(props, calculatedMessages) {
3845
3862
  paddingTop: messagePaddingTop,
3846
3863
  paddingRight: effectivePaddingRight,
3847
3864
  paddingBottom: messagePaddingBottom,
3848
- paddingLeft: messagePaddingLeft,
3865
+ paddingLeft: effectivePaddingLeft,
3849
3866
  autoWidth: true,
3850
3867
  boxAlign: isUser ? "right" : "left"
3851
3868
  });
@@ -3998,14 +4015,14 @@ var defaultInstagramDmProps = {
3998
4015
  // Receiver group 1
3999
4016
  { id: "1", sender: "recipient", text: "single line of sender text" },
4000
4017
  { id: "2", sender: "recipient", text: "double line of sender text, yeah i know right, it's two lines!", groupWithPrevious: true },
4001
- { id: "3", sender: "recipient", text: "another two line text, i wanna make sure it's the same bro", groupWithPrevious: true },
4018
+ { id: "3", sender: "recipient", text: "another two line text, i wanna make sure its the same bro", groupWithPrevious: true },
4002
4019
  { id: "4", sender: "recipient", text: "like really, is it the same?", groupWithPrevious: true },
4003
4020
  { id: "5", sender: "recipient", text: "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", groupWithPrevious: true },
4004
4021
  { id: "6", sender: "recipient", text: "ok short one", groupWithPrevious: true },
4005
4022
  // Sender group 1
4006
4023
  { id: "7", sender: "user", text: "short one" },
4007
4024
  { id: "8", sender: "user", text: "longer but still a single line", groupWithPrevious: true },
4008
- { id: "9", sender: "user", text: "another two line text, i wanna make sure it's the same bro", groupWithPrevious: true },
4025
+ { id: "9", sender: "user", text: "another two line text, i wanna make sure its the same bro", groupWithPrevious: true },
4009
4026
  { id: "10", sender: "user", text: "double line of sender text, yeah i know right, it's two lines!", groupWithPrevious: true },
4010
4027
  { id: "11", sender: "user", text: "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", groupWithPrevious: true },
4011
4028
  // Sender group 2
@@ -4025,11 +4042,13 @@ var defaultInstagramDmProps = {
4025
4042
  messagePaddingRight: 38,
4026
4043
  messagePaddingTop: 27,
4027
4044
  messagePaddingBottom: 33,
4028
- multiLineSentMessagePaddingRight: 38,
4045
+ multiLineSentMessagePaddingRight: 35,
4046
+ multiLineSentMessagePaddingLeft: 37,
4047
+ multiLineRecMessagePaddingRight: 38,
4029
4048
  bubbleRadiusNormal: 57,
4030
4049
  bubbleRadiusGrouped: 12,
4031
4050
  messageGapInGroup: 6,
4032
- messageGapSameUser: 66,
4051
+ messageGapSameUser: 36,
4033
4052
  messageGapDifferentUser: 37,
4034
4053
  recipientBubbleLeft: 168,
4035
4054
  senderBubbleRight: 1182,
@@ -5187,13 +5206,15 @@ var instagramDmSchema = import_zod.z.object({
5187
5206
  messagePaddingRight: import_zod.z.number().optional().default(38).describe("Message padding right"),
5188
5207
  messagePaddingTop: import_zod.z.number().optional().default(27).describe("Message padding top"),
5189
5208
  messagePaddingBottom: import_zod.z.number().optional().default(33).describe("Message padding bottom"),
5190
- multiLineSentMessagePaddingRight: import_zod.z.number().optional().default(38).describe("Right padding for multi-line sender messages"),
5209
+ multiLineSentMessagePaddingRight: import_zod.z.number().optional().default(35).describe("Right padding for multi-line sender messages"),
5210
+ multiLineSentMessagePaddingLeft: import_zod.z.number().optional().default(37).describe("Left padding for multi-line sender messages"),
5211
+ multiLineRecMessagePaddingRight: import_zod.z.number().optional().default(38).describe("Right padding for multi-line recipient messages"),
5191
5212
  // Bubble corner radii
5192
5213
  bubbleRadiusNormal: import_zod.z.number().optional().default(57).describe("Normal bubble corner radius"),
5193
5214
  bubbleRadiusGrouped: import_zod.z.number().optional().default(12).describe("Grouped bubble corner radius"),
5194
5215
  // Message spacing
5195
5216
  messageGapInGroup: import_zod.z.number().optional().default(6).describe("Gap between messages in group"),
5196
- messageGapSameUser: import_zod.z.number().optional().default(66).describe("Gap between messages from same user"),
5217
+ messageGapSameUser: import_zod.z.number().optional().default(36).describe("Gap between messages from same user"),
5197
5218
  messageGapDifferentUser: import_zod.z.number().optional().default(37).describe("Gap between messages from different users"),
5198
5219
  // Bubble positioning
5199
5220
  recipientBubbleLeft: import_zod.z.number().optional().default(168).describe("Recipient bubble left X"),
package/dist/index.mjs CHANGED
@@ -2604,11 +2604,13 @@ var MESSAGE_DEFAULTS = {
2604
2604
  messagePaddingRight: 38,
2605
2605
  messagePaddingTop: 27,
2606
2606
  messagePaddingBottom: 33,
2607
- multiLineSentMessagePaddingRight: 38,
2607
+ multiLineSentMessagePaddingRight: 35,
2608
+ multiLineSentMessagePaddingLeft: 37,
2609
+ multiLineRecMessagePaddingRight: 38,
2608
2610
  bubbleRadiusNormal: 57,
2609
2611
  bubbleRadiusGrouped: 12,
2610
2612
  messageGapInGroup: 6,
2611
- messageGapSameUser: 66,
2613
+ messageGapSameUser: 36,
2612
2614
  messageGapDifferentUser: 37,
2613
2615
  recipientBubbleLeft: 168,
2614
2616
  senderBubbleRight: 1182,
@@ -2670,9 +2672,11 @@ function calculateAutoWidthAndLines2({
2670
2672
  const testLine = currentLine + word;
2671
2673
  const testWidth = measureText(testLine);
2672
2674
  const WRAP_TOLERANCE = 0.5;
2673
- if (testWidth > availableWidth + WRAP_TOLERANCE && currentLine.trim()) {
2674
- lines.push(currentLine.trimEnd());
2675
- currentLine = word;
2675
+ if (testWidth > availableWidth + WRAP_TOLERANCE) {
2676
+ if (currentLine.trim()) {
2677
+ lines.push(currentLine.trimEnd());
2678
+ currentLine = "";
2679
+ }
2676
2680
  const wordWidth = measureText(word);
2677
2681
  if (wordWidth > availableWidth) {
2678
2682
  let remainingWord = word;
@@ -2694,6 +2698,8 @@ function calculateAutoWidthAndLines2({
2694
2698
  remainingWord = remainingWord.substring(breakPoint);
2695
2699
  }
2696
2700
  }
2701
+ } else {
2702
+ currentLine = word;
2697
2703
  }
2698
2704
  } else {
2699
2705
  currentLine = testLine;
@@ -2862,6 +2868,8 @@ function generateMessageElements(props, calculatedMessages) {
2862
2868
  const messagePaddingTop = props.messagePaddingTop ?? MESSAGE_DEFAULTS.messagePaddingTop;
2863
2869
  const messagePaddingBottom = props.messagePaddingBottom ?? MESSAGE_DEFAULTS.messagePaddingBottom;
2864
2870
  const multiLineSentMessagePaddingRight = props.multiLineSentMessagePaddingRight ?? MESSAGE_DEFAULTS.multiLineSentMessagePaddingRight;
2871
+ const multiLineSentMessagePaddingLeft = props.multiLineSentMessagePaddingLeft ?? MESSAGE_DEFAULTS.multiLineSentMessagePaddingLeft;
2872
+ const multiLineRecMessagePaddingRight = props.multiLineRecMessagePaddingRight ?? MESSAGE_DEFAULTS.multiLineRecMessagePaddingRight;
2865
2873
  const bubbleRadiusNormal = props.bubbleRadiusNormal ?? MESSAGE_DEFAULTS.bubbleRadiusNormal;
2866
2874
  const bubbleRadiusGrouped = props.bubbleRadiusGrouped ?? MESSAGE_DEFAULTS.bubbleRadiusGrouped;
2867
2875
  const bubbleMaxWidth = props.bubbleMaxWidth ?? MESSAGE_DEFAULTS.bubbleMaxWidth;
@@ -2889,7 +2897,16 @@ function generateMessageElements(props, calculatedMessages) {
2889
2897
  const elementX = isUser ? senderBubbleRight - bubbleMaxWidth : cm.left;
2890
2898
  const textContent = cm.lines.join("\n");
2891
2899
  const isMultiLine = cm.lines.length > 1;
2892
- const effectivePaddingRight = isUser && isMultiLine ? multiLineSentMessagePaddingRight : messagePaddingRight;
2900
+ let effectivePaddingRight = messagePaddingRight;
2901
+ let effectivePaddingLeft = messagePaddingLeft;
2902
+ if (isMultiLine) {
2903
+ if (isUser) {
2904
+ effectivePaddingRight = multiLineSentMessagePaddingRight;
2905
+ effectivePaddingLeft = multiLineSentMessagePaddingLeft;
2906
+ } else {
2907
+ effectivePaddingRight = multiLineRecMessagePaddingRight;
2908
+ }
2909
+ }
2893
2910
  elements.push({
2894
2911
  id: `message-${cm.message.id}`,
2895
2912
  type: "text",
@@ -2914,7 +2931,7 @@ function generateMessageElements(props, calculatedMessages) {
2914
2931
  paddingTop: messagePaddingTop,
2915
2932
  paddingRight: effectivePaddingRight,
2916
2933
  paddingBottom: messagePaddingBottom,
2917
- paddingLeft: messagePaddingLeft,
2934
+ paddingLeft: effectivePaddingLeft,
2918
2935
  autoWidth: true,
2919
2936
  boxAlign: isUser ? "right" : "left"
2920
2937
  });
@@ -3067,14 +3084,14 @@ var defaultInstagramDmProps = {
3067
3084
  // Receiver group 1
3068
3085
  { id: "1", sender: "recipient", text: "single line of sender text" },
3069
3086
  { id: "2", sender: "recipient", text: "double line of sender text, yeah i know right, it's two lines!", groupWithPrevious: true },
3070
- { id: "3", sender: "recipient", text: "another two line text, i wanna make sure it's the same bro", groupWithPrevious: true },
3087
+ { id: "3", sender: "recipient", text: "another two line text, i wanna make sure its the same bro", groupWithPrevious: true },
3071
3088
  { id: "4", sender: "recipient", text: "like really, is it the same?", groupWithPrevious: true },
3072
3089
  { id: "5", sender: "recipient", text: "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", groupWithPrevious: true },
3073
3090
  { id: "6", sender: "recipient", text: "ok short one", groupWithPrevious: true },
3074
3091
  // Sender group 1
3075
3092
  { id: "7", sender: "user", text: "short one" },
3076
3093
  { id: "8", sender: "user", text: "longer but still a single line", groupWithPrevious: true },
3077
- { id: "9", sender: "user", text: "another two line text, i wanna make sure it's the same bro", groupWithPrevious: true },
3094
+ { id: "9", sender: "user", text: "another two line text, i wanna make sure its the same bro", groupWithPrevious: true },
3078
3095
  { id: "10", sender: "user", text: "double line of sender text, yeah i know right, it's two lines!", groupWithPrevious: true },
3079
3096
  { id: "11", sender: "user", text: "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", groupWithPrevious: true },
3080
3097
  // Sender group 2
@@ -3094,11 +3111,13 @@ var defaultInstagramDmProps = {
3094
3111
  messagePaddingRight: 38,
3095
3112
  messagePaddingTop: 27,
3096
3113
  messagePaddingBottom: 33,
3097
- multiLineSentMessagePaddingRight: 38,
3114
+ multiLineSentMessagePaddingRight: 35,
3115
+ multiLineSentMessagePaddingLeft: 37,
3116
+ multiLineRecMessagePaddingRight: 38,
3098
3117
  bubbleRadiusNormal: 57,
3099
3118
  bubbleRadiusGrouped: 12,
3100
3119
  messageGapInGroup: 6,
3101
- messageGapSameUser: 66,
3120
+ messageGapSameUser: 36,
3102
3121
  messageGapDifferentUser: 37,
3103
3122
  recipientBubbleLeft: 168,
3104
3123
  senderBubbleRight: 1182,
@@ -3973,13 +3992,15 @@ var instagramDmSchema = z.object({
3973
3992
  messagePaddingRight: z.number().optional().default(38).describe("Message padding right"),
3974
3993
  messagePaddingTop: z.number().optional().default(27).describe("Message padding top"),
3975
3994
  messagePaddingBottom: z.number().optional().default(33).describe("Message padding bottom"),
3976
- multiLineSentMessagePaddingRight: z.number().optional().default(38).describe("Right padding for multi-line sender messages"),
3995
+ multiLineSentMessagePaddingRight: z.number().optional().default(35).describe("Right padding for multi-line sender messages"),
3996
+ multiLineSentMessagePaddingLeft: z.number().optional().default(37).describe("Left padding for multi-line sender messages"),
3997
+ multiLineRecMessagePaddingRight: z.number().optional().default(38).describe("Right padding for multi-line recipient messages"),
3977
3998
  // Bubble corner radii
3978
3999
  bubbleRadiusNormal: z.number().optional().default(57).describe("Normal bubble corner radius"),
3979
4000
  bubbleRadiusGrouped: z.number().optional().default(12).describe("Grouped bubble corner radius"),
3980
4001
  // Message spacing
3981
4002
  messageGapInGroup: z.number().optional().default(6).describe("Gap between messages in group"),
3982
- messageGapSameUser: z.number().optional().default(66).describe("Gap between messages from same user"),
4003
+ messageGapSameUser: z.number().optional().default(36).describe("Gap between messages from same user"),
3983
4004
  messageGapDifferentUser: z.number().optional().default(37).describe("Gap between messages from different users"),
3984
4005
  // Bubble positioning
3985
4006
  recipientBubbleLeft: z.number().optional().default(168).describe("Recipient bubble left X"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ugcinc-render",
3
- "version": "1.8.112",
3
+ "version": "1.8.114",
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",