ugcinc-render 1.8.61 → 1.8.62
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 +77 -20
- package/dist/index.mjs +77 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4347,7 +4347,9 @@ function DebugOverlay({
|
|
|
4347
4347
|
zoom,
|
|
4348
4348
|
scrollX,
|
|
4349
4349
|
scrollY,
|
|
4350
|
-
|
|
4350
|
+
referenceVisible,
|
|
4351
|
+
onZoomChange,
|
|
4352
|
+
onToggleReference
|
|
4351
4353
|
}) {
|
|
4352
4354
|
const [mousePos, setMousePos] = (0, import_react7.useState)(null);
|
|
4353
4355
|
const [viewportPos, setViewportPos] = (0, import_react7.useState)(null);
|
|
@@ -4386,8 +4388,8 @@ function DebugOverlay({
|
|
|
4386
4388
|
const { x: vpX, y: vpY } = viewportPos;
|
|
4387
4389
|
const canvasX = (vpX + scrollX) / zoomScale;
|
|
4388
4390
|
const canvasY = (vpY + scrollY) / zoomScale;
|
|
4389
|
-
const delta = e.deltaY > 0 ? -
|
|
4390
|
-
const newZoom = Math.max(100, Math.min(
|
|
4391
|
+
const delta = e.deltaY > 0 ? -15 : 15;
|
|
4392
|
+
const newZoom = Math.max(100, Math.min(1e4, zoom + delta));
|
|
4391
4393
|
const newZoomScale = newZoom / 100;
|
|
4392
4394
|
const newScrollX = Math.max(0, canvasX * newZoomScale - vpX);
|
|
4393
4395
|
const newScrollY = Math.max(0, canvasY * newZoomScale - vpY);
|
|
@@ -4398,19 +4400,24 @@ function DebugOverlay({
|
|
|
4398
4400
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4399
4401
|
"div",
|
|
4400
4402
|
{
|
|
4403
|
+
"data-debug-overlay-root": true,
|
|
4401
4404
|
style: {
|
|
4402
4405
|
position: "absolute",
|
|
4403
4406
|
top: 0,
|
|
4404
4407
|
left: 0,
|
|
4405
4408
|
right: 0,
|
|
4406
4409
|
bottom: 0,
|
|
4407
|
-
zIndex: 200
|
|
4408
|
-
cursor: "crosshair"
|
|
4410
|
+
zIndex: 200
|
|
4409
4411
|
},
|
|
4410
4412
|
onMouseMove: handleMouseMove,
|
|
4411
4413
|
onMouseLeave: handleMouseLeave,
|
|
4412
4414
|
onWheel: handleWheel,
|
|
4413
4415
|
children: [
|
|
4416
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("style", { children: `
|
|
4417
|
+
[data-debug-overlay-root], [data-debug-overlay-root] * {
|
|
4418
|
+
cursor: none !important;
|
|
4419
|
+
}
|
|
4420
|
+
` }),
|
|
4414
4421
|
screenPosPercent && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
4415
4422
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4416
4423
|
"div",
|
|
@@ -4421,7 +4428,7 @@ function DebugOverlay({
|
|
|
4421
4428
|
left: `${screenPosPercent.x}%`,
|
|
4422
4429
|
width: 1,
|
|
4423
4430
|
height: "100%",
|
|
4424
|
-
backgroundColor: "
|
|
4431
|
+
backgroundColor: "#FF0000",
|
|
4425
4432
|
pointerEvents: "none"
|
|
4426
4433
|
}
|
|
4427
4434
|
}
|
|
@@ -4435,13 +4442,13 @@ function DebugOverlay({
|
|
|
4435
4442
|
left: 0,
|
|
4436
4443
|
width: "100%",
|
|
4437
4444
|
height: 1,
|
|
4438
|
-
backgroundColor: "
|
|
4445
|
+
backgroundColor: "#FF0000",
|
|
4439
4446
|
pointerEvents: "none"
|
|
4440
4447
|
}
|
|
4441
4448
|
}
|
|
4442
4449
|
)
|
|
4443
4450
|
] }),
|
|
4444
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.
|
|
4451
|
+
mousePos && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
4445
4452
|
"div",
|
|
4446
4453
|
{
|
|
4447
4454
|
style: {
|
|
@@ -4459,7 +4466,7 @@ function DebugOverlay({
|
|
|
4459
4466
|
border: "2px solid rgba(0, 255, 0, 0.5)",
|
|
4460
4467
|
minWidth: 200
|
|
4461
4468
|
},
|
|
4462
|
-
children:
|
|
4469
|
+
children: [
|
|
4463
4470
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
|
4464
4471
|
"X: ",
|
|
4465
4472
|
mousePos.x
|
|
@@ -4468,7 +4475,7 @@ function DebugOverlay({
|
|
|
4468
4475
|
"Y: ",
|
|
4469
4476
|
mousePos.y
|
|
4470
4477
|
] })
|
|
4471
|
-
]
|
|
4478
|
+
]
|
|
4472
4479
|
}
|
|
4473
4480
|
),
|
|
4474
4481
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
@@ -4485,21 +4492,41 @@ function DebugOverlay({
|
|
|
4485
4492
|
fontWeight: "bold",
|
|
4486
4493
|
padding: "12px 20px",
|
|
4487
4494
|
borderRadius: 8,
|
|
4488
|
-
pointerEvents: "none",
|
|
4489
4495
|
border: "2px solid rgba(255, 255, 0, 0.5)"
|
|
4490
4496
|
},
|
|
4491
4497
|
children: [
|
|
4492
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { children: [
|
|
4498
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { pointerEvents: "none" }, children: [
|
|
4493
4499
|
width,
|
|
4494
4500
|
" x ",
|
|
4495
4501
|
height
|
|
4496
4502
|
] }),
|
|
4497
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { color: "#00FFFF", marginTop: 8 }, children: [
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { color: "#00FFFF", marginTop: 8, pointerEvents: "none" }, children: [
|
|
4498
4504
|
"Zoom: ",
|
|
4499
4505
|
zoom,
|
|
4500
4506
|
"%"
|
|
4501
4507
|
] }),
|
|
4502
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#888", fontSize: 16, marginTop: 4 }, children: "(scroll to zoom)" })
|
|
4508
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#888", fontSize: 16, marginTop: 4, pointerEvents: "none" }, children: "(scroll to zoom)" }),
|
|
4509
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FF00FF", fontSize: 20, marginTop: 8, pointerEvents: "none", fontWeight: "bold" }, children: "VERSION: 3" }),
|
|
4510
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
4511
|
+
"button",
|
|
4512
|
+
{
|
|
4513
|
+
onClick: onToggleReference,
|
|
4514
|
+
style: {
|
|
4515
|
+
marginTop: 12,
|
|
4516
|
+
padding: "8px 16px",
|
|
4517
|
+
fontSize: 16,
|
|
4518
|
+
fontWeight: "bold",
|
|
4519
|
+
fontFamily: "monospace",
|
|
4520
|
+
backgroundColor: referenceVisible ? "#FF6B6B" : "#4CAF50",
|
|
4521
|
+
color: "#FFFFFF",
|
|
4522
|
+
border: "none",
|
|
4523
|
+
borderRadius: 4,
|
|
4524
|
+
cursor: "none",
|
|
4525
|
+
width: "100%"
|
|
4526
|
+
},
|
|
4527
|
+
children: referenceVisible ? "Hide Reference" : "Show Reference"
|
|
4528
|
+
}
|
|
4529
|
+
)
|
|
4503
4530
|
]
|
|
4504
4531
|
}
|
|
4505
4532
|
)
|
|
@@ -4562,15 +4589,40 @@ function InstagramDmComposition({
|
|
|
4562
4589
|
footerConfig,
|
|
4563
4590
|
scrollOffset
|
|
4564
4591
|
}) {
|
|
4592
|
+
const clampedReferenceOpacity = Math.max(0, Math.min(100, referenceOpacity));
|
|
4593
|
+
const clampedBatteryLevel = Math.max(0, Math.min(100, statusBar?.batteryLevel ?? 100));
|
|
4565
4594
|
const [fontsLoaded, setFontsLoaded] = (0, import_react8.useState)(false);
|
|
4566
4595
|
const [zoom, setZoom] = (0, import_react8.useState)(100);
|
|
4567
4596
|
const [scrollX, setScrollX] = (0, import_react8.useState)(0);
|
|
4568
4597
|
const [scrollY, setScrollY] = (0, import_react8.useState)(0);
|
|
4598
|
+
const [referenceVisible, setReferenceVisible] = (0, import_react8.useState)(true);
|
|
4569
4599
|
const handleZoomChange = (0, import_react8.useCallback)((newZoom, newScrollX, newScrollY) => {
|
|
4570
4600
|
setZoom(newZoom);
|
|
4571
4601
|
setScrollX(newScrollX);
|
|
4572
4602
|
setScrollY(newScrollY);
|
|
4573
4603
|
}, []);
|
|
4604
|
+
const handleToggleReference = (0, import_react8.useCallback)(() => {
|
|
4605
|
+
setReferenceVisible((prev) => !prev);
|
|
4606
|
+
}, []);
|
|
4607
|
+
(0, import_react8.useEffect)(() => {
|
|
4608
|
+
const interceptBeforeUnload = (e) => {
|
|
4609
|
+
e.stopImmediatePropagation();
|
|
4610
|
+
};
|
|
4611
|
+
window.addEventListener("beforeunload", interceptBeforeUnload, { capture: true });
|
|
4612
|
+
try {
|
|
4613
|
+
window.onbeforeunload = null;
|
|
4614
|
+
if (window.parent && window.parent !== window) {
|
|
4615
|
+
window.parent.onbeforeunload = null;
|
|
4616
|
+
}
|
|
4617
|
+
if (window.top && window.top !== window) {
|
|
4618
|
+
window.top.onbeforeunload = null;
|
|
4619
|
+
}
|
|
4620
|
+
} catch {
|
|
4621
|
+
}
|
|
4622
|
+
return () => {
|
|
4623
|
+
window.removeEventListener("beforeunload", interceptBeforeUnload, { capture: true });
|
|
4624
|
+
};
|
|
4625
|
+
}, []);
|
|
4574
4626
|
(0, import_react8.useEffect)(() => {
|
|
4575
4627
|
const handle = (0, import_remotion14.delayRender)("Loading fonts...");
|
|
4576
4628
|
preloadFonts().then(() => {
|
|
@@ -4585,7 +4637,10 @@ function InstagramDmComposition({
|
|
|
4585
4637
|
if (!fontsLoaded) {
|
|
4586
4638
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_remotion14.AbsoluteFill, {});
|
|
4587
4639
|
}
|
|
4588
|
-
const mergedStatusBar =
|
|
4640
|
+
const mergedStatusBar = {
|
|
4641
|
+
...mergeStatusBarConfig(statusBar),
|
|
4642
|
+
batteryLevel: clampedBatteryLevel
|
|
4643
|
+
};
|
|
4589
4644
|
const mergedStyle = mergeMessageStyle(messageStyle);
|
|
4590
4645
|
const mergedHeader = mergeHeaderConfig(headerConfig);
|
|
4591
4646
|
const mergedFooter = mergeFooterConfig(footerConfig);
|
|
@@ -4659,7 +4714,7 @@ function InstagramDmComposition({
|
|
|
4659
4714
|
compositionHeight: height
|
|
4660
4715
|
}
|
|
4661
4716
|
),
|
|
4662
|
-
referenceImageUrl &&
|
|
4717
|
+
referenceImageUrl && (showDebugOverlay ? referenceVisible : clampedReferenceOpacity > 0) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4663
4718
|
"div",
|
|
4664
4719
|
{
|
|
4665
4720
|
style: {
|
|
@@ -4670,7 +4725,7 @@ function InstagramDmComposition({
|
|
|
4670
4725
|
bottom: 0,
|
|
4671
4726
|
zIndex: 100,
|
|
4672
4727
|
pointerEvents: "none",
|
|
4673
|
-
opacity:
|
|
4728
|
+
opacity: showDebugOverlay ? 1 : clampedReferenceOpacity / 100
|
|
4674
4729
|
},
|
|
4675
4730
|
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
4676
4731
|
import_remotion14.Img,
|
|
@@ -4718,7 +4773,9 @@ function InstagramDmComposition({
|
|
|
4718
4773
|
zoom,
|
|
4719
4774
|
scrollX,
|
|
4720
4775
|
scrollY,
|
|
4721
|
-
|
|
4776
|
+
referenceVisible,
|
|
4777
|
+
onZoomChange: handleZoomChange,
|
|
4778
|
+
onToggleReference: handleToggleReference
|
|
4722
4779
|
}
|
|
4723
4780
|
)
|
|
4724
4781
|
]
|
|
@@ -5202,7 +5259,7 @@ var igStatusBarSchema = import_zod.z.object({
|
|
|
5202
5259
|
showCellular: import_zod.z.boolean().optional().default(true).describe("Show cellular icon"),
|
|
5203
5260
|
showWifi: import_zod.z.boolean().optional().default(true).describe("Show WiFi icon"),
|
|
5204
5261
|
showBattery: import_zod.z.boolean().optional().default(true).describe("Show battery icon"),
|
|
5205
|
-
batteryLevel: import_zod.z.number().optional().default(100).describe("Battery level 0-100"),
|
|
5262
|
+
batteryLevel: import_zod.z.number().gte(0).lte(100).optional().default(100).describe("Battery level 0-100"),
|
|
5206
5263
|
isCharging: import_zod.z.boolean().optional().default(false).describe("Is charging")
|
|
5207
5264
|
});
|
|
5208
5265
|
var igHeaderConfigSchema = import_zod.z.object({
|
|
@@ -5277,7 +5334,7 @@ var instagramDmSchema = import_zod.z.object({
|
|
|
5277
5334
|
showDebugOverlay: import_zod.z.boolean().optional().default(true).describe("Show debug overlay with mouse coordinates"),
|
|
5278
5335
|
// Reference overlay
|
|
5279
5336
|
referenceImageUrl: import_zod.z.string().optional().default("https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/8ff1462b-13d7-4abe-9325-0a6ad19004f0/IMG_3171-DmKgZAYCYJpLxiZjJBYYCk4mynmjkv.png").describe("Reference screenshot URL"),
|
|
5280
|
-
referenceOpacity: import_zod.z.number().optional().default(50).describe("Reference overlay opacity (0-100)"),
|
|
5337
|
+
referenceOpacity: import_zod.z.number().min(0).max(100).optional().default(50).describe("Reference overlay opacity (0-100)"),
|
|
5281
5338
|
// Canvas
|
|
5282
5339
|
width: import_zod.z.number().optional().default(1206).describe("Canvas width (px)"),
|
|
5283
5340
|
height: import_zod.z.number().optional().default(2622).describe("Canvas height (px)"),
|
package/dist/index.mjs
CHANGED
|
@@ -3451,7 +3451,9 @@ function DebugOverlay({
|
|
|
3451
3451
|
zoom,
|
|
3452
3452
|
scrollX,
|
|
3453
3453
|
scrollY,
|
|
3454
|
-
|
|
3454
|
+
referenceVisible,
|
|
3455
|
+
onZoomChange,
|
|
3456
|
+
onToggleReference
|
|
3455
3457
|
}) {
|
|
3456
3458
|
const [mousePos, setMousePos] = useState2(null);
|
|
3457
3459
|
const [viewportPos, setViewportPos] = useState2(null);
|
|
@@ -3490,8 +3492,8 @@ function DebugOverlay({
|
|
|
3490
3492
|
const { x: vpX, y: vpY } = viewportPos;
|
|
3491
3493
|
const canvasX = (vpX + scrollX) / zoomScale;
|
|
3492
3494
|
const canvasY = (vpY + scrollY) / zoomScale;
|
|
3493
|
-
const delta = e.deltaY > 0 ? -
|
|
3494
|
-
const newZoom = Math.max(100, Math.min(
|
|
3495
|
+
const delta = e.deltaY > 0 ? -15 : 15;
|
|
3496
|
+
const newZoom = Math.max(100, Math.min(1e4, zoom + delta));
|
|
3495
3497
|
const newZoomScale = newZoom / 100;
|
|
3496
3498
|
const newScrollX = Math.max(0, canvasX * newZoomScale - vpX);
|
|
3497
3499
|
const newScrollY = Math.max(0, canvasY * newZoomScale - vpY);
|
|
@@ -3502,19 +3504,24 @@ function DebugOverlay({
|
|
|
3502
3504
|
return /* @__PURE__ */ jsxs15(
|
|
3503
3505
|
"div",
|
|
3504
3506
|
{
|
|
3507
|
+
"data-debug-overlay-root": true,
|
|
3505
3508
|
style: {
|
|
3506
3509
|
position: "absolute",
|
|
3507
3510
|
top: 0,
|
|
3508
3511
|
left: 0,
|
|
3509
3512
|
right: 0,
|
|
3510
3513
|
bottom: 0,
|
|
3511
|
-
zIndex: 200
|
|
3512
|
-
cursor: "crosshair"
|
|
3514
|
+
zIndex: 200
|
|
3513
3515
|
},
|
|
3514
3516
|
onMouseMove: handleMouseMove,
|
|
3515
3517
|
onMouseLeave: handleMouseLeave,
|
|
3516
3518
|
onWheel: handleWheel,
|
|
3517
3519
|
children: [
|
|
3520
|
+
/* @__PURE__ */ jsx22("style", { children: `
|
|
3521
|
+
[data-debug-overlay-root], [data-debug-overlay-root] * {
|
|
3522
|
+
cursor: none !important;
|
|
3523
|
+
}
|
|
3524
|
+
` }),
|
|
3518
3525
|
screenPosPercent && /* @__PURE__ */ jsxs15(Fragment, { children: [
|
|
3519
3526
|
/* @__PURE__ */ jsx22(
|
|
3520
3527
|
"div",
|
|
@@ -3525,7 +3532,7 @@ function DebugOverlay({
|
|
|
3525
3532
|
left: `${screenPosPercent.x}%`,
|
|
3526
3533
|
width: 1,
|
|
3527
3534
|
height: "100%",
|
|
3528
|
-
backgroundColor: "
|
|
3535
|
+
backgroundColor: "#FF0000",
|
|
3529
3536
|
pointerEvents: "none"
|
|
3530
3537
|
}
|
|
3531
3538
|
}
|
|
@@ -3539,13 +3546,13 @@ function DebugOverlay({
|
|
|
3539
3546
|
left: 0,
|
|
3540
3547
|
width: "100%",
|
|
3541
3548
|
height: 1,
|
|
3542
|
-
backgroundColor: "
|
|
3549
|
+
backgroundColor: "#FF0000",
|
|
3543
3550
|
pointerEvents: "none"
|
|
3544
3551
|
}
|
|
3545
3552
|
}
|
|
3546
3553
|
)
|
|
3547
3554
|
] }),
|
|
3548
|
-
/* @__PURE__ */
|
|
3555
|
+
mousePos && /* @__PURE__ */ jsxs15(
|
|
3549
3556
|
"div",
|
|
3550
3557
|
{
|
|
3551
3558
|
style: {
|
|
@@ -3563,7 +3570,7 @@ function DebugOverlay({
|
|
|
3563
3570
|
border: "2px solid rgba(0, 255, 0, 0.5)",
|
|
3564
3571
|
minWidth: 200
|
|
3565
3572
|
},
|
|
3566
|
-
children:
|
|
3573
|
+
children: [
|
|
3567
3574
|
/* @__PURE__ */ jsxs15("div", { children: [
|
|
3568
3575
|
"X: ",
|
|
3569
3576
|
mousePos.x
|
|
@@ -3572,7 +3579,7 @@ function DebugOverlay({
|
|
|
3572
3579
|
"Y: ",
|
|
3573
3580
|
mousePos.y
|
|
3574
3581
|
] })
|
|
3575
|
-
]
|
|
3582
|
+
]
|
|
3576
3583
|
}
|
|
3577
3584
|
),
|
|
3578
3585
|
/* @__PURE__ */ jsxs15(
|
|
@@ -3589,21 +3596,41 @@ function DebugOverlay({
|
|
|
3589
3596
|
fontWeight: "bold",
|
|
3590
3597
|
padding: "12px 20px",
|
|
3591
3598
|
borderRadius: 8,
|
|
3592
|
-
pointerEvents: "none",
|
|
3593
3599
|
border: "2px solid rgba(255, 255, 0, 0.5)"
|
|
3594
3600
|
},
|
|
3595
3601
|
children: [
|
|
3596
|
-
/* @__PURE__ */ jsxs15("div", { children: [
|
|
3602
|
+
/* @__PURE__ */ jsxs15("div", { style: { pointerEvents: "none" }, children: [
|
|
3597
3603
|
width,
|
|
3598
3604
|
" x ",
|
|
3599
3605
|
height
|
|
3600
3606
|
] }),
|
|
3601
|
-
/* @__PURE__ */ jsxs15("div", { style: { color: "#00FFFF", marginTop: 8 }, children: [
|
|
3607
|
+
/* @__PURE__ */ jsxs15("div", { style: { color: "#00FFFF", marginTop: 8, pointerEvents: "none" }, children: [
|
|
3602
3608
|
"Zoom: ",
|
|
3603
3609
|
zoom,
|
|
3604
3610
|
"%"
|
|
3605
3611
|
] }),
|
|
3606
|
-
/* @__PURE__ */ jsx22("div", { style: { color: "#888", fontSize: 16, marginTop: 4 }, children: "(scroll to zoom)" })
|
|
3612
|
+
/* @__PURE__ */ jsx22("div", { style: { color: "#888", fontSize: 16, marginTop: 4, pointerEvents: "none" }, children: "(scroll to zoom)" }),
|
|
3613
|
+
/* @__PURE__ */ jsx22("div", { style: { color: "#FF00FF", fontSize: 20, marginTop: 8, pointerEvents: "none", fontWeight: "bold" }, children: "VERSION: 3" }),
|
|
3614
|
+
/* @__PURE__ */ jsx22(
|
|
3615
|
+
"button",
|
|
3616
|
+
{
|
|
3617
|
+
onClick: onToggleReference,
|
|
3618
|
+
style: {
|
|
3619
|
+
marginTop: 12,
|
|
3620
|
+
padding: "8px 16px",
|
|
3621
|
+
fontSize: 16,
|
|
3622
|
+
fontWeight: "bold",
|
|
3623
|
+
fontFamily: "monospace",
|
|
3624
|
+
backgroundColor: referenceVisible ? "#FF6B6B" : "#4CAF50",
|
|
3625
|
+
color: "#FFFFFF",
|
|
3626
|
+
border: "none",
|
|
3627
|
+
borderRadius: 4,
|
|
3628
|
+
cursor: "none",
|
|
3629
|
+
width: "100%"
|
|
3630
|
+
},
|
|
3631
|
+
children: referenceVisible ? "Hide Reference" : "Show Reference"
|
|
3632
|
+
}
|
|
3633
|
+
)
|
|
3607
3634
|
]
|
|
3608
3635
|
}
|
|
3609
3636
|
)
|
|
@@ -3666,15 +3693,40 @@ function InstagramDmComposition({
|
|
|
3666
3693
|
footerConfig,
|
|
3667
3694
|
scrollOffset
|
|
3668
3695
|
}) {
|
|
3696
|
+
const clampedReferenceOpacity = Math.max(0, Math.min(100, referenceOpacity));
|
|
3697
|
+
const clampedBatteryLevel = Math.max(0, Math.min(100, statusBar?.batteryLevel ?? 100));
|
|
3669
3698
|
const [fontsLoaded, setFontsLoaded] = useState3(false);
|
|
3670
3699
|
const [zoom, setZoom] = useState3(100);
|
|
3671
3700
|
const [scrollX, setScrollX] = useState3(0);
|
|
3672
3701
|
const [scrollY, setScrollY] = useState3(0);
|
|
3702
|
+
const [referenceVisible, setReferenceVisible] = useState3(true);
|
|
3673
3703
|
const handleZoomChange = useCallback2((newZoom, newScrollX, newScrollY) => {
|
|
3674
3704
|
setZoom(newZoom);
|
|
3675
3705
|
setScrollX(newScrollX);
|
|
3676
3706
|
setScrollY(newScrollY);
|
|
3677
3707
|
}, []);
|
|
3708
|
+
const handleToggleReference = useCallback2(() => {
|
|
3709
|
+
setReferenceVisible((prev) => !prev);
|
|
3710
|
+
}, []);
|
|
3711
|
+
useEffect2(() => {
|
|
3712
|
+
const interceptBeforeUnload = (e) => {
|
|
3713
|
+
e.stopImmediatePropagation();
|
|
3714
|
+
};
|
|
3715
|
+
window.addEventListener("beforeunload", interceptBeforeUnload, { capture: true });
|
|
3716
|
+
try {
|
|
3717
|
+
window.onbeforeunload = null;
|
|
3718
|
+
if (window.parent && window.parent !== window) {
|
|
3719
|
+
window.parent.onbeforeunload = null;
|
|
3720
|
+
}
|
|
3721
|
+
if (window.top && window.top !== window) {
|
|
3722
|
+
window.top.onbeforeunload = null;
|
|
3723
|
+
}
|
|
3724
|
+
} catch {
|
|
3725
|
+
}
|
|
3726
|
+
return () => {
|
|
3727
|
+
window.removeEventListener("beforeunload", interceptBeforeUnload, { capture: true });
|
|
3728
|
+
};
|
|
3729
|
+
}, []);
|
|
3678
3730
|
useEffect2(() => {
|
|
3679
3731
|
const handle = delayRender2("Loading fonts...");
|
|
3680
3732
|
preloadFonts().then(() => {
|
|
@@ -3689,7 +3741,10 @@ function InstagramDmComposition({
|
|
|
3689
3741
|
if (!fontsLoaded) {
|
|
3690
3742
|
return /* @__PURE__ */ jsx23(AbsoluteFill5, {});
|
|
3691
3743
|
}
|
|
3692
|
-
const mergedStatusBar =
|
|
3744
|
+
const mergedStatusBar = {
|
|
3745
|
+
...mergeStatusBarConfig(statusBar),
|
|
3746
|
+
batteryLevel: clampedBatteryLevel
|
|
3747
|
+
};
|
|
3693
3748
|
const mergedStyle = mergeMessageStyle(messageStyle);
|
|
3694
3749
|
const mergedHeader = mergeHeaderConfig(headerConfig);
|
|
3695
3750
|
const mergedFooter = mergeFooterConfig(footerConfig);
|
|
@@ -3763,7 +3818,7 @@ function InstagramDmComposition({
|
|
|
3763
3818
|
compositionHeight: height
|
|
3764
3819
|
}
|
|
3765
3820
|
),
|
|
3766
|
-
referenceImageUrl &&
|
|
3821
|
+
referenceImageUrl && (showDebugOverlay ? referenceVisible : clampedReferenceOpacity > 0) && /* @__PURE__ */ jsx23(
|
|
3767
3822
|
"div",
|
|
3768
3823
|
{
|
|
3769
3824
|
style: {
|
|
@@ -3774,7 +3829,7 @@ function InstagramDmComposition({
|
|
|
3774
3829
|
bottom: 0,
|
|
3775
3830
|
zIndex: 100,
|
|
3776
3831
|
pointerEvents: "none",
|
|
3777
|
-
opacity:
|
|
3832
|
+
opacity: showDebugOverlay ? 1 : clampedReferenceOpacity / 100
|
|
3778
3833
|
},
|
|
3779
3834
|
children: /* @__PURE__ */ jsx23(
|
|
3780
3835
|
Img9,
|
|
@@ -3822,7 +3877,9 @@ function InstagramDmComposition({
|
|
|
3822
3877
|
zoom,
|
|
3823
3878
|
scrollX,
|
|
3824
3879
|
scrollY,
|
|
3825
|
-
|
|
3880
|
+
referenceVisible,
|
|
3881
|
+
onZoomChange: handleZoomChange,
|
|
3882
|
+
onToggleReference: handleToggleReference
|
|
3826
3883
|
}
|
|
3827
3884
|
)
|
|
3828
3885
|
]
|
|
@@ -4023,7 +4080,7 @@ var igStatusBarSchema = z.object({
|
|
|
4023
4080
|
showCellular: z.boolean().optional().default(true).describe("Show cellular icon"),
|
|
4024
4081
|
showWifi: z.boolean().optional().default(true).describe("Show WiFi icon"),
|
|
4025
4082
|
showBattery: z.boolean().optional().default(true).describe("Show battery icon"),
|
|
4026
|
-
batteryLevel: z.number().optional().default(100).describe("Battery level 0-100"),
|
|
4083
|
+
batteryLevel: z.number().gte(0).lte(100).optional().default(100).describe("Battery level 0-100"),
|
|
4027
4084
|
isCharging: z.boolean().optional().default(false).describe("Is charging")
|
|
4028
4085
|
});
|
|
4029
4086
|
var igHeaderConfigSchema = z.object({
|
|
@@ -4098,7 +4155,7 @@ var instagramDmSchema = z.object({
|
|
|
4098
4155
|
showDebugOverlay: z.boolean().optional().default(true).describe("Show debug overlay with mouse coordinates"),
|
|
4099
4156
|
// Reference overlay
|
|
4100
4157
|
referenceImageUrl: z.string().optional().default("https://n14dcpakf8w1fekl.public.blob.vercel-storage.com/media/8ff1462b-13d7-4abe-9325-0a6ad19004f0/IMG_3171-DmKgZAYCYJpLxiZjJBYYCk4mynmjkv.png").describe("Reference screenshot URL"),
|
|
4101
|
-
referenceOpacity: z.number().optional().default(50).describe("Reference overlay opacity (0-100)"),
|
|
4158
|
+
referenceOpacity: z.number().min(0).max(100).optional().default(50).describe("Reference overlay opacity (0-100)"),
|
|
4102
4159
|
// Canvas
|
|
4103
4160
|
width: z.number().optional().default(1206).describe("Canvas width (px)"),
|
|
4104
4161
|
height: z.number().optional().default(2622).describe("Canvas height (px)"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ugcinc-render",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.62",
|
|
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",
|