ugcinc-render 1.8.56 → 1.8.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +169 -144
- package/dist/index.mjs +176 -151
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4341,35 +4341,58 @@ function IgMessageList({
|
|
|
4341
4341
|
// src/compositions/InstagramDmComposition/components/DebugOverlay.tsx
|
|
4342
4342
|
var import_react7 = require("react");
|
|
4343
4343
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4344
|
-
function DebugOverlay({
|
|
4344
|
+
function DebugOverlay({
|
|
4345
|
+
width,
|
|
4346
|
+
height,
|
|
4347
|
+
scrollContainerRef,
|
|
4348
|
+
onZoomChange,
|
|
4349
|
+
initialZoom = 100
|
|
4350
|
+
}) {
|
|
4345
4351
|
const [mousePos, setMousePos] = (0, import_react7.useState)(null);
|
|
4346
4352
|
const [zoom, setZoom] = (0, import_react7.useState)(initialZoom);
|
|
4347
|
-
(0, import_react7.useEffect)(() => {
|
|
4348
|
-
onZoomChange?.(zoom);
|
|
4349
|
-
}, [zoom, onZoomChange]);
|
|
4350
4353
|
const handleMouseMove = (0, import_react7.useCallback)(
|
|
4351
4354
|
(e) => {
|
|
4355
|
+
const container = scrollContainerRef.current;
|
|
4356
|
+
if (!container) return;
|
|
4352
4357
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
4353
|
-
const
|
|
4354
|
-
const
|
|
4355
|
-
const
|
|
4356
|
-
const
|
|
4358
|
+
const currentZoom = zoom / 100;
|
|
4359
|
+
const mouseViewX = e.clientX - rect.left;
|
|
4360
|
+
const mouseViewY = e.clientY - rect.top;
|
|
4361
|
+
const scrollLeft = container.scrollLeft;
|
|
4362
|
+
const scrollTop = container.scrollTop;
|
|
4363
|
+
const x = Math.round((scrollLeft + mouseViewX) / currentZoom);
|
|
4364
|
+
const y = Math.round((scrollTop + mouseViewY) / currentZoom);
|
|
4357
4365
|
setMousePos({ x, y });
|
|
4358
4366
|
},
|
|
4359
|
-
[width, height]
|
|
4367
|
+
[width, height, zoom, scrollContainerRef]
|
|
4360
4368
|
);
|
|
4361
4369
|
const handleMouseLeave = (0, import_react7.useCallback)(() => {
|
|
4362
4370
|
setMousePos(null);
|
|
4363
4371
|
}, []);
|
|
4364
|
-
const handleWheel = (0, import_react7.useCallback)(
|
|
4365
|
-
e
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4372
|
+
const handleWheel = (0, import_react7.useCallback)(
|
|
4373
|
+
(e) => {
|
|
4374
|
+
e.preventDefault();
|
|
4375
|
+
e.stopPropagation();
|
|
4376
|
+
const container = scrollContainerRef.current;
|
|
4377
|
+
if (!container) return;
|
|
4378
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
4379
|
+
const mouseScreenX = e.clientX - rect.left;
|
|
4380
|
+
const mouseScreenY = e.clientY - rect.top;
|
|
4381
|
+
const scrollLeft = container.scrollLeft;
|
|
4382
|
+
const scrollTop = container.scrollTop;
|
|
4383
|
+
const oldZoom = zoom / 100;
|
|
4384
|
+
const canvasX = (scrollLeft + mouseScreenX) / oldZoom;
|
|
4385
|
+
const canvasY = (scrollTop + mouseScreenY) / oldZoom;
|
|
4386
|
+
const delta = e.deltaY > 0 ? -5 : 5;
|
|
4387
|
+
const newZoomPercent = Math.max(10, Math.min(500, zoom + delta));
|
|
4388
|
+
const newZoom = newZoomPercent / 100;
|
|
4389
|
+
const newScrollLeft = canvasX * newZoom - mouseScreenX;
|
|
4390
|
+
const newScrollTop = canvasY * newZoom - mouseScreenY;
|
|
4391
|
+
setZoom(newZoomPercent);
|
|
4392
|
+
onZoomChange?.(newZoomPercent, newScrollLeft, newScrollTop);
|
|
4393
|
+
},
|
|
4394
|
+
[zoom, onZoomChange, scrollContainerRef]
|
|
4395
|
+
);
|
|
4373
4396
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4374
4397
|
"div",
|
|
4375
4398
|
{
|
|
@@ -4386,36 +4409,7 @@ function DebugOverlay({ width, height, onZoomChange, initialZoom = 100 }) {
|
|
|
4386
4409
|
onMouseLeave: handleMouseLeave,
|
|
4387
4410
|
onWheel: handleWheel,
|
|
4388
4411
|
children: [
|
|
4389
|
-
mousePos && /* @__PURE__ */ (0, import_jsx_runtime22.
|
|
4390
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4391
|
-
"div",
|
|
4392
|
-
{
|
|
4393
|
-
style: {
|
|
4394
|
-
position: "absolute",
|
|
4395
|
-
top: 0,
|
|
4396
|
-
left: mousePos.x,
|
|
4397
|
-
width: 1,
|
|
4398
|
-
height: "100%",
|
|
4399
|
-
backgroundColor: "rgba(255, 0, 0, 0.5)",
|
|
4400
|
-
pointerEvents: "none"
|
|
4401
|
-
}
|
|
4402
|
-
}
|
|
4403
|
-
),
|
|
4404
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4405
|
-
"div",
|
|
4406
|
-
{
|
|
4407
|
-
style: {
|
|
4408
|
-
position: "absolute",
|
|
4409
|
-
top: mousePos.y,
|
|
4410
|
-
left: 0,
|
|
4411
|
-
width: "100%",
|
|
4412
|
-
height: 1,
|
|
4413
|
-
backgroundColor: "rgba(255, 0, 0, 0.5)",
|
|
4414
|
-
pointerEvents: "none"
|
|
4415
|
-
}
|
|
4416
|
-
}
|
|
4417
|
-
)
|
|
4418
|
-
] }),
|
|
4412
|
+
mousePos && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, {}),
|
|
4419
4413
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4420
4414
|
"div",
|
|
4421
4415
|
{
|
|
@@ -4474,7 +4468,7 @@ function DebugOverlay({ width, height, onZoomChange, initialZoom = 100 }) {
|
|
|
4474
4468
|
zoom,
|
|
4475
4469
|
"%"
|
|
4476
4470
|
] }),
|
|
4477
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#888", fontSize: 16, marginTop: 4 }, children: "(scroll to zoom)" })
|
|
4471
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#888", fontSize: 16, marginTop: 4 }, children: "(scroll to zoom, drag to pan)" })
|
|
4478
4472
|
]
|
|
4479
4473
|
}
|
|
4480
4474
|
)
|
|
@@ -4539,6 +4533,16 @@ function InstagramDmComposition({
|
|
|
4539
4533
|
}) {
|
|
4540
4534
|
const [fontsLoaded, setFontsLoaded] = (0, import_react8.useState)(false);
|
|
4541
4535
|
const [zoom, setZoom] = (0, import_react8.useState)(100);
|
|
4536
|
+
const scrollContainerRef = (0, import_react8.useRef)(null);
|
|
4537
|
+
const handleZoomChange = (0, import_react8.useCallback)((newZoom, scrollX, scrollY) => {
|
|
4538
|
+
setZoom(newZoom);
|
|
4539
|
+
requestAnimationFrame(() => {
|
|
4540
|
+
if (scrollContainerRef.current) {
|
|
4541
|
+
scrollContainerRef.current.scrollLeft = Math.max(0, scrollX);
|
|
4542
|
+
scrollContainerRef.current.scrollTop = Math.max(0, scrollY);
|
|
4543
|
+
}
|
|
4544
|
+
});
|
|
4545
|
+
}, []);
|
|
4542
4546
|
(0, import_react8.useEffect)(() => {
|
|
4543
4547
|
const handle = (0, import_remotion14.delayRender)("Loading fonts...");
|
|
4544
4548
|
preloadFonts().then(() => {
|
|
@@ -4564,120 +4568,140 @@ function InstagramDmComposition({
|
|
|
4564
4568
|
const footerHeight = mergedFooter.height;
|
|
4565
4569
|
const contentTop = headerHeight;
|
|
4566
4570
|
const contentHeight = height - headerHeight - footerHeight;
|
|
4567
|
-
const handleZoomChange = (0, import_react8.useCallback)((newZoom) => {
|
|
4568
|
-
setZoom(newZoom);
|
|
4569
|
-
}, []);
|
|
4570
4571
|
const zoomScale = zoom / 100;
|
|
4571
4572
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4572
4573
|
import_remotion14.AbsoluteFill,
|
|
4573
4574
|
{
|
|
4574
4575
|
style: {
|
|
4575
4576
|
backgroundColor: colors.background,
|
|
4576
|
-
fontFamily: '"SF Pro", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Apple Color Emoji", sans-serif'
|
|
4577
|
-
overflow: "hidden"
|
|
4577
|
+
fontFamily: '"SF Pro", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Apple Color Emoji", sans-serif'
|
|
4578
4578
|
},
|
|
4579
4579
|
children: [
|
|
4580
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.
|
|
4580
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4581
4581
|
"div",
|
|
4582
4582
|
{
|
|
4583
|
+
ref: scrollContainerRef,
|
|
4583
4584
|
style: {
|
|
4584
4585
|
position: "absolute",
|
|
4585
4586
|
top: 0,
|
|
4586
4587
|
left: 0,
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
transformOrigin: "top left"
|
|
4588
|
+
right: 0,
|
|
4589
|
+
bottom: 0,
|
|
4590
|
+
overflow: showDebugOverlay ? "auto" : "hidden"
|
|
4591
4591
|
},
|
|
4592
|
-
children:
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
{
|
|
4617
|
-
style: {
|
|
4618
|
-
position: "absolute",
|
|
4619
|
-
top: 0,
|
|
4620
|
-
left: 0,
|
|
4621
|
-
right: 0,
|
|
4622
|
-
bottom: 0,
|
|
4623
|
-
display: "flex",
|
|
4624
|
-
flexDirection: "column",
|
|
4625
|
-
justifyContent: "flex-end",
|
|
4626
|
-
paddingBottom: 16
|
|
4627
|
-
},
|
|
4628
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4629
|
-
IgMessageList,
|
|
4592
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4593
|
+
"div",
|
|
4594
|
+
{
|
|
4595
|
+
style: {
|
|
4596
|
+
width: width * zoomScale,
|
|
4597
|
+
height: height * zoomScale,
|
|
4598
|
+
position: "relative"
|
|
4599
|
+
},
|
|
4600
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
4601
|
+
"div",
|
|
4602
|
+
{
|
|
4603
|
+
style: {
|
|
4604
|
+
position: "absolute",
|
|
4605
|
+
top: 0,
|
|
4606
|
+
left: 0,
|
|
4607
|
+
width,
|
|
4608
|
+
height,
|
|
4609
|
+
transform: `scale(${zoomScale})`,
|
|
4610
|
+
transformOrigin: "top left"
|
|
4611
|
+
},
|
|
4612
|
+
children: [
|
|
4613
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(IgStatusBar, { config: mergedStatusBar, theme, width }),
|
|
4614
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4615
|
+
IgHeader,
|
|
4630
4616
|
{
|
|
4631
|
-
|
|
4632
|
-
imageUrls,
|
|
4633
|
-
style: mergedStyle,
|
|
4617
|
+
config: mergedHeader,
|
|
4634
4618
|
theme,
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4619
|
+
recipient,
|
|
4620
|
+
avatarUrl: recipientAvatarUrl
|
|
4621
|
+
}
|
|
4622
|
+
),
|
|
4623
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4624
|
+
"div",
|
|
4625
|
+
{
|
|
4626
|
+
style: {
|
|
4627
|
+
position: "absolute",
|
|
4628
|
+
top: contentTop,
|
|
4629
|
+
left: 0,
|
|
4630
|
+
right: 0,
|
|
4631
|
+
height: contentHeight,
|
|
4632
|
+
overflow: "hidden"
|
|
4633
|
+
},
|
|
4634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4635
|
+
"div",
|
|
4636
|
+
{
|
|
4637
|
+
style: {
|
|
4638
|
+
position: "absolute",
|
|
4639
|
+
top: 0,
|
|
4640
|
+
left: 0,
|
|
4641
|
+
right: 0,
|
|
4642
|
+
bottom: 0,
|
|
4643
|
+
display: "flex",
|
|
4644
|
+
flexDirection: "column",
|
|
4645
|
+
justifyContent: "flex-end",
|
|
4646
|
+
paddingBottom: 16
|
|
4647
|
+
},
|
|
4648
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4649
|
+
IgMessageList,
|
|
4650
|
+
{
|
|
4651
|
+
messages,
|
|
4652
|
+
imageUrls,
|
|
4653
|
+
style: mergedStyle,
|
|
4654
|
+
theme,
|
|
4655
|
+
containerWidth: width - mergedStyle.sideMargin * 2,
|
|
4656
|
+
showTypingIndicator,
|
|
4657
|
+
readReceipt,
|
|
4658
|
+
recipientAvatarUrl,
|
|
4659
|
+
scrollOffset
|
|
4660
|
+
}
|
|
4661
|
+
)
|
|
4662
|
+
}
|
|
4663
|
+
)
|
|
4664
|
+
}
|
|
4665
|
+
),
|
|
4666
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4667
|
+
IgFooter,
|
|
4668
|
+
{
|
|
4669
|
+
config: mergedFooter,
|
|
4670
|
+
theme,
|
|
4671
|
+
compositionHeight: height
|
|
4672
|
+
}
|
|
4673
|
+
),
|
|
4674
|
+
referenceImageUrl && referenceOpacity > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4675
|
+
"div",
|
|
4676
|
+
{
|
|
4677
|
+
style: {
|
|
4678
|
+
position: "absolute",
|
|
4679
|
+
top: 0,
|
|
4680
|
+
left: 0,
|
|
4681
|
+
right: 0,
|
|
4682
|
+
bottom: 0,
|
|
4683
|
+
zIndex: 100,
|
|
4684
|
+
pointerEvents: "none",
|
|
4685
|
+
opacity: referenceOpacity / 100
|
|
4686
|
+
},
|
|
4687
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4688
|
+
import_remotion14.Img,
|
|
4689
|
+
{
|
|
4690
|
+
src: referenceImageUrl,
|
|
4691
|
+
style: {
|
|
4692
|
+
width: "100%",
|
|
4693
|
+
height: "100%",
|
|
4694
|
+
objectFit: "cover"
|
|
4695
|
+
}
|
|
4696
|
+
}
|
|
4697
|
+
)
|
|
4640
4698
|
}
|
|
4641
4699
|
)
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
IgFooter,
|
|
4648
|
-
{
|
|
4649
|
-
config: mergedFooter,
|
|
4650
|
-
theme,
|
|
4651
|
-
compositionHeight: height
|
|
4652
|
-
}
|
|
4653
|
-
),
|
|
4654
|
-
referenceImageUrl && referenceOpacity > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4655
|
-
"div",
|
|
4656
|
-
{
|
|
4657
|
-
style: {
|
|
4658
|
-
position: "absolute",
|
|
4659
|
-
top: 0,
|
|
4660
|
-
left: 0,
|
|
4661
|
-
right: 0,
|
|
4662
|
-
bottom: 0,
|
|
4663
|
-
zIndex: 100,
|
|
4664
|
-
pointerEvents: "none",
|
|
4665
|
-
opacity: referenceOpacity / 100
|
|
4666
|
-
},
|
|
4667
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4668
|
-
import_remotion14.Img,
|
|
4669
|
-
{
|
|
4670
|
-
src: referenceImageUrl,
|
|
4671
|
-
style: {
|
|
4672
|
-
width: "100%",
|
|
4673
|
-
height: "100%",
|
|
4674
|
-
objectFit: "cover"
|
|
4675
|
-
}
|
|
4676
|
-
}
|
|
4677
|
-
)
|
|
4678
|
-
}
|
|
4679
|
-
)
|
|
4680
|
-
]
|
|
4700
|
+
]
|
|
4701
|
+
}
|
|
4702
|
+
)
|
|
4703
|
+
}
|
|
4704
|
+
)
|
|
4681
4705
|
}
|
|
4682
4706
|
),
|
|
4683
4707
|
showDebugOverlay && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
@@ -4685,6 +4709,7 @@ function InstagramDmComposition({
|
|
|
4685
4709
|
{
|
|
4686
4710
|
width,
|
|
4687
4711
|
height,
|
|
4712
|
+
scrollContainerRef,
|
|
4688
4713
|
onZoomChange: handleZoomChange,
|
|
4689
4714
|
initialZoom: zoom
|
|
4690
4715
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1833,7 +1833,7 @@ function ScreenshotAnimation({
|
|
|
1833
1833
|
}
|
|
1834
1834
|
|
|
1835
1835
|
// src/compositions/InstagramDmComposition/index.tsx
|
|
1836
|
-
import { useCallback as useCallback2, useEffect as
|
|
1836
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useRef, useState as useState3 } from "react";
|
|
1837
1837
|
import { AbsoluteFill as AbsoluteFill5, Img as Img9, continueRender as continueRender2, delayRender as delayRender2 } from "remotion";
|
|
1838
1838
|
|
|
1839
1839
|
// src/compositions/InstagramDmComposition/theme.ts
|
|
@@ -3443,37 +3443,60 @@ function IgMessageList({
|
|
|
3443
3443
|
}
|
|
3444
3444
|
|
|
3445
3445
|
// src/compositions/InstagramDmComposition/components/DebugOverlay.tsx
|
|
3446
|
-
import { useState as useState2, useCallback
|
|
3446
|
+
import { useState as useState2, useCallback } from "react";
|
|
3447
3447
|
import { Fragment, jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3448
|
-
function DebugOverlay({
|
|
3448
|
+
function DebugOverlay({
|
|
3449
|
+
width,
|
|
3450
|
+
height,
|
|
3451
|
+
scrollContainerRef,
|
|
3452
|
+
onZoomChange,
|
|
3453
|
+
initialZoom = 100
|
|
3454
|
+
}) {
|
|
3449
3455
|
const [mousePos, setMousePos] = useState2(null);
|
|
3450
3456
|
const [zoom, setZoom] = useState2(initialZoom);
|
|
3451
|
-
useEffect2(() => {
|
|
3452
|
-
onZoomChange?.(zoom);
|
|
3453
|
-
}, [zoom, onZoomChange]);
|
|
3454
3457
|
const handleMouseMove = useCallback(
|
|
3455
3458
|
(e) => {
|
|
3459
|
+
const container = scrollContainerRef.current;
|
|
3460
|
+
if (!container) return;
|
|
3456
3461
|
const rect = e.currentTarget.getBoundingClientRect();
|
|
3457
|
-
const
|
|
3458
|
-
const
|
|
3459
|
-
const
|
|
3460
|
-
const
|
|
3462
|
+
const currentZoom = zoom / 100;
|
|
3463
|
+
const mouseViewX = e.clientX - rect.left;
|
|
3464
|
+
const mouseViewY = e.clientY - rect.top;
|
|
3465
|
+
const scrollLeft = container.scrollLeft;
|
|
3466
|
+
const scrollTop = container.scrollTop;
|
|
3467
|
+
const x = Math.round((scrollLeft + mouseViewX) / currentZoom);
|
|
3468
|
+
const y = Math.round((scrollTop + mouseViewY) / currentZoom);
|
|
3461
3469
|
setMousePos({ x, y });
|
|
3462
3470
|
},
|
|
3463
|
-
[width, height]
|
|
3471
|
+
[width, height, zoom, scrollContainerRef]
|
|
3464
3472
|
);
|
|
3465
3473
|
const handleMouseLeave = useCallback(() => {
|
|
3466
3474
|
setMousePos(null);
|
|
3467
3475
|
}, []);
|
|
3468
|
-
const handleWheel = useCallback(
|
|
3469
|
-
e
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3476
|
+
const handleWheel = useCallback(
|
|
3477
|
+
(e) => {
|
|
3478
|
+
e.preventDefault();
|
|
3479
|
+
e.stopPropagation();
|
|
3480
|
+
const container = scrollContainerRef.current;
|
|
3481
|
+
if (!container) return;
|
|
3482
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
3483
|
+
const mouseScreenX = e.clientX - rect.left;
|
|
3484
|
+
const mouseScreenY = e.clientY - rect.top;
|
|
3485
|
+
const scrollLeft = container.scrollLeft;
|
|
3486
|
+
const scrollTop = container.scrollTop;
|
|
3487
|
+
const oldZoom = zoom / 100;
|
|
3488
|
+
const canvasX = (scrollLeft + mouseScreenX) / oldZoom;
|
|
3489
|
+
const canvasY = (scrollTop + mouseScreenY) / oldZoom;
|
|
3490
|
+
const delta = e.deltaY > 0 ? -5 : 5;
|
|
3491
|
+
const newZoomPercent = Math.max(10, Math.min(500, zoom + delta));
|
|
3492
|
+
const newZoom = newZoomPercent / 100;
|
|
3493
|
+
const newScrollLeft = canvasX * newZoom - mouseScreenX;
|
|
3494
|
+
const newScrollTop = canvasY * newZoom - mouseScreenY;
|
|
3495
|
+
setZoom(newZoomPercent);
|
|
3496
|
+
onZoomChange?.(newZoomPercent, newScrollLeft, newScrollTop);
|
|
3497
|
+
},
|
|
3498
|
+
[zoom, onZoomChange, scrollContainerRef]
|
|
3499
|
+
);
|
|
3477
3500
|
return /* @__PURE__ */ jsxs15(
|
|
3478
3501
|
"div",
|
|
3479
3502
|
{
|
|
@@ -3490,36 +3513,7 @@ function DebugOverlay({ width, height, onZoomChange, initialZoom = 100 }) {
|
|
|
3490
3513
|
onMouseLeave: handleMouseLeave,
|
|
3491
3514
|
onWheel: handleWheel,
|
|
3492
3515
|
children: [
|
|
3493
|
-
mousePos && /* @__PURE__ */
|
|
3494
|
-
/* @__PURE__ */ jsx22(
|
|
3495
|
-
"div",
|
|
3496
|
-
{
|
|
3497
|
-
style: {
|
|
3498
|
-
position: "absolute",
|
|
3499
|
-
top: 0,
|
|
3500
|
-
left: mousePos.x,
|
|
3501
|
-
width: 1,
|
|
3502
|
-
height: "100%",
|
|
3503
|
-
backgroundColor: "rgba(255, 0, 0, 0.5)",
|
|
3504
|
-
pointerEvents: "none"
|
|
3505
|
-
}
|
|
3506
|
-
}
|
|
3507
|
-
),
|
|
3508
|
-
/* @__PURE__ */ jsx22(
|
|
3509
|
-
"div",
|
|
3510
|
-
{
|
|
3511
|
-
style: {
|
|
3512
|
-
position: "absolute",
|
|
3513
|
-
top: mousePos.y,
|
|
3514
|
-
left: 0,
|
|
3515
|
-
width: "100%",
|
|
3516
|
-
height: 1,
|
|
3517
|
-
backgroundColor: "rgba(255, 0, 0, 0.5)",
|
|
3518
|
-
pointerEvents: "none"
|
|
3519
|
-
}
|
|
3520
|
-
}
|
|
3521
|
-
)
|
|
3522
|
-
] }),
|
|
3516
|
+
mousePos && /* @__PURE__ */ jsx22(Fragment, {}),
|
|
3523
3517
|
/* @__PURE__ */ jsx22(
|
|
3524
3518
|
"div",
|
|
3525
3519
|
{
|
|
@@ -3578,7 +3572,7 @@ function DebugOverlay({ width, height, onZoomChange, initialZoom = 100 }) {
|
|
|
3578
3572
|
zoom,
|
|
3579
3573
|
"%"
|
|
3580
3574
|
] }),
|
|
3581
|
-
/* @__PURE__ */ jsx22("div", { style: { color: "#888", fontSize: 16, marginTop: 4 }, children: "(scroll to zoom)" })
|
|
3575
|
+
/* @__PURE__ */ jsx22("div", { style: { color: "#888", fontSize: 16, marginTop: 4 }, children: "(scroll to zoom, drag to pan)" })
|
|
3582
3576
|
]
|
|
3583
3577
|
}
|
|
3584
3578
|
)
|
|
@@ -3643,7 +3637,17 @@ function InstagramDmComposition({
|
|
|
3643
3637
|
}) {
|
|
3644
3638
|
const [fontsLoaded, setFontsLoaded] = useState3(false);
|
|
3645
3639
|
const [zoom, setZoom] = useState3(100);
|
|
3646
|
-
|
|
3640
|
+
const scrollContainerRef = useRef(null);
|
|
3641
|
+
const handleZoomChange = useCallback2((newZoom, scrollX, scrollY) => {
|
|
3642
|
+
setZoom(newZoom);
|
|
3643
|
+
requestAnimationFrame(() => {
|
|
3644
|
+
if (scrollContainerRef.current) {
|
|
3645
|
+
scrollContainerRef.current.scrollLeft = Math.max(0, scrollX);
|
|
3646
|
+
scrollContainerRef.current.scrollTop = Math.max(0, scrollY);
|
|
3647
|
+
}
|
|
3648
|
+
});
|
|
3649
|
+
}, []);
|
|
3650
|
+
useEffect2(() => {
|
|
3647
3651
|
const handle = delayRender2("Loading fonts...");
|
|
3648
3652
|
preloadFonts().then(() => {
|
|
3649
3653
|
setFontsLoaded(true);
|
|
@@ -3668,120 +3672,140 @@ function InstagramDmComposition({
|
|
|
3668
3672
|
const footerHeight = mergedFooter.height;
|
|
3669
3673
|
const contentTop = headerHeight;
|
|
3670
3674
|
const contentHeight = height - headerHeight - footerHeight;
|
|
3671
|
-
const handleZoomChange = useCallback2((newZoom) => {
|
|
3672
|
-
setZoom(newZoom);
|
|
3673
|
-
}, []);
|
|
3674
3675
|
const zoomScale = zoom / 100;
|
|
3675
3676
|
return /* @__PURE__ */ jsxs16(
|
|
3676
3677
|
AbsoluteFill5,
|
|
3677
3678
|
{
|
|
3678
3679
|
style: {
|
|
3679
3680
|
backgroundColor: colors.background,
|
|
3680
|
-
fontFamily: '"SF Pro", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Apple Color Emoji", sans-serif'
|
|
3681
|
-
overflow: "hidden"
|
|
3681
|
+
fontFamily: '"SF Pro", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Apple Color Emoji", sans-serif'
|
|
3682
3682
|
},
|
|
3683
3683
|
children: [
|
|
3684
|
-
/* @__PURE__ */
|
|
3684
|
+
/* @__PURE__ */ jsx23(
|
|
3685
3685
|
"div",
|
|
3686
3686
|
{
|
|
3687
|
+
ref: scrollContainerRef,
|
|
3687
3688
|
style: {
|
|
3688
3689
|
position: "absolute",
|
|
3689
3690
|
top: 0,
|
|
3690
3691
|
left: 0,
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
transformOrigin: "top left"
|
|
3692
|
+
right: 0,
|
|
3693
|
+
bottom: 0,
|
|
3694
|
+
overflow: showDebugOverlay ? "auto" : "hidden"
|
|
3695
3695
|
},
|
|
3696
|
-
children:
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
{
|
|
3721
|
-
style: {
|
|
3722
|
-
position: "absolute",
|
|
3723
|
-
top: 0,
|
|
3724
|
-
left: 0,
|
|
3725
|
-
right: 0,
|
|
3726
|
-
bottom: 0,
|
|
3727
|
-
display: "flex",
|
|
3728
|
-
flexDirection: "column",
|
|
3729
|
-
justifyContent: "flex-end",
|
|
3730
|
-
paddingBottom: 16
|
|
3731
|
-
},
|
|
3732
|
-
children: /* @__PURE__ */ jsx23(
|
|
3733
|
-
IgMessageList,
|
|
3696
|
+
children: /* @__PURE__ */ jsx23(
|
|
3697
|
+
"div",
|
|
3698
|
+
{
|
|
3699
|
+
style: {
|
|
3700
|
+
width: width * zoomScale,
|
|
3701
|
+
height: height * zoomScale,
|
|
3702
|
+
position: "relative"
|
|
3703
|
+
},
|
|
3704
|
+
children: /* @__PURE__ */ jsxs16(
|
|
3705
|
+
"div",
|
|
3706
|
+
{
|
|
3707
|
+
style: {
|
|
3708
|
+
position: "absolute",
|
|
3709
|
+
top: 0,
|
|
3710
|
+
left: 0,
|
|
3711
|
+
width,
|
|
3712
|
+
height,
|
|
3713
|
+
transform: `scale(${zoomScale})`,
|
|
3714
|
+
transformOrigin: "top left"
|
|
3715
|
+
},
|
|
3716
|
+
children: [
|
|
3717
|
+
/* @__PURE__ */ jsx23(IgStatusBar, { config: mergedStatusBar, theme, width }),
|
|
3718
|
+
/* @__PURE__ */ jsx23(
|
|
3719
|
+
IgHeader,
|
|
3734
3720
|
{
|
|
3735
|
-
|
|
3736
|
-
imageUrls,
|
|
3737
|
-
style: mergedStyle,
|
|
3721
|
+
config: mergedHeader,
|
|
3738
3722
|
theme,
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3723
|
+
recipient,
|
|
3724
|
+
avatarUrl: recipientAvatarUrl
|
|
3725
|
+
}
|
|
3726
|
+
),
|
|
3727
|
+
/* @__PURE__ */ jsx23(
|
|
3728
|
+
"div",
|
|
3729
|
+
{
|
|
3730
|
+
style: {
|
|
3731
|
+
position: "absolute",
|
|
3732
|
+
top: contentTop,
|
|
3733
|
+
left: 0,
|
|
3734
|
+
right: 0,
|
|
3735
|
+
height: contentHeight,
|
|
3736
|
+
overflow: "hidden"
|
|
3737
|
+
},
|
|
3738
|
+
children: /* @__PURE__ */ jsx23(
|
|
3739
|
+
"div",
|
|
3740
|
+
{
|
|
3741
|
+
style: {
|
|
3742
|
+
position: "absolute",
|
|
3743
|
+
top: 0,
|
|
3744
|
+
left: 0,
|
|
3745
|
+
right: 0,
|
|
3746
|
+
bottom: 0,
|
|
3747
|
+
display: "flex",
|
|
3748
|
+
flexDirection: "column",
|
|
3749
|
+
justifyContent: "flex-end",
|
|
3750
|
+
paddingBottom: 16
|
|
3751
|
+
},
|
|
3752
|
+
children: /* @__PURE__ */ jsx23(
|
|
3753
|
+
IgMessageList,
|
|
3754
|
+
{
|
|
3755
|
+
messages,
|
|
3756
|
+
imageUrls,
|
|
3757
|
+
style: mergedStyle,
|
|
3758
|
+
theme,
|
|
3759
|
+
containerWidth: width - mergedStyle.sideMargin * 2,
|
|
3760
|
+
showTypingIndicator,
|
|
3761
|
+
readReceipt,
|
|
3762
|
+
recipientAvatarUrl,
|
|
3763
|
+
scrollOffset
|
|
3764
|
+
}
|
|
3765
|
+
)
|
|
3766
|
+
}
|
|
3767
|
+
)
|
|
3768
|
+
}
|
|
3769
|
+
),
|
|
3770
|
+
/* @__PURE__ */ jsx23(
|
|
3771
|
+
IgFooter,
|
|
3772
|
+
{
|
|
3773
|
+
config: mergedFooter,
|
|
3774
|
+
theme,
|
|
3775
|
+
compositionHeight: height
|
|
3776
|
+
}
|
|
3777
|
+
),
|
|
3778
|
+
referenceImageUrl && referenceOpacity > 0 && /* @__PURE__ */ jsx23(
|
|
3779
|
+
"div",
|
|
3780
|
+
{
|
|
3781
|
+
style: {
|
|
3782
|
+
position: "absolute",
|
|
3783
|
+
top: 0,
|
|
3784
|
+
left: 0,
|
|
3785
|
+
right: 0,
|
|
3786
|
+
bottom: 0,
|
|
3787
|
+
zIndex: 100,
|
|
3788
|
+
pointerEvents: "none",
|
|
3789
|
+
opacity: referenceOpacity / 100
|
|
3790
|
+
},
|
|
3791
|
+
children: /* @__PURE__ */ jsx23(
|
|
3792
|
+
Img9,
|
|
3793
|
+
{
|
|
3794
|
+
src: referenceImageUrl,
|
|
3795
|
+
style: {
|
|
3796
|
+
width: "100%",
|
|
3797
|
+
height: "100%",
|
|
3798
|
+
objectFit: "cover"
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
)
|
|
3744
3802
|
}
|
|
3745
3803
|
)
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
IgFooter,
|
|
3752
|
-
{
|
|
3753
|
-
config: mergedFooter,
|
|
3754
|
-
theme,
|
|
3755
|
-
compositionHeight: height
|
|
3756
|
-
}
|
|
3757
|
-
),
|
|
3758
|
-
referenceImageUrl && referenceOpacity > 0 && /* @__PURE__ */ jsx23(
|
|
3759
|
-
"div",
|
|
3760
|
-
{
|
|
3761
|
-
style: {
|
|
3762
|
-
position: "absolute",
|
|
3763
|
-
top: 0,
|
|
3764
|
-
left: 0,
|
|
3765
|
-
right: 0,
|
|
3766
|
-
bottom: 0,
|
|
3767
|
-
zIndex: 100,
|
|
3768
|
-
pointerEvents: "none",
|
|
3769
|
-
opacity: referenceOpacity / 100
|
|
3770
|
-
},
|
|
3771
|
-
children: /* @__PURE__ */ jsx23(
|
|
3772
|
-
Img9,
|
|
3773
|
-
{
|
|
3774
|
-
src: referenceImageUrl,
|
|
3775
|
-
style: {
|
|
3776
|
-
width: "100%",
|
|
3777
|
-
height: "100%",
|
|
3778
|
-
objectFit: "cover"
|
|
3779
|
-
}
|
|
3780
|
-
}
|
|
3781
|
-
)
|
|
3782
|
-
}
|
|
3783
|
-
)
|
|
3784
|
-
]
|
|
3804
|
+
]
|
|
3805
|
+
}
|
|
3806
|
+
)
|
|
3807
|
+
}
|
|
3808
|
+
)
|
|
3785
3809
|
}
|
|
3786
3810
|
),
|
|
3787
3811
|
showDebugOverlay && /* @__PURE__ */ jsx23(
|
|
@@ -3789,6 +3813,7 @@ function InstagramDmComposition({
|
|
|
3789
3813
|
{
|
|
3790
3814
|
width,
|
|
3791
3815
|
height,
|
|
3816
|
+
scrollContainerRef,
|
|
3792
3817
|
onZoomChange: handleZoomChange,
|
|
3793
3818
|
initialZoom: zoom
|
|
3794
3819
|
}
|
|
@@ -3799,10 +3824,10 @@ function InstagramDmComposition({
|
|
|
3799
3824
|
}
|
|
3800
3825
|
|
|
3801
3826
|
// src/hooks/index.ts
|
|
3802
|
-
import { useEffect as
|
|
3827
|
+
import { useEffect as useEffect3, useState as useState4, useMemo as useMemo7 } from "react";
|
|
3803
3828
|
function useFontsLoaded() {
|
|
3804
3829
|
const [loaded, setLoaded] = useState4(areFontsLoaded());
|
|
3805
|
-
|
|
3830
|
+
useEffect3(() => {
|
|
3806
3831
|
if (!loaded) {
|
|
3807
3832
|
preloadFonts().then(() => setLoaded(true)).catch(console.error);
|
|
3808
3833
|
}
|
|
@@ -3811,7 +3836,7 @@ function useFontsLoaded() {
|
|
|
3811
3836
|
}
|
|
3812
3837
|
function useImageLoader(src) {
|
|
3813
3838
|
const [image, setImage] = useState4(null);
|
|
3814
|
-
|
|
3839
|
+
useEffect3(() => {
|
|
3815
3840
|
if (!src) {
|
|
3816
3841
|
setImage(null);
|
|
3817
3842
|
return;
|
|
@@ -3833,7 +3858,7 @@ function useImageLoader(src) {
|
|
|
3833
3858
|
function useImagePreloader(sources) {
|
|
3834
3859
|
const [images, setImages] = useState4({});
|
|
3835
3860
|
const [loaded, setLoaded] = useState4(false);
|
|
3836
|
-
|
|
3861
|
+
useEffect3(() => {
|
|
3837
3862
|
const entries = Object.entries(sources);
|
|
3838
3863
|
if (entries.length === 0) {
|
|
3839
3864
|
setLoaded(true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ugcinc-render",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.58",
|
|
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",
|