ugcinc 3.84.6 → 3.85.0
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.ts +2 -1
- package/dist/index.js +6 -1
- package/dist/render/Root.d.ts +12 -0
- package/dist/render/Root.js +508 -0
- package/dist/render/components/CaptionOverlay.d.ts +21 -0
- package/dist/render/components/CaptionOverlay.js +210 -0
- package/dist/render/components/ImageElement.d.ts +26 -0
- package/dist/render/components/ImageElement.js +88 -0
- package/dist/render/components/TextElement.d.ts +30 -0
- package/dist/render/components/TextElement.js +390 -0
- package/dist/render/components/VideoElement.d.ts +30 -0
- package/dist/render/components/VideoElement.js +108 -0
- package/dist/render/components/index.d.ts +7 -0
- package/dist/render/components/index.js +14 -0
- package/dist/render/compositions/AutoCaptionComposition.d.ts +42 -0
- package/dist/render/compositions/AutoCaptionComposition.js +29 -0
- package/dist/render/compositions/DmComposition/BaseDmComposition.d.ts +112 -0
- package/dist/render/compositions/DmComposition/BaseDmComposition.js +212 -0
- package/dist/render/compositions/DmComposition/DebugOverlay.d.ts +20 -0
- package/dist/render/compositions/DmComposition/DebugOverlay.js +258 -0
- package/dist/render/compositions/DmComposition/index.d.ts +6 -0
- package/dist/render/compositions/DmComposition/index.js +10 -0
- package/dist/render/compositions/IMessageDmComposition/convertPropsToElements.d.ts +27 -0
- package/dist/render/compositions/IMessageDmComposition/convertPropsToElements.js +629 -0
- package/dist/render/compositions/IMessageDmComposition/index.d.ts +20 -0
- package/dist/render/compositions/IMessageDmComposition/index.js +485 -0
- package/dist/render/compositions/IMessageDmComposition/types.d.ts +756 -0
- package/dist/render/compositions/IMessageDmComposition/types.js +225 -0
- package/dist/render/compositions/ImageEditorComposition.d.ts +74 -0
- package/dist/render/compositions/ImageEditorComposition.js +351 -0
- package/dist/render/compositions/InstagramDmComposition/convertPropsToElements.d.ts +60 -0
- package/dist/render/compositions/InstagramDmComposition/convertPropsToElements.js +1318 -0
- package/dist/render/compositions/InstagramDmComposition/convertPublicToProps.d.ts +30 -0
- package/dist/render/compositions/InstagramDmComposition/convertPublicToProps.js +131 -0
- package/dist/render/compositions/InstagramDmComposition/index.d.ts +16 -0
- package/dist/render/compositions/InstagramDmComposition/index.js +374 -0
- package/dist/render/compositions/InstagramDmComposition/theme.d.ts +42 -0
- package/dist/render/compositions/InstagramDmComposition/theme.js +55 -0
- package/dist/render/compositions/InstagramDmComposition/types.d.ts +215 -0
- package/dist/render/compositions/InstagramDmComposition/types.js +7 -0
- package/dist/render/compositions/ScreenshotAnimation.d.ts +14 -0
- package/dist/render/compositions/ScreenshotAnimation.js +268 -0
- package/dist/render/compositions/VideoEditorComposition.d.ts +45 -0
- package/dist/render/compositions/VideoEditorComposition.js +307 -0
- package/dist/render/compositions/index.d.ts +12 -0
- package/dist/render/compositions/index.js +43 -0
- package/dist/render/compositions/messaging/components/MediaBubble.d.ts +22 -0
- package/dist/render/compositions/messaging/components/MediaBubble.js +25 -0
- package/dist/render/compositions/messaging/components/MessageBubble.d.ts +35 -0
- package/dist/render/compositions/messaging/components/MessageBubble.js +34 -0
- package/dist/render/compositions/messaging/components/ProfilePic.d.ts +23 -0
- package/dist/render/compositions/messaging/components/ProfilePic.js +37 -0
- package/dist/render/compositions/messaging/components/Reaction.d.ts +23 -0
- package/dist/render/compositions/messaging/components/Reaction.js +19 -0
- package/dist/render/compositions/messaging/components/TypingIndicator.d.ts +25 -0
- package/dist/render/compositions/messaging/components/TypingIndicator.js +66 -0
- package/dist/render/compositions/messaging/index.d.ts +14 -0
- package/dist/render/compositions/messaging/index.js +43 -0
- package/dist/render/compositions/messaging/types.d.ts +148 -0
- package/dist/render/compositions/messaging/types.js +21 -0
- package/dist/render/compositions/messaging/utils/bubbleRadius.d.ts +45 -0
- package/dist/render/compositions/messaging/utils/bubbleRadius.js +84 -0
- package/dist/render/compositions/messaging/utils/groupMessages.d.ts +41 -0
- package/dist/render/compositions/messaging/utils/groupMessages.js +110 -0
- package/dist/render/data/phone-top-nav.d.ts +1 -0
- package/dist/render/data/phone-top-nav.js +4 -0
- package/dist/render/data/screenshot.d.ts +164 -0
- package/dist/render/data/screenshot.js +63 -0
- package/dist/render/hooks/index.d.ts +54 -0
- package/dist/render/hooks/index.js +132 -0
- package/dist/render/index.d.ts +12 -0
- package/dist/render/index.js +36 -0
- package/dist/render/types/base.d.ts +148 -0
- package/dist/render/types/base.js +5 -0
- package/dist/render/types/caption.d.ts +105 -0
- package/dist/render/types/caption.js +8 -0
- package/dist/render/types/crop.d.ts +60 -0
- package/dist/render/types/crop.js +8 -0
- package/dist/render/types/deduplication.d.ts +284 -0
- package/dist/render/types/deduplication.js +240 -0
- package/dist/render/types/editor.d.ts +97 -0
- package/dist/render/types/editor.js +10 -0
- package/dist/render/types/element.d.ts +139 -0
- package/dist/render/types/element.js +19 -0
- package/dist/render/types/index.d.ts +20 -0
- package/dist/render/types/index.js +24 -0
- package/dist/render/types/instagram-dm-public.d.ts +60 -0
- package/dist/render/types/instagram-dm-public.js +8 -0
- package/dist/render/types/position.d.ts +59 -0
- package/dist/render/types/position.js +5 -0
- package/dist/render/types/screenshot.d.ts +57 -0
- package/dist/render/types/screenshot.js +34 -0
- package/dist/render/types/segment.d.ts +163 -0
- package/dist/render/types/segment.js +8 -0
- package/dist/render/types/video.d.ts +192 -0
- package/dist/render/types/video.js +14 -0
- package/dist/render/utils/captionPresets.d.ts +38 -0
- package/dist/render/utils/captionPresets.js +168 -0
- package/dist/render/utils/cropBounds.d.ts +20 -0
- package/dist/render/utils/cropBounds.js +166 -0
- package/dist/render/utils/defaults.d.ts +74 -0
- package/dist/render/utils/defaults.js +91 -0
- package/dist/render/utils/emoji.d.ts +40 -0
- package/dist/render/utils/emoji.js +105 -0
- package/dist/render/utils/fit.d.ts +35 -0
- package/dist/render/utils/fit.js +63 -0
- package/dist/render/utils/fonts.d.ts +55 -0
- package/dist/render/utils/fonts.js +191 -0
- package/dist/render/utils/index.d.ts +14 -0
- package/dist/render/utils/index.js +73 -0
- package/dist/render/utils/positionResolver.d.ts +64 -0
- package/dist/render/utils/positionResolver.js +508 -0
- package/dist/render/utils/text.d.ts +50 -0
- package/dist/render/utils/text.js +177 -0
- package/dist/render/utils/timeline.d.ts +62 -0
- package/dist/render/utils/timeline.js +172 -0
- package/dist/render.d.ts +1 -1
- package/dist/types.d.ts +136 -17
- package/dist/types.js +58 -0
- package/package.json +20 -6
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IMessageDmComposition = exports.defaultIMessageDmProps = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/**
|
|
6
|
+
* iMessage DM Composition
|
|
7
|
+
*
|
|
8
|
+
* A fully parameterized iMessage DM conversation renderer.
|
|
9
|
+
* Uses BaseDmComposition for shared iOS chrome (status bar, home indicator)
|
|
10
|
+
* and zoom/pan/crosshair functionality.
|
|
11
|
+
*/
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const remotion_1 = require("remotion");
|
|
14
|
+
const ImageEditorComposition_1 = require("../ImageEditorComposition");
|
|
15
|
+
const DmComposition_1 = require("../DmComposition");
|
|
16
|
+
const convertPropsToElements_1 = require("./convertPropsToElements");
|
|
17
|
+
const fonts_1 = require("../../utils/fonts");
|
|
18
|
+
/**
|
|
19
|
+
* Default composition props for registration
|
|
20
|
+
*/
|
|
21
|
+
exports.defaultIMessageDmProps = {
|
|
22
|
+
showDebugOverlay: false,
|
|
23
|
+
referenceImageUrl: 'https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/06c3ed1c-eefb-4a60-b0c4-5fb872811ba0/IMG_3189-hUoucNOmBoT8fihIL7ybuEXwoRrngz.png',
|
|
24
|
+
showReferenceImage: false,
|
|
25
|
+
referenceOpacity: 50,
|
|
26
|
+
lightMode: false,
|
|
27
|
+
width: 1206,
|
|
28
|
+
height: 2622,
|
|
29
|
+
durationInFrames: 90,
|
|
30
|
+
fps: 30,
|
|
31
|
+
// Header defaults
|
|
32
|
+
headerTop: 0,
|
|
33
|
+
headerBottom: 424,
|
|
34
|
+
headerBackgroundColor: '#171717',
|
|
35
|
+
// Profile section defaults
|
|
36
|
+
profilePicUrl: 'https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/06c3ed1c-eefb-4a60-b0c4-5fb872811ba0/pinterest-1766175215011-3-ftQGbunlgHOFdfFtr1PdxxmHD9TAf9.jpg',
|
|
37
|
+
profilePicTop: 195,
|
|
38
|
+
profilePicBottom: 347,
|
|
39
|
+
profilePicLeft: 528,
|
|
40
|
+
profilePicRight: 680,
|
|
41
|
+
username: 'aidan gollan',
|
|
42
|
+
usernameTop: 355,
|
|
43
|
+
usernameBottom: 404,
|
|
44
|
+
usernameLeft: 452,
|
|
45
|
+
usernameRight: 752,
|
|
46
|
+
usernameFontSize: 36,
|
|
47
|
+
usernameLetterSpacing: 0.8,
|
|
48
|
+
usernameColor: '#ffffff',
|
|
49
|
+
usernameArrowOffsetX: 8,
|
|
50
|
+
usernameArrowOffsetY: 2,
|
|
51
|
+
usernameArrowWidth: 14,
|
|
52
|
+
usernameArrowHeight: 24,
|
|
53
|
+
// Back arrow defaults
|
|
54
|
+
backArrowTop: 234,
|
|
55
|
+
backArrowBottom: 297,
|
|
56
|
+
backArrowLeft: 50,
|
|
57
|
+
backArrowRight: 87,
|
|
58
|
+
// Unread badge defaults
|
|
59
|
+
unreadBadgeText: '579',
|
|
60
|
+
unreadBadgeTop: 238,
|
|
61
|
+
unreadBadgeBottom: 293,
|
|
62
|
+
unreadBadgeLeft: 108,
|
|
63
|
+
unreadBadgeFontSize: 36,
|
|
64
|
+
unreadBadgeLetterSpacing: 0.2,
|
|
65
|
+
unreadBadgeTextColor: '#ffffff',
|
|
66
|
+
unreadBadgeBorderRadius: 9999,
|
|
67
|
+
unreadBadgePaddingLeft: 17,
|
|
68
|
+
unreadBadgePaddingRight: 17,
|
|
69
|
+
// Camera icon defaults
|
|
70
|
+
cameraIconTop: 237,
|
|
71
|
+
cameraIconBottom: 292,
|
|
72
|
+
cameraIconLeft: 1053,
|
|
73
|
+
cameraIconRight: 1134,
|
|
74
|
+
// Divider line defaults
|
|
75
|
+
dividerLineY: 425,
|
|
76
|
+
dividerLineColor: '#262626',
|
|
77
|
+
// Background
|
|
78
|
+
backgroundColor: '#000000',
|
|
79
|
+
// Plus button defaults
|
|
80
|
+
plusButtonTop: 2390,
|
|
81
|
+
plusButtonBottom: 2491,
|
|
82
|
+
plusButtonLeft: 42,
|
|
83
|
+
plusButtonRight: 143,
|
|
84
|
+
// Footer defaults
|
|
85
|
+
footerTop: 2385,
|
|
86
|
+
footerBottom: 2495,
|
|
87
|
+
footerLeft: 180,
|
|
88
|
+
footerRight: 1157,
|
|
89
|
+
footerBgColor: '#1c1c1e',
|
|
90
|
+
footerBorderRadius: 55,
|
|
91
|
+
footerBorderColor: '#3a3a3c',
|
|
92
|
+
footerBorderWidth: 2,
|
|
93
|
+
// Message text defaults
|
|
94
|
+
messageTextTop: 2412,
|
|
95
|
+
messageTextBottom: 2468,
|
|
96
|
+
messageTextLeft: 220,
|
|
97
|
+
messageTextRight: 600,
|
|
98
|
+
messageTextFontSize: 48,
|
|
99
|
+
messageTextLetterSpacing: 0,
|
|
100
|
+
messageTextColor: '#8e8e93',
|
|
101
|
+
messageText: 'iMessage',
|
|
102
|
+
// Status bar props (passed to BaseDmComposition - same as IG DM)
|
|
103
|
+
time: '9:41',
|
|
104
|
+
timeRight: 262,
|
|
105
|
+
timeBottom: 125,
|
|
106
|
+
timeFontSize: 52,
|
|
107
|
+
timeLetterSpacing: 1.6,
|
|
108
|
+
noNotisTop: 77,
|
|
109
|
+
noNotisBottom: 120,
|
|
110
|
+
noNotisLeft: 272,
|
|
111
|
+
noNotisRight: 312,
|
|
112
|
+
cellLevel: 4,
|
|
113
|
+
cell1Top: 102,
|
|
114
|
+
cell1Bottom: 116,
|
|
115
|
+
cell1Left: 865,
|
|
116
|
+
cell1Right: 875,
|
|
117
|
+
cell2Top: 95,
|
|
118
|
+
cell2Bottom: 116,
|
|
119
|
+
cell2Left: 881,
|
|
120
|
+
cell2Right: 891,
|
|
121
|
+
cell3Top: 87,
|
|
122
|
+
cell3Bottom: 116,
|
|
123
|
+
cell3Left: 897,
|
|
124
|
+
cell3Right: 907,
|
|
125
|
+
cell4Top: 79,
|
|
126
|
+
cell4Bottom: 116,
|
|
127
|
+
cell4Left: 913,
|
|
128
|
+
cell4Right: 923,
|
|
129
|
+
wifiTop: 79,
|
|
130
|
+
wifiBottom: 116,
|
|
131
|
+
wifiLeft: 945,
|
|
132
|
+
wifiRight: 996,
|
|
133
|
+
batteryTop: 78,
|
|
134
|
+
batteryBottom: 117,
|
|
135
|
+
batteryLeft: 1018,
|
|
136
|
+
batteryRight: 1100,
|
|
137
|
+
// Home indicator defaults (passed to BaseDmComposition)
|
|
138
|
+
homeIndicatorTop: 2583,
|
|
139
|
+
homeIndicatorBottom: 2597,
|
|
140
|
+
homeIndicatorLeft: 387,
|
|
141
|
+
homeIndicatorRight: 818,
|
|
142
|
+
homeIndicatorColor: '#ffffff',
|
|
143
|
+
// Message area bounds
|
|
144
|
+
messageAreaTop: 450,
|
|
145
|
+
messageAreaBottom: 2310,
|
|
146
|
+
// Message colors
|
|
147
|
+
senderBubbleColor: '#1a42d5',
|
|
148
|
+
recipientBubbleColor: '#303032',
|
|
149
|
+
bubbleTextColor: '#ffffff',
|
|
150
|
+
recipientTextColor: '#ffffff',
|
|
151
|
+
// Message typography
|
|
152
|
+
messageFontSize: 53,
|
|
153
|
+
messageLineHeight: 60,
|
|
154
|
+
messageLetterSpacing: 1.2,
|
|
155
|
+
// Message padding (inside bubble)
|
|
156
|
+
messagePaddingTop: 23,
|
|
157
|
+
messagePaddingBottom: 22,
|
|
158
|
+
senderPaddingLeft: 34,
|
|
159
|
+
senderPaddingRight: 48,
|
|
160
|
+
multiLineSenderPaddingLeft: 34,
|
|
161
|
+
recipientPaddingLeft: 37,
|
|
162
|
+
recipientPaddingRight: 36,
|
|
163
|
+
multiLineRecipientPaddingRight: 48,
|
|
164
|
+
// Bubble corner radii
|
|
165
|
+
bubbleRadiusNormal: 51,
|
|
166
|
+
bubbleRadiusGrouped: 51,
|
|
167
|
+
// Message spacing
|
|
168
|
+
messageGapInGroup: 3,
|
|
169
|
+
messageGapSameUser: 8,
|
|
170
|
+
messageGapDifferentUser: 70,
|
|
171
|
+
// Bubble positioning
|
|
172
|
+
recipientBubbleLeft: 48,
|
|
173
|
+
senderBubbleRight: 1158,
|
|
174
|
+
bubbleMaxWidth: 900,
|
|
175
|
+
// Sender image attachment
|
|
176
|
+
senderImageLeft: 336,
|
|
177
|
+
senderImageHeight: 1120,
|
|
178
|
+
senderImageGapToText: 3,
|
|
179
|
+
senderImageBorderRadius: 51,
|
|
180
|
+
// Message area header text (above first message)
|
|
181
|
+
messageHeaderImessageText: 'iMessage',
|
|
182
|
+
messageHeaderTimestampText: 'Today 12:16 PM',
|
|
183
|
+
messageHeaderTimestampGap: 30,
|
|
184
|
+
messageHeaderImessageGap: 5,
|
|
185
|
+
messageHeaderTextColor: '#626167',
|
|
186
|
+
messageHeaderFontSize: 34,
|
|
187
|
+
messageHeaderLetterSpacing: 1.25,
|
|
188
|
+
messageHeaderLeft: 0,
|
|
189
|
+
messageHeaderRight: 1206,
|
|
190
|
+
// Message tails (SVG-based, on last message in group)
|
|
191
|
+
showMessageTails: true,
|
|
192
|
+
// Recipient tail anchor points (offsets from message left & bottom)
|
|
193
|
+
recipientTailSideY: -53, // Y where tail meets bubble (top of straight line)
|
|
194
|
+
recipientTailCurveStartY: -28, // Y where straight line ends and top curve begins
|
|
195
|
+
recipientTailTipX: -16,
|
|
196
|
+
recipientTailTipY: -1,
|
|
197
|
+
recipientTailBottomX: 19, // X where bottom curve ends (connects to bubble)
|
|
198
|
+
recipientTailBottomY: -12, // Y where bottom curve ends (connects to bubble)
|
|
199
|
+
// Recipient tail curve bend (-1 to 1, negative = inward, positive = outward)
|
|
200
|
+
recipientTailTopBend: -0.32, // Top curve bends inward
|
|
201
|
+
recipientTailBottomBend: 0.3, // Bottom curve bends outward
|
|
202
|
+
// Sender tail anchor points (offsets from message right & bottom)
|
|
203
|
+
senderTailSideY: -53, // Y where tail meets bubble (top of straight line)
|
|
204
|
+
senderTailCurveStartY: -28, // Y where straight line ends and top curve begins
|
|
205
|
+
senderTailTipX: 16,
|
|
206
|
+
senderTailTipY: -1,
|
|
207
|
+
senderTailBottomX: -19, // X where bottom curve ends (connects to bubble)
|
|
208
|
+
senderTailBottomY: -12, // Y where bottom curve ends (connects to bubble)
|
|
209
|
+
// Sender tail curve bend (-1 to 1, negative = inward, positive = outward)
|
|
210
|
+
senderTailTopBend: -0.32, // Top curve bends inward
|
|
211
|
+
senderTailBottomBend: 0.3, // Bottom curve bends outward
|
|
212
|
+
// Read receipt (under last sender message)
|
|
213
|
+
showReadReceipt: true,
|
|
214
|
+
readReceiptText: 'Read 12:16 PM',
|
|
215
|
+
readReceiptGap: 52,
|
|
216
|
+
readReceiptFontSize: 35,
|
|
217
|
+
readReceiptLetterSpacing: 0.9,
|
|
218
|
+
readReceiptColor: '#626167',
|
|
219
|
+
readReceiptLeft: 0,
|
|
220
|
+
readReceiptRight: 1158,
|
|
221
|
+
// Example messages
|
|
222
|
+
messages: [
|
|
223
|
+
{ id: 'msg-1', sender: 'user', text: 'heyyy fae, help me slide on this baddie pls 🙏', imageUrl: 'https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/06c3ed1c-eefb-4a60-b0c4-5fb872811ba0/pinterest-1766175214139-0-JpXmGIxVWdjEJ3qxGyoC4DAi2KAZrg.jpg' },
|
|
224
|
+
{ id: 'msg-2', sender: 'recipient', text: 'don\'t worry king, i gotchu' },
|
|
225
|
+
{ id: 'msg-3', sender: 'recipient', text: 'that is indeed a cute kitty', groupWithPrevious: true },
|
|
226
|
+
{ id: 'msg-4', sender: 'recipient', text: 'try this line out for speed: are you a kitty? because you deserve pets', groupWithPrevious: true },
|
|
227
|
+
],
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* iMessage DM Composition Component
|
|
231
|
+
*/
|
|
232
|
+
const IMessageDmComposition = (props) => {
|
|
233
|
+
const [fontsLoaded, setFontsLoaded] = (0, react_1.useState)(false);
|
|
234
|
+
// Load fonts before text measurement - required for accurate line breaks
|
|
235
|
+
(0, react_1.useEffect)(() => {
|
|
236
|
+
const handle = (0, remotion_1.delayRender)('Loading fonts for IMessageDmComposition');
|
|
237
|
+
const loadFonts = async () => {
|
|
238
|
+
await (0, fonts_1.preloadFonts)();
|
|
239
|
+
// Wait for document.fonts.ready to ensure fonts are fully available for DOM measurement
|
|
240
|
+
if (typeof document !== 'undefined' && document.fonts?.ready) {
|
|
241
|
+
await document.fonts.ready;
|
|
242
|
+
}
|
|
243
|
+
// Give the browser an extra frame to actually apply the fonts for measurement
|
|
244
|
+
// This is necessary because fonts.ready resolves before fonts are visually applied
|
|
245
|
+
await new Promise((resolve) => {
|
|
246
|
+
if (typeof requestAnimationFrame !== 'undefined') {
|
|
247
|
+
requestAnimationFrame(() => {
|
|
248
|
+
requestAnimationFrame(() => {
|
|
249
|
+
resolve();
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
resolve();
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
loadFonts()
|
|
259
|
+
.then(() => {
|
|
260
|
+
setFontsLoaded(true);
|
|
261
|
+
(0, remotion_1.continueRender)(handle);
|
|
262
|
+
})
|
|
263
|
+
.catch((err) => {
|
|
264
|
+
console.error('[IMessageDmComposition] Failed to load fonts:', err);
|
|
265
|
+
// Continue anyway to avoid hanging
|
|
266
|
+
setFontsLoaded(true);
|
|
267
|
+
(0, remotion_1.continueRender)(handle);
|
|
268
|
+
});
|
|
269
|
+
}, []);
|
|
270
|
+
// Merge props with defaults
|
|
271
|
+
const mergedProps = (0, react_1.useMemo)(() => ({
|
|
272
|
+
...exports.defaultIMessageDmProps,
|
|
273
|
+
...props,
|
|
274
|
+
}), [props]);
|
|
275
|
+
// Convert props to elements (for messages only) - only after fonts are loaded
|
|
276
|
+
const conversionResult = (0, react_1.useMemo)(() => {
|
|
277
|
+
// Return empty elements until fonts are loaded to avoid incorrect text measurement
|
|
278
|
+
if (!fontsLoaded) {
|
|
279
|
+
return { elements: [], imageUrls: {}, tails: [], width: mergedProps.width ?? 1206, height: mergedProps.height ?? 2622 };
|
|
280
|
+
}
|
|
281
|
+
// Apply light mode colors for message bubbles
|
|
282
|
+
const propsWithEffectiveColors = {
|
|
283
|
+
...mergedProps,
|
|
284
|
+
recipientBubbleColor: mergedProps.lightMode ? '#dfdfe1' : (mergedProps.recipientBubbleColor ?? '#303032'),
|
|
285
|
+
recipientTextColor: mergedProps.lightMode ? '#000000' : (mergedProps.recipientTextColor ?? '#ffffff'),
|
|
286
|
+
};
|
|
287
|
+
return (0, convertPropsToElements_1.convertPropsToElements)(propsWithEffectiveColors);
|
|
288
|
+
}, [mergedProps, fontsLoaded]);
|
|
289
|
+
// Extract values with defaults
|
|
290
|
+
const { width = 1206, height = 2622, backgroundColor = '#000000', headerBackgroundColor = '#171717', headerBottom = 424, lightMode = false,
|
|
291
|
+
// Profile section
|
|
292
|
+
profilePicUrl, profilePicTop = 195, profilePicBottom = 347, profilePicLeft = 528, profilePicRight = 680, username = 'aidan gollan', usernameTop = 355, usernameBottom = 404, usernameLeft = 429, usernameRight = 752, usernameFontSize = 36, usernameLetterSpacing = 0.8, usernameColor = '#ffffff', usernameArrowOffsetX = -57, usernameArrowOffsetY = 2, usernameArrowWidth = 14, usernameArrowHeight = 24,
|
|
293
|
+
// Back arrow
|
|
294
|
+
backArrowTop = 234, backArrowBottom = 297, backArrowLeft = 50, backArrowRight = 87,
|
|
295
|
+
// Unread badge
|
|
296
|
+
unreadBadgeText = '579', unreadBadgeTop = 238, unreadBadgeBottom = 293, unreadBadgeLeft = 108, unreadBadgeFontSize = 36, unreadBadgeLetterSpacing = 0.2, unreadBadgeTextColor = '#ffffff', unreadBadgeBorderRadius = 9999, unreadBadgePaddingLeft = 17, unreadBadgePaddingRight = 17,
|
|
297
|
+
// Camera icon
|
|
298
|
+
cameraIconTop = 237, cameraIconBottom = 292, cameraIconLeft = 1053, cameraIconRight = 1134, dividerLineY = 425, dividerLineColor = '#262626', showDebugOverlay = false, referenceImageUrl, showReferenceImage = false, referenceOpacity = 50,
|
|
299
|
+
// Status bar props (passed to BaseDmComposition)
|
|
300
|
+
time = '9:41', timeRight = 262, timeBottom = 125, timeFontSize = 52, timeLetterSpacing = 1.6, noNotisTop = 77, noNotisBottom = 120, noNotisLeft = 272, noNotisRight = 312, cellLevel = 4, cell1Top = 102, cell1Bottom = 116, cell1Left = 865, cell1Right = 875, cell2Top = 95, cell2Bottom = 116, cell2Left = 881, cell2Right = 891, cell3Top = 87, cell3Bottom = 116, cell3Left = 897, cell3Right = 907, cell4Top = 79, cell4Bottom = 116, cell4Left = 913, cell4Right = 923, wifiTop = 79, wifiBottom = 116, wifiLeft = 945, wifiRight = 996, batteryTop = 78, batteryBottom = 117, batteryLeft = 1018, batteryRight = 1100,
|
|
301
|
+
// Home indicator props (passed to BaseDmComposition)
|
|
302
|
+
homeIndicatorTop = 2583, homeIndicatorBottom = 2597, homeIndicatorLeft = 387, homeIndicatorRight = 818, homeIndicatorColor = '#ffffff',
|
|
303
|
+
// Plus button
|
|
304
|
+
plusButtonTop = 2390, plusButtonBottom = 2491, plusButtonLeft = 42, plusButtonRight = 143,
|
|
305
|
+
// Footer
|
|
306
|
+
footerTop = 2385, footerBottom = 2495, footerLeft = 180, footerRight = 1157, footerBgColor = '#1c1c1e', footerBorderRadius = 55, footerBorderColor = '#3a3a3c', footerBorderWidth = 2,
|
|
307
|
+
// Bubble colors
|
|
308
|
+
senderBubbleColor = '#1a42d5', recipientBubbleColor = '#303032',
|
|
309
|
+
// Tail props - recipient (offsets from message left & bottom)
|
|
310
|
+
recipientTailSideY = -53, recipientTailCurveStartY = -28, recipientTailTipX = -16, recipientTailTipY = -1, recipientTailBottomX = 19, recipientTailBottomY = -12, recipientTailTopBend = -0.32, recipientTailBottomBend = 0.3,
|
|
311
|
+
// Tail props - sender (offsets from message right & bottom)
|
|
312
|
+
senderTailSideY = -53, senderTailCurveStartY = -28, senderTailTipX = 16, senderTailTipY = -1, senderTailBottomX = -19, senderTailBottomY = -12, senderTailTopBend = -0.32, senderTailBottomBend = 0.3, } = mergedProps;
|
|
313
|
+
// Compute effective colors based on light mode
|
|
314
|
+
const effectiveBackgroundColor = lightMode ? '#ffffff' : backgroundColor;
|
|
315
|
+
const effectiveHeaderBgColor = lightMode ? '#f7f7f7' : headerBackgroundColor;
|
|
316
|
+
const effectiveRecipientBubbleColor = lightMode ? '#dfdfe1' : recipientBubbleColor;
|
|
317
|
+
const effectiveRecipientTextColor = lightMode ? '#000000' : '#ffffff';
|
|
318
|
+
const effectiveUsernameColor = lightMode ? '#000000' : usernameColor;
|
|
319
|
+
const effectiveHomeIndicatorColor = lightMode ? '#000000' : homeIndicatorColor;
|
|
320
|
+
const effectiveStatusBarColor = lightMode ? '#000000' : '#ffffff';
|
|
321
|
+
return ((0, jsx_runtime_1.jsxs)(DmComposition_1.BaseDmComposition, { width: width, height: height, backgroundColor: effectiveBackgroundColor, showDebugOverlay: showDebugOverlay, referenceImageUrl: referenceImageUrl, showReferenceImage: showReferenceImage, referenceOpacity: referenceOpacity, currentProps: { ...mergedProps },
|
|
322
|
+
// Status bar props
|
|
323
|
+
time: time, timeRight: timeRight, timeBottom: timeBottom, timeFontSize: timeFontSize, timeLetterSpacing: timeLetterSpacing, noNotisTop: noNotisTop, noNotisBottom: noNotisBottom, noNotisLeft: noNotisLeft, noNotisRight: noNotisRight, cellLevel: cellLevel, cell1Top: cell1Top, cell1Bottom: cell1Bottom, cell1Left: cell1Left, cell1Right: cell1Right, cell2Top: cell2Top, cell2Bottom: cell2Bottom, cell2Left: cell2Left, cell2Right: cell2Right, cell3Top: cell3Top, cell3Bottom: cell3Bottom, cell3Left: cell3Left, cell3Right: cell3Right, cell4Top: cell4Top, cell4Bottom: cell4Bottom, cell4Left: cell4Left, cell4Right: cell4Right, wifiTop: wifiTop, wifiBottom: wifiBottom, wifiLeft: wifiLeft, wifiRight: wifiRight, batteryTop: batteryTop, batteryBottom: batteryBottom, batteryLeft: batteryLeft, batteryRight: batteryRight,
|
|
324
|
+
// Home indicator props
|
|
325
|
+
homeIndicatorTop: homeIndicatorTop, homeIndicatorBottom: homeIndicatorBottom, homeIndicatorLeft: homeIndicatorLeft, homeIndicatorRight: homeIndicatorRight, homeIndicatorColor: effectiveHomeIndicatorColor,
|
|
326
|
+
// Status bar color for light mode
|
|
327
|
+
statusBarColor: effectiveStatusBarColor, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
328
|
+
position: 'absolute',
|
|
329
|
+
top: 0,
|
|
330
|
+
left: 0,
|
|
331
|
+
width,
|
|
332
|
+
height,
|
|
333
|
+
backgroundColor: effectiveBackgroundColor,
|
|
334
|
+
zIndex: 0,
|
|
335
|
+
} }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
336
|
+
position: 'absolute',
|
|
337
|
+
top: 0,
|
|
338
|
+
left: 0,
|
|
339
|
+
width,
|
|
340
|
+
height: headerBottom,
|
|
341
|
+
backgroundColor: effectiveHeaderBgColor,
|
|
342
|
+
zIndex: 25,
|
|
343
|
+
} }), (0, jsx_runtime_1.jsx)(remotion_1.Img, { src: (0, remotion_1.staticFile)(lightMode ? 'imsg-light-header-left-arrow.png' : 'imsg-header-left-arrow.png'), style: {
|
|
344
|
+
position: 'absolute',
|
|
345
|
+
top: backArrowTop,
|
|
346
|
+
left: backArrowLeft,
|
|
347
|
+
width: backArrowRight - backArrowLeft,
|
|
348
|
+
height: backArrowBottom - backArrowTop,
|
|
349
|
+
zIndex: 26,
|
|
350
|
+
} }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
351
|
+
position: 'absolute',
|
|
352
|
+
top: unreadBadgeTop,
|
|
353
|
+
left: unreadBadgeLeft,
|
|
354
|
+
height: unreadBadgeBottom - unreadBadgeTop,
|
|
355
|
+
display: 'flex',
|
|
356
|
+
alignItems: 'center',
|
|
357
|
+
justifyContent: 'center',
|
|
358
|
+
backgroundColor: senderBubbleColor,
|
|
359
|
+
borderRadius: unreadBadgeBorderRadius,
|
|
360
|
+
paddingLeft: unreadBadgePaddingLeft,
|
|
361
|
+
paddingRight: unreadBadgePaddingRight,
|
|
362
|
+
zIndex: 26,
|
|
363
|
+
}, children: (0, jsx_runtime_1.jsx)("span", { style: {
|
|
364
|
+
fontFamily: '"SF Pro Display", "Apple Color Emoji", sans-serif',
|
|
365
|
+
fontWeight: 400,
|
|
366
|
+
fontSize: unreadBadgeFontSize,
|
|
367
|
+
letterSpacing: unreadBadgeLetterSpacing,
|
|
368
|
+
color: unreadBadgeTextColor,
|
|
369
|
+
whiteSpace: 'nowrap',
|
|
370
|
+
}, children: unreadBadgeText }) }), (0, jsx_runtime_1.jsx)(remotion_1.Img, { src: (0, remotion_1.staticFile)(lightMode ? 'imsg-light-header-camera.png' : 'imsg-header-camera.png'), style: {
|
|
371
|
+
position: 'absolute',
|
|
372
|
+
top: cameraIconTop,
|
|
373
|
+
left: cameraIconLeft,
|
|
374
|
+
width: cameraIconRight - cameraIconLeft,
|
|
375
|
+
height: cameraIconBottom - cameraIconTop,
|
|
376
|
+
zIndex: 26,
|
|
377
|
+
} }), (0, jsx_runtime_1.jsx)("div", { style: {
|
|
378
|
+
position: 'absolute',
|
|
379
|
+
top: dividerLineY,
|
|
380
|
+
left: 0,
|
|
381
|
+
width,
|
|
382
|
+
height: 1,
|
|
383
|
+
backgroundColor: dividerLineColor,
|
|
384
|
+
zIndex: 25,
|
|
385
|
+
} }), profilePicUrl && ((0, jsx_runtime_1.jsx)(remotion_1.Img, { src: profilePicUrl, style: {
|
|
386
|
+
position: 'absolute',
|
|
387
|
+
top: profilePicTop,
|
|
388
|
+
left: profilePicLeft,
|
|
389
|
+
width: profilePicRight - profilePicLeft,
|
|
390
|
+
height: profilePicBottom - profilePicTop,
|
|
391
|
+
borderRadius: '50%',
|
|
392
|
+
objectFit: 'cover',
|
|
393
|
+
zIndex: 26,
|
|
394
|
+
} })), username && ((0, jsx_runtime_1.jsxs)("div", { style: {
|
|
395
|
+
position: 'absolute',
|
|
396
|
+
top: usernameTop,
|
|
397
|
+
left: usernameLeft,
|
|
398
|
+
width: usernameRight - usernameLeft,
|
|
399
|
+
height: usernameBottom - usernameTop,
|
|
400
|
+
display: 'flex',
|
|
401
|
+
alignItems: 'center',
|
|
402
|
+
justifyContent: 'center',
|
|
403
|
+
zIndex: 26,
|
|
404
|
+
}, children: [(0, jsx_runtime_1.jsx)("span", { style: {
|
|
405
|
+
fontFamily: '"SF Pro Display", "Apple Color Emoji", sans-serif',
|
|
406
|
+
fontWeight: 400,
|
|
407
|
+
fontSize: usernameFontSize,
|
|
408
|
+
letterSpacing: usernameLetterSpacing,
|
|
409
|
+
color: effectiveUsernameColor,
|
|
410
|
+
whiteSpace: 'nowrap',
|
|
411
|
+
}, children: username }), (0, jsx_runtime_1.jsx)(remotion_1.Img, { src: (0, remotion_1.staticFile)('imsg-name-right-arrow.png'), style: {
|
|
412
|
+
marginLeft: usernameArrowOffsetX,
|
|
413
|
+
marginTop: usernameArrowOffsetY,
|
|
414
|
+
width: usernameArrowWidth,
|
|
415
|
+
height: usernameArrowHeight,
|
|
416
|
+
} })] })), (0, jsx_runtime_1.jsx)(remotion_1.Img, { src: (0, remotion_1.staticFile)(lightMode ? 'imsg-light-footer-plus.png' : 'imsg-footer-plus.png'), style: {
|
|
417
|
+
position: 'absolute',
|
|
418
|
+
top: plusButtonTop,
|
|
419
|
+
left: plusButtonLeft,
|
|
420
|
+
width: plusButtonRight - plusButtonLeft,
|
|
421
|
+
height: plusButtonBottom - plusButtonTop,
|
|
422
|
+
zIndex: 20,
|
|
423
|
+
} }), (0, jsx_runtime_1.jsx)(remotion_1.Img, { src: (0, remotion_1.staticFile)(lightMode ? 'imsg-light-main-footer.png' : 'imsg-main-footer.png'), style: {
|
|
424
|
+
position: 'absolute',
|
|
425
|
+
top: footerTop,
|
|
426
|
+
left: footerLeft,
|
|
427
|
+
width: footerRight - footerLeft,
|
|
428
|
+
height: footerBottom - footerTop,
|
|
429
|
+
zIndex: 20,
|
|
430
|
+
} }), conversionResult.tails.map((tail) => {
|
|
431
|
+
// Reference point: bubble edge (left for recipient, right for sender) and bottom
|
|
432
|
+
const refX = tail.isUser ? tail.messageRight : tail.messageLeft;
|
|
433
|
+
const refY = tail.messageBottom;
|
|
434
|
+
// Get the appropriate offsets
|
|
435
|
+
const sideY = refY + (tail.isUser ? senderTailSideY : recipientTailSideY);
|
|
436
|
+
const curveStartY = refY + (tail.isUser ? senderTailCurveStartY : recipientTailCurveStartY);
|
|
437
|
+
const tipX = refX + (tail.isUser ? senderTailTipX : recipientTailTipX);
|
|
438
|
+
const tipY = refY + (tail.isUser ? senderTailTipY : recipientTailTipY);
|
|
439
|
+
const bottomX = refX + (tail.isUser ? senderTailBottomX : recipientTailBottomX);
|
|
440
|
+
const bottomY = refY + (tail.isUser ? senderTailBottomY : recipientTailBottomY);
|
|
441
|
+
const topBend = tail.isUser ? senderTailTopBend : recipientTailTopBend;
|
|
442
|
+
const bottomBend = tail.isUser ? senderTailBottomBend : recipientTailBottomBend;
|
|
443
|
+
// Side X is always at the bubble edge (refX)
|
|
444
|
+
const sideX = refX;
|
|
445
|
+
const curveStartX = refX;
|
|
446
|
+
// Calculate control points based on bend values
|
|
447
|
+
// For top curve: from curveStart to tip
|
|
448
|
+
const topMidX = (curveStartX + tipX) / 2;
|
|
449
|
+
const topMidY = (curveStartY + tipY) / 2;
|
|
450
|
+
// Perpendicular direction (rotated 90 degrees)
|
|
451
|
+
const topDx = tipX - curveStartX;
|
|
452
|
+
const topDy = tipY - curveStartY;
|
|
453
|
+
const topLen = Math.sqrt(topDx * topDx + topDy * topDy);
|
|
454
|
+
// Perpendicular unit vector (for recipient: positive bend = outward/left, for sender: positive bend = outward/right)
|
|
455
|
+
const topPerpX = tail.isUser ? (topDy / topLen) : (-topDy / topLen);
|
|
456
|
+
const topPerpY = tail.isUser ? (-topDx / topLen) : (topDx / topLen);
|
|
457
|
+
const topCurveX = topMidX + topPerpX * topBend * topLen;
|
|
458
|
+
const topCurveY = topMidY + topPerpY * topBend * topLen;
|
|
459
|
+
// For bottom curve: from tip to bottom
|
|
460
|
+
const bottomMidX = (tipX + bottomX) / 2;
|
|
461
|
+
const bottomMidY = (tipY + bottomY) / 2;
|
|
462
|
+
const bottomDx = bottomX - tipX;
|
|
463
|
+
const bottomDy = bottomY - tipY;
|
|
464
|
+
const bottomLen = Math.sqrt(bottomDx * bottomDx + bottomDy * bottomDy);
|
|
465
|
+
// Perpendicular unit vector
|
|
466
|
+
const bottomPerpX = tail.isUser ? (bottomDy / bottomLen) : (-bottomDy / bottomLen);
|
|
467
|
+
const bottomPerpY = tail.isUser ? (-bottomDx / bottomLen) : (bottomDx / bottomLen);
|
|
468
|
+
const bottomCurveX = bottomMidX + bottomPerpX * bottomBend * bottomLen;
|
|
469
|
+
const bottomCurveY = bottomMidY + bottomPerpY * bottomBend * bottomLen;
|
|
470
|
+
const fillColor = tail.isUser ? senderBubbleColor : effectiveRecipientBubbleColor;
|
|
471
|
+
// SVG path: Side -> straight down to curveStart -> curve to Tip -> curve to Bottom -> close
|
|
472
|
+
const pathD = `M ${sideX} ${sideY} L ${curveStartX} ${curveStartY} Q ${topCurveX} ${topCurveY} ${tipX} ${tipY} Q ${bottomCurveX} ${bottomCurveY} ${bottomX} ${bottomY} Z`;
|
|
473
|
+
return ((0, jsx_runtime_1.jsx)("svg", { style: {
|
|
474
|
+
position: 'absolute',
|
|
475
|
+
top: 0,
|
|
476
|
+
left: 0,
|
|
477
|
+
width,
|
|
478
|
+
height,
|
|
479
|
+
zIndex: 4,
|
|
480
|
+
pointerEvents: 'none',
|
|
481
|
+
}, children: (0, jsx_runtime_1.jsx)("path", { d: pathD, fill: fillColor }) }, tail.id));
|
|
482
|
+
}), (0, jsx_runtime_1.jsx)(ImageEditorComposition_1.ImageEditorComposition, { width: width, height: height, elements: conversionResult.elements, imageUrls: conversionResult.imageUrls, backgroundType: "color", backgroundColor: "transparent" })] }));
|
|
483
|
+
};
|
|
484
|
+
exports.IMessageDmComposition = IMessageDmComposition;
|
|
485
|
+
exports.default = exports.IMessageDmComposition;
|