ugcinc-render 1.8.110 → 1.8.112
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 +32 -3
- package/dist/index.mjs +38 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3547,7 +3547,7 @@ var MESSAGE_DEFAULTS = {
|
|
|
3547
3547
|
profilePicSize: 83,
|
|
3548
3548
|
profilePicGap: 37
|
|
3549
3549
|
};
|
|
3550
|
-
var FONT_FAMILY =
|
|
3550
|
+
var FONT_FAMILY = getFontFamily("apple");
|
|
3551
3551
|
function calculateAutoWidthAndLines2({
|
|
3552
3552
|
text,
|
|
3553
3553
|
maxWidth,
|
|
@@ -3563,6 +3563,10 @@ function calculateAutoWidthAndLines2({
|
|
|
3563
3563
|
if (availableWidth <= 0) {
|
|
3564
3564
|
return { width: maxWidth, lines: [text] };
|
|
3565
3565
|
}
|
|
3566
|
+
const fontLoaded = typeof document.fonts !== "undefined" ? document.fonts.check(`normal ${fontSize}px "SF Pro"`) : false;
|
|
3567
|
+
if (!fontLoaded) {
|
|
3568
|
+
console.warn("[convertPropsToElements] SF Pro font not loaded! Text measurement may be inaccurate.");
|
|
3569
|
+
}
|
|
3566
3570
|
const measureSpan = document.createElement("span");
|
|
3567
3571
|
measureSpan.style.cssText = `
|
|
3568
3572
|
position: absolute;
|
|
@@ -3570,7 +3574,7 @@ function calculateAutoWidthAndLines2({
|
|
|
3570
3574
|
pointer-events: none;
|
|
3571
3575
|
font-family: ${FONT_FAMILY};
|
|
3572
3576
|
font-size: ${fontSize}px;
|
|
3573
|
-
font-weight:
|
|
3577
|
+
font-weight: normal;
|
|
3574
3578
|
letter-spacing: ${letterSpacing}px;
|
|
3575
3579
|
white-space: nowrap;
|
|
3576
3580
|
`;
|
|
@@ -4049,6 +4053,28 @@ function InstagramDmComposition(props) {
|
|
|
4049
4053
|
const [scrollX, setScrollX] = (0, import_react8.useState)(0);
|
|
4050
4054
|
const [scrollY, setScrollY] = (0, import_react8.useState)(0);
|
|
4051
4055
|
const [referenceVisible, setReferenceVisible] = (0, import_react8.useState)(true);
|
|
4056
|
+
const [fontsLoaded, setFontsLoaded] = (0, import_react8.useState)(false);
|
|
4057
|
+
(0, import_react8.useEffect)(() => {
|
|
4058
|
+
const handle = (0, import_remotion9.delayRender)("Loading fonts for InstagramDmComposition");
|
|
4059
|
+
const loadFonts = async () => {
|
|
4060
|
+
await preloadFonts();
|
|
4061
|
+
if (typeof document !== "undefined" && document.fonts?.ready) {
|
|
4062
|
+
await document.fonts.ready;
|
|
4063
|
+
}
|
|
4064
|
+
if (typeof document !== "undefined" && document.fonts) {
|
|
4065
|
+
const sfProLoaded = document.fonts.check('normal 51px "SF Pro"');
|
|
4066
|
+
console.log("[InstagramDmComposition] Font check - SF Pro loaded:", sfProLoaded);
|
|
4067
|
+
}
|
|
4068
|
+
};
|
|
4069
|
+
loadFonts().then(() => {
|
|
4070
|
+
setFontsLoaded(true);
|
|
4071
|
+
(0, import_remotion9.continueRender)(handle);
|
|
4072
|
+
}).catch((err) => {
|
|
4073
|
+
console.error("Failed to load fonts:", err);
|
|
4074
|
+
setFontsLoaded(true);
|
|
4075
|
+
(0, import_remotion9.continueRender)(handle);
|
|
4076
|
+
});
|
|
4077
|
+
}, []);
|
|
4052
4078
|
const handleZoomChange = (0, import_react8.useCallback)((newZoom, newScrollX, newScrollY) => {
|
|
4053
4079
|
setZoom(newZoom);
|
|
4054
4080
|
setScrollX(newScrollX);
|
|
@@ -4058,8 +4084,11 @@ function InstagramDmComposition(props) {
|
|
|
4058
4084
|
setReferenceVisible((prev) => !prev);
|
|
4059
4085
|
}, []);
|
|
4060
4086
|
const { elements, imageUrls } = (0, import_react8.useMemo)(() => {
|
|
4087
|
+
if (!fontsLoaded) {
|
|
4088
|
+
return { elements: [], imageUrls: {} };
|
|
4089
|
+
}
|
|
4061
4090
|
return convertPropsToElements(props);
|
|
4062
|
-
}, [props]);
|
|
4091
|
+
}, [props, fontsLoaded]);
|
|
4063
4092
|
const colors = getThemeColors(theme);
|
|
4064
4093
|
const zoomScale = zoom / 100;
|
|
4065
4094
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
|
package/dist/index.mjs
CHANGED
|
@@ -1947,8 +1947,8 @@ function ScreenshotAnimation({
|
|
|
1947
1947
|
}
|
|
1948
1948
|
|
|
1949
1949
|
// src/compositions/InstagramDmComposition/index.tsx
|
|
1950
|
-
import { useCallback as useCallback2, useMemo as useMemo7, useState as useState3 } from "react";
|
|
1951
|
-
import { AbsoluteFill as AbsoluteFill5, Img as Img4 } from "remotion";
|
|
1950
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useMemo as useMemo7, useState as useState3 } from "react";
|
|
1951
|
+
import { AbsoluteFill as AbsoluteFill5, Img as Img4, continueRender as continueRender2, delayRender as delayRender2 } from "remotion";
|
|
1952
1952
|
|
|
1953
1953
|
// src/compositions/InstagramDmComposition/theme.ts
|
|
1954
1954
|
var IG_THEME_COLORS = {
|
|
@@ -2616,7 +2616,7 @@ var MESSAGE_DEFAULTS = {
|
|
|
2616
2616
|
profilePicSize: 83,
|
|
2617
2617
|
profilePicGap: 37
|
|
2618
2618
|
};
|
|
2619
|
-
var FONT_FAMILY =
|
|
2619
|
+
var FONT_FAMILY = getFontFamily("apple");
|
|
2620
2620
|
function calculateAutoWidthAndLines2({
|
|
2621
2621
|
text,
|
|
2622
2622
|
maxWidth,
|
|
@@ -2632,6 +2632,10 @@ function calculateAutoWidthAndLines2({
|
|
|
2632
2632
|
if (availableWidth <= 0) {
|
|
2633
2633
|
return { width: maxWidth, lines: [text] };
|
|
2634
2634
|
}
|
|
2635
|
+
const fontLoaded = typeof document.fonts !== "undefined" ? document.fonts.check(`normal ${fontSize}px "SF Pro"`) : false;
|
|
2636
|
+
if (!fontLoaded) {
|
|
2637
|
+
console.warn("[convertPropsToElements] SF Pro font not loaded! Text measurement may be inaccurate.");
|
|
2638
|
+
}
|
|
2635
2639
|
const measureSpan = document.createElement("span");
|
|
2636
2640
|
measureSpan.style.cssText = `
|
|
2637
2641
|
position: absolute;
|
|
@@ -2639,7 +2643,7 @@ function calculateAutoWidthAndLines2({
|
|
|
2639
2643
|
pointer-events: none;
|
|
2640
2644
|
font-family: ${FONT_FAMILY};
|
|
2641
2645
|
font-size: ${fontSize}px;
|
|
2642
|
-
font-weight:
|
|
2646
|
+
font-weight: normal;
|
|
2643
2647
|
letter-spacing: ${letterSpacing}px;
|
|
2644
2648
|
white-space: nowrap;
|
|
2645
2649
|
`;
|
|
@@ -3118,6 +3122,28 @@ function InstagramDmComposition(props) {
|
|
|
3118
3122
|
const [scrollX, setScrollX] = useState3(0);
|
|
3119
3123
|
const [scrollY, setScrollY] = useState3(0);
|
|
3120
3124
|
const [referenceVisible, setReferenceVisible] = useState3(true);
|
|
3125
|
+
const [fontsLoaded, setFontsLoaded] = useState3(false);
|
|
3126
|
+
useEffect3(() => {
|
|
3127
|
+
const handle = delayRender2("Loading fonts for InstagramDmComposition");
|
|
3128
|
+
const loadFonts = async () => {
|
|
3129
|
+
await preloadFonts();
|
|
3130
|
+
if (typeof document !== "undefined" && document.fonts?.ready) {
|
|
3131
|
+
await document.fonts.ready;
|
|
3132
|
+
}
|
|
3133
|
+
if (typeof document !== "undefined" && document.fonts) {
|
|
3134
|
+
const sfProLoaded = document.fonts.check('normal 51px "SF Pro"');
|
|
3135
|
+
console.log("[InstagramDmComposition] Font check - SF Pro loaded:", sfProLoaded);
|
|
3136
|
+
}
|
|
3137
|
+
};
|
|
3138
|
+
loadFonts().then(() => {
|
|
3139
|
+
setFontsLoaded(true);
|
|
3140
|
+
continueRender2(handle);
|
|
3141
|
+
}).catch((err) => {
|
|
3142
|
+
console.error("Failed to load fonts:", err);
|
|
3143
|
+
setFontsLoaded(true);
|
|
3144
|
+
continueRender2(handle);
|
|
3145
|
+
});
|
|
3146
|
+
}, []);
|
|
3121
3147
|
const handleZoomChange = useCallback2((newZoom, newScrollX, newScrollY) => {
|
|
3122
3148
|
setZoom(newZoom);
|
|
3123
3149
|
setScrollX(newScrollX);
|
|
@@ -3127,8 +3153,11 @@ function InstagramDmComposition(props) {
|
|
|
3127
3153
|
setReferenceVisible((prev) => !prev);
|
|
3128
3154
|
}, []);
|
|
3129
3155
|
const { elements, imageUrls } = useMemo7(() => {
|
|
3156
|
+
if (!fontsLoaded) {
|
|
3157
|
+
return { elements: [], imageUrls: {} };
|
|
3158
|
+
}
|
|
3130
3159
|
return convertPropsToElements(props);
|
|
3131
|
-
}, [props]);
|
|
3160
|
+
}, [props, fontsLoaded]);
|
|
3132
3161
|
const colors = getThemeColors(theme);
|
|
3133
3162
|
const zoomScale = zoom / 100;
|
|
3134
3163
|
return /* @__PURE__ */ jsxs8(
|
|
@@ -3591,10 +3620,10 @@ function MediaBubble({
|
|
|
3591
3620
|
}
|
|
3592
3621
|
|
|
3593
3622
|
// src/hooks/index.ts
|
|
3594
|
-
import { useEffect as
|
|
3623
|
+
import { useEffect as useEffect4, useState as useState4, useMemo as useMemo8 } from "react";
|
|
3595
3624
|
function useFontsLoaded() {
|
|
3596
3625
|
const [loaded, setLoaded] = useState4(areFontsLoaded());
|
|
3597
|
-
|
|
3626
|
+
useEffect4(() => {
|
|
3598
3627
|
if (!loaded) {
|
|
3599
3628
|
preloadFonts().then(() => setLoaded(true)).catch(console.error);
|
|
3600
3629
|
}
|
|
@@ -3603,7 +3632,7 @@ function useFontsLoaded() {
|
|
|
3603
3632
|
}
|
|
3604
3633
|
function useImageLoader(src) {
|
|
3605
3634
|
const [image, setImage] = useState4(null);
|
|
3606
|
-
|
|
3635
|
+
useEffect4(() => {
|
|
3607
3636
|
if (!src) {
|
|
3608
3637
|
setImage(null);
|
|
3609
3638
|
return;
|
|
@@ -3625,7 +3654,7 @@ function useImageLoader(src) {
|
|
|
3625
3654
|
function useImagePreloader(sources) {
|
|
3626
3655
|
const [images, setImages] = useState4({});
|
|
3627
3656
|
const [loaded, setLoaded] = useState4(false);
|
|
3628
|
-
|
|
3657
|
+
useEffect4(() => {
|
|
3629
3658
|
const entries = Object.entries(sources);
|
|
3630
3659
|
if (entries.length === 0) {
|
|
3631
3660
|
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.112",
|
|
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",
|