sfc-utils 1.3.56 → 1.3.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/components/topper2.mjs +5 -1
- package/components/wcmimage2.mjs +11 -5
- package/package.json +1 -1
package/components/topper2.mjs
CHANGED
|
@@ -17,7 +17,10 @@ const Topper2 = ({ settings, wcmData, lazyloader }) => {
|
|
|
17
17
|
return [topperStyles.headerDekStacked, " mw-lg mt-lg mb-md"];
|
|
18
18
|
case "full-screen":
|
|
19
19
|
// apply margin offsets from spreadsheet
|
|
20
|
-
|
|
20
|
+
if (typeof window != "undefined") {
|
|
21
|
+
calculatefullScreenOffsets();
|
|
22
|
+
}
|
|
23
|
+
|
|
21
24
|
return [
|
|
22
25
|
topperStyles.headerDekFullScreen, fullScreenHorizontalCss(),
|
|
23
26
|
... (HeaderDek_Vertical_Position === "top") ? [topperStyles.headerDekTop] : [topperStyles.headerDekBottom],
|
|
@@ -187,6 +190,7 @@ const Topper2 = ({ settings, wcmData, lazyloader }) => {
|
|
|
187
190
|
|
|
188
191
|
const calculateFullScreenImageRatio = () => {
|
|
189
192
|
// ratio needs to account for height of nav bar which is 37px
|
|
193
|
+
if (typeof window === "undefined") return "56.25%"
|
|
190
194
|
const windowRatio = ((window.innerHeight-37) / window.innerWidth)*100;
|
|
191
195
|
let fullScreenRatio = "56.25%"; // defaults to 16/9;
|
|
192
196
|
|
package/components/wcmimage2.mjs
CHANGED
|
@@ -56,7 +56,11 @@ const WCMImage = ({ wcm, alt, ratio, wcmData, lazyloader, isFullScreenTopper })
|
|
|
56
56
|
|
|
57
57
|
// This calculation is not used for the topper impl, but keeping it here just in case
|
|
58
58
|
// it is needed for the general WCMImage utils migration
|
|
59
|
-
let r =
|
|
59
|
+
let r = null;
|
|
60
|
+
if (typeof window != "undefined") {
|
|
61
|
+
r = document.querySelector(':root');
|
|
62
|
+
}
|
|
63
|
+
|
|
60
64
|
let photoRatio = "56.25%"; // Default to 16/9
|
|
61
65
|
let fullPath = `https://s.hdnux.com/photos/0/0/0/${wcm}/0/`;
|
|
62
66
|
if (!ratio){
|
|
@@ -69,7 +73,9 @@ const WCMImage = ({ wcm, alt, ratio, wcmData, lazyloader, isFullScreenTopper })
|
|
|
69
73
|
if (matchedPhoto){
|
|
70
74
|
// Set ratio of the actual photo like a legit hacker
|
|
71
75
|
photoRatio = (matchedPhoto.photo.ratio*100)+"%";
|
|
72
|
-
r
|
|
76
|
+
if (r) {
|
|
77
|
+
r.style.setProperty('--img-bottom-padding-ratio', photoRatio);
|
|
78
|
+
}
|
|
73
79
|
|
|
74
80
|
fullPath = matchedPhoto.photo.full_path;
|
|
75
81
|
} else {
|
|
@@ -79,7 +85,9 @@ const WCMImage = ({ wcm, alt, ratio, wcmData, lazyloader, isFullScreenTopper })
|
|
|
79
85
|
} else {
|
|
80
86
|
// If an override is being passed in, use that
|
|
81
87
|
photoRatio = ratio
|
|
82
|
-
r
|
|
88
|
+
if (r) {
|
|
89
|
+
r.style.setProperty('--img-bottom-padding-ratio', photoRatio);
|
|
90
|
+
}
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
// Get serious about alt tags
|
|
@@ -92,11 +100,9 @@ const WCMImage = ({ wcm, alt, ratio, wcmData, lazyloader, isFullScreenTopper })
|
|
|
92
100
|
|
|
93
101
|
return (
|
|
94
102
|
<div ref={picRef}>
|
|
95
|
-
|
|
96
103
|
<LazyLoaderHTML>
|
|
97
104
|
<ImageHTML fullPath={fullPath} imageRez={imageRez} alt={alt} isFullScreenTopper={isFullScreenTopper}/>
|
|
98
105
|
</LazyLoaderHTML>
|
|
99
|
-
|
|
100
106
|
</div>
|
|
101
107
|
)
|
|
102
108
|
}
|