@katajere/recap 2.1.6 → 2.1.7
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/RecapStory.css +288 -0
- package/dist/slides/Slide6Customer.css +30 -28
- package/dist/slides/Slide7Products.css +3 -3
- package/dist/utils/slideScreenshot.d.ts +1 -0
- package/dist/utils/slideScreenshot.d.ts.map +1 -1
- package/dist/utils/slideScreenshot.js +100 -89
- package/package.json +1 -1
- package/src/App.tsx +0 -2
- package/src/RecapStory.css +288 -0
- package/src/slides/Slide6Customer.css +30 -28
- package/src/slides/Slide7Products.css +3 -3
- package/src/utils/slideScreenshot.ts +119 -96
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import html2canvas from 'html2canvas';
|
|
2
2
|
// Cache for pre-captured screenshots
|
|
3
3
|
const screenshotCache = new Map();
|
|
4
|
+
// Fixed screenshot dimensions (9:16 aspect ratio)
|
|
5
|
+
// Base size: 390x692, with scale 3 = 1170x2076 (close to Instagram Story standard)
|
|
6
|
+
const SCREENSHOT_WIDTH = 390;
|
|
7
|
+
const SCREENSHOT_HEIGHT = 692;
|
|
8
|
+
const SCREENSHOT_SCALE = 3; // Output: 1170x2076
|
|
4
9
|
/**
|
|
5
10
|
* Detects if the device is mobile
|
|
6
11
|
*/
|
|
@@ -8,9 +13,54 @@ function isMobileDevice() {
|
|
|
8
13
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ||
|
|
9
14
|
(navigator.maxTouchPoints > 0 && window.innerWidth < 768);
|
|
10
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a fixed-size off-screen container with cloned content for consistent screenshots.
|
|
18
|
+
* This ensures all screenshots are 1080x1920 regardless of user's screen size.
|
|
19
|
+
*/
|
|
20
|
+
function createFixedSizeContainer(storyContainer) {
|
|
21
|
+
// Create off-screen container
|
|
22
|
+
const captureContainer = document.createElement('div');
|
|
23
|
+
captureContainer.className = 'screenshot-capture-container';
|
|
24
|
+
// Clone the story container
|
|
25
|
+
const clonedStory = storyContainer.cloneNode(true);
|
|
26
|
+
clonedStory.classList.add('screenshot-mode');
|
|
27
|
+
// Remove buttons and progress bar from clone
|
|
28
|
+
const elementsToRemove = clonedStory.querySelectorAll('.recap-story__sound-btn, .recap-story__share-btn, .recap-story__progress-wrap');
|
|
29
|
+
elementsToRemove.forEach(el => el.remove());
|
|
30
|
+
captureContainer.appendChild(clonedStory);
|
|
31
|
+
document.body.appendChild(captureContainer);
|
|
32
|
+
return captureContainer;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Captures a screenshot from the fixed-size container
|
|
36
|
+
*/
|
|
37
|
+
async function captureFixedSizeScreenshot(captureContainer) {
|
|
38
|
+
const clonedStory = captureContainer.querySelector('.recap-story');
|
|
39
|
+
const canvas = await html2canvas(clonedStory, {
|
|
40
|
+
scale: SCREENSHOT_SCALE,
|
|
41
|
+
useCORS: true,
|
|
42
|
+
allowTaint: true,
|
|
43
|
+
backgroundColor: '#FCFCFC',
|
|
44
|
+
logging: false,
|
|
45
|
+
width: SCREENSHOT_WIDTH,
|
|
46
|
+
height: SCREENSHOT_HEIGHT,
|
|
47
|
+
windowWidth: SCREENSHOT_WIDTH,
|
|
48
|
+
windowHeight: SCREENSHOT_HEIGHT,
|
|
49
|
+
});
|
|
50
|
+
const blob = await new Promise((resolve, reject) => {
|
|
51
|
+
canvas.toBlob((b) => {
|
|
52
|
+
if (b)
|
|
53
|
+
resolve(b);
|
|
54
|
+
else
|
|
55
|
+
reject(new Error('Failed to create blob'));
|
|
56
|
+
}, 'image/png', 1.0);
|
|
57
|
+
});
|
|
58
|
+
return blob;
|
|
59
|
+
}
|
|
11
60
|
/**
|
|
12
61
|
* Pre-captures a screenshot of the slide and caches it.
|
|
13
62
|
* Call this when a slide becomes active so the image is ready for instant sharing.
|
|
63
|
+
* Uses fixed 1080x1920 dimensions for consistent output across all devices.
|
|
14
64
|
*/
|
|
15
65
|
export async function preCaptureSlide(containerRef, options) {
|
|
16
66
|
if (!containerRef)
|
|
@@ -19,63 +69,46 @@ export async function preCaptureSlide(containerRef, options) {
|
|
|
19
69
|
const cacheKey = `${businessName}-${year}-${slideId}`;
|
|
20
70
|
// Skip if already cached
|
|
21
71
|
if (screenshotCache.has(cacheKey)) {
|
|
22
|
-
console.log('[Screenshot] Using cached screenshot for:', cacheKey);
|
|
72
|
+
// console.log('[Screenshot] Using cached screenshot for:', cacheKey);
|
|
23
73
|
return;
|
|
24
74
|
}
|
|
25
75
|
const storyContainer = containerRef.closest('.recap-story');
|
|
26
76
|
if (!storyContainer)
|
|
27
77
|
return;
|
|
78
|
+
let captureContainer = null;
|
|
28
79
|
try {
|
|
29
|
-
console.log('[Screenshot] Pre-capturing slide:', slideId);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
windowHeight: storyContainer.scrollHeight,
|
|
38
|
-
ignoreElements: (element) => {
|
|
39
|
-
// Ignore buttons and progress bar - they're excluded from screenshot
|
|
40
|
-
return element.classList.contains('recap-story__sound-btn') ||
|
|
41
|
-
element.classList.contains('recap-story__share-btn') ||
|
|
42
|
-
element.classList.contains('recap-story__progress-wrap');
|
|
43
|
-
},
|
|
44
|
-
// Apply screenshot-mode to cloned DOM only (not visible to user)
|
|
45
|
-
onclone: (clonedDoc) => {
|
|
46
|
-
const clonedContainer = clonedDoc.querySelector('.recap-story');
|
|
47
|
-
if (clonedContainer) {
|
|
48
|
-
clonedContainer.classList.add('screenshot-mode');
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
const blob = await new Promise((resolve, reject) => {
|
|
53
|
-
canvas.toBlob((b) => {
|
|
54
|
-
if (b)
|
|
55
|
-
resolve(b);
|
|
56
|
-
else
|
|
57
|
-
reject(new Error('Failed to create blob'));
|
|
58
|
-
}, 'image/png', 1.0);
|
|
59
|
-
});
|
|
60
|
-
const mimeType = 'image/png';
|
|
80
|
+
// console.log('[Screenshot] Pre-capturing slide at fixed 1080x1920:', slideId);
|
|
81
|
+
// Create fixed-size off-screen container with cloned content
|
|
82
|
+
captureContainer = createFixedSizeContainer(storyContainer);
|
|
83
|
+
// Small delay (~1 frame at 60fps) so the browser can complete style recalculation
|
|
84
|
+
// and layout for the cloned DOM elements before capturing the screenshot.
|
|
85
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
86
|
+
// Capture from the fixed-size container
|
|
87
|
+
const blob = await captureFixedSizeScreenshot(captureContainer);
|
|
61
88
|
const fileName = `${businessName.replace(/\s+/g, '-')}-recap-${year}-${slideId}.png`;
|
|
62
89
|
const file = new File([blob], fileName, {
|
|
63
|
-
type:
|
|
90
|
+
type: 'image/png',
|
|
64
91
|
lastModified: Date.now()
|
|
65
92
|
});
|
|
66
93
|
screenshotCache.set(cacheKey, file);
|
|
67
|
-
console.log('[Screenshot] Pre-capture complete:', cacheKey, file.size, 'bytes');
|
|
94
|
+
// console.log('[Screenshot] Pre-capture complete:', cacheKey, file.size, 'bytes', '(1080x1920)');
|
|
68
95
|
}
|
|
69
96
|
catch (error) {
|
|
70
97
|
console.error('[Screenshot] Pre-capture failed:', error);
|
|
71
98
|
}
|
|
99
|
+
finally {
|
|
100
|
+
// Clean up off-screen container (skip in debug mode)
|
|
101
|
+
if (captureContainer && captureContainer.parentNode) {
|
|
102
|
+
captureContainer.parentNode.removeChild(captureContainer);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
72
105
|
}
|
|
73
106
|
/**
|
|
74
107
|
* Clears the screenshot cache (call when leaving recap)
|
|
75
108
|
*/
|
|
76
109
|
export function clearScreenshotCache() {
|
|
77
110
|
screenshotCache.clear();
|
|
78
|
-
console.log('[Screenshot] Cache cleared');
|
|
111
|
+
// console.log('[Screenshot] Cache cleared');
|
|
79
112
|
}
|
|
80
113
|
/**
|
|
81
114
|
* Check if a screenshot is cached for a specific slide
|
|
@@ -100,19 +133,19 @@ export async function captureAndShareSlide(containerRef, options) {
|
|
|
100
133
|
const { slideId, businessName, year } = options;
|
|
101
134
|
const cacheKey = `${businessName}-${year}-${slideId}`;
|
|
102
135
|
const isMobile = isMobileDevice();
|
|
103
|
-
console.log('[Screenshot] Device type:', isMobile ? 'mobile' : 'desktop');
|
|
104
|
-
console.log('[Screenshot] Cache key:', cacheKey);
|
|
136
|
+
// console.log('[Screenshot] Device type:', isMobile ? 'mobile' : 'desktop');
|
|
137
|
+
// console.log('[Screenshot] Cache key:', cacheKey);
|
|
105
138
|
// Check for cached screenshot (enables instant sharing on mobile)
|
|
106
139
|
const cachedFile = screenshotCache.get(cacheKey);
|
|
107
|
-
console.log('[Screenshot] Cache available:', !!cachedFile);
|
|
140
|
+
// console.log('[Screenshot] Cache available:', !!cachedFile);
|
|
108
141
|
// MOBILE: Must use cached file for instant share (user gesture chain)
|
|
109
142
|
if (isMobile) {
|
|
110
143
|
if (cachedFile) {
|
|
111
|
-
console.log('[Screenshot] Using cached file for instant share');
|
|
144
|
+
// console.log('[Screenshot] Using cached file for instant share');
|
|
112
145
|
// CRITICAL: Call navigator.share() directly without any await before it
|
|
113
146
|
// to maintain the user gesture chain on mobile browsers (especially Edge)
|
|
114
147
|
const canShareFiles = navigator.canShare && navigator.canShare({ files: [cachedFile] });
|
|
115
|
-
console.log('[Screenshot] Can share files:', canShareFiles);
|
|
148
|
+
// console.log('[Screenshot] Can share files:', canShareFiles);
|
|
116
149
|
if (canShareFiles) {
|
|
117
150
|
// Call share synchronously - no try/catch wrapper that could break gesture chain
|
|
118
151
|
navigator.share({
|
|
@@ -120,7 +153,7 @@ export async function captureAndShareSlide(containerRef, options) {
|
|
|
120
153
|
title: 'My Huxxle Recap',
|
|
121
154
|
text: `Check out ${businessName}'s Wrapped ${year} highlights! 🎉`
|
|
122
155
|
}).then(() => {
|
|
123
|
-
console.log('[Screenshot] Share successful!');
|
|
156
|
+
// console.log('[Screenshot] Share successful!');
|
|
124
157
|
}).catch((err) => {
|
|
125
158
|
console.error('[Screenshot] Share failed:', err);
|
|
126
159
|
// If user cancelled (AbortError), don't download
|
|
@@ -133,7 +166,7 @@ export async function captureAndShareSlide(containerRef, options) {
|
|
|
133
166
|
return;
|
|
134
167
|
}
|
|
135
168
|
// Mobile browser doesn't support file sharing - download instead
|
|
136
|
-
console.log('[Screenshot] File sharing not supported, downloading...');
|
|
169
|
+
// console.log('[Screenshot] File sharing not supported, downloading...');
|
|
137
170
|
const blob = new Blob([cachedFile], { type: cachedFile.type });
|
|
138
171
|
downloadImage(blob, cachedFile.name);
|
|
139
172
|
return;
|
|
@@ -143,57 +176,32 @@ export async function captureAndShareSlide(containerRef, options) {
|
|
|
143
176
|
console.warn('[Screenshot] No cache on mobile - falling back to capture + download');
|
|
144
177
|
// Continue to fresh capture below, but it will download instead of share
|
|
145
178
|
}
|
|
146
|
-
// DESKTOP or MOBILE-FALLBACK: Capture fresh screenshot
|
|
179
|
+
// DESKTOP or MOBILE-FALLBACK: Capture fresh screenshot with fixed dimensions
|
|
147
180
|
const storyContainer = containerRef.closest('.recap-story');
|
|
148
181
|
if (!storyContainer) {
|
|
149
182
|
console.error('[Screenshot] Could not find .recap-story container');
|
|
150
183
|
return;
|
|
151
184
|
}
|
|
185
|
+
let captureContainer = null;
|
|
152
186
|
try {
|
|
153
|
-
console.log('[Screenshot] Starting capture...');
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
windowHeight: storyContainer.scrollHeight,
|
|
162
|
-
ignoreElements: (element) => {
|
|
163
|
-
// Ignore buttons and progress bar - they're excluded from screenshot
|
|
164
|
-
return element.classList.contains('recap-story__sound-btn') ||
|
|
165
|
-
element.classList.contains('recap-story__share-btn') ||
|
|
166
|
-
element.classList.contains('recap-story__progress-wrap');
|
|
167
|
-
},
|
|
168
|
-
// Apply screenshot-mode to cloned DOM only (not visible to user)
|
|
169
|
-
onclone: (clonedDoc) => {
|
|
170
|
-
const clonedContainer = clonedDoc.querySelector('.recap-story');
|
|
171
|
-
if (clonedContainer) {
|
|
172
|
-
clonedContainer.classList.add('screenshot-mode');
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
console.log('[Screenshot] Canvas created:', canvas.width, 'x', canvas.height);
|
|
177
|
-
const blob = await new Promise((resolve, reject) => {
|
|
178
|
-
canvas.toBlob((b) => {
|
|
179
|
-
if (b)
|
|
180
|
-
resolve(b);
|
|
181
|
-
else
|
|
182
|
-
reject(new Error('Failed to create blob'));
|
|
183
|
-
}, 'image/png', 1.0);
|
|
184
|
-
});
|
|
185
|
-
console.log('[Screenshot] Blob created:', blob.size, 'bytes');
|
|
186
|
-
const mimeType = 'image/png';
|
|
187
|
+
// console.log('[Screenshot] Starting fixed-size capture (1080x1920)...');
|
|
188
|
+
// Create fixed-size off-screen container with cloned content
|
|
189
|
+
captureContainer = createFixedSizeContainer(storyContainer);
|
|
190
|
+
// Small delay to allow styles to apply to cloned content
|
|
191
|
+
await new Promise(resolve => setTimeout(resolve, 50));
|
|
192
|
+
// Capture from the fixed-size container
|
|
193
|
+
const blob = await captureFixedSizeScreenshot(captureContainer);
|
|
194
|
+
// console.log('[Screenshot] Blob created:', blob.size, 'bytes', '(1080x1920)');
|
|
187
195
|
const fileName = `${businessName.replace(/\s+/g, '-')}-recap-${year}-${slideId}.png`;
|
|
188
196
|
// DESKTOP: Always download
|
|
189
197
|
if (!isMobile) {
|
|
190
|
-
console.log('[Screenshot] Desktop - downloading...');
|
|
198
|
+
// console.log('[Screenshot] Desktop - downloading...');
|
|
191
199
|
downloadImage(blob, fileName);
|
|
192
200
|
return;
|
|
193
201
|
}
|
|
194
202
|
// MOBILE (no cache): Try to share, likely will fail due to user gesture timing
|
|
195
203
|
const file = new File([blob], fileName, {
|
|
196
|
-
type:
|
|
204
|
+
type: 'image/png',
|
|
197
205
|
lastModified: Date.now()
|
|
198
206
|
});
|
|
199
207
|
// Cache for next time
|
|
@@ -204,14 +212,17 @@ export async function captureAndShareSlide(containerRef, options) {
|
|
|
204
212
|
console.error('[Screenshot] Capture failed:', error);
|
|
205
213
|
}
|
|
206
214
|
finally {
|
|
207
|
-
|
|
215
|
+
// Clean up off-screen container
|
|
216
|
+
if (captureContainer && captureContainer.parentNode) {
|
|
217
|
+
captureContainer.parentNode.removeChild(captureContainer);
|
|
218
|
+
}
|
|
208
219
|
}
|
|
209
220
|
}
|
|
210
221
|
/**
|
|
211
222
|
* Shares a file using Web Share API with fallbacks
|
|
212
223
|
*/
|
|
213
224
|
async function shareFile(file, businessName, year) {
|
|
214
|
-
console.log('[Screenshot] File to share:', file.name, file.type, file.size, 'bytes');
|
|
225
|
+
// console.log('[Screenshot] File to share:', file.name, file.type, file.size, 'bytes');
|
|
215
226
|
// Validate file size (WhatsApp limit: 5MB for images)
|
|
216
227
|
const maxSize = 5 * 1024 * 1024;
|
|
217
228
|
if (file.size > maxSize) {
|
|
@@ -220,17 +231,17 @@ async function shareFile(file, businessName, year) {
|
|
|
220
231
|
}
|
|
221
232
|
// Check if Web Share API with files is supported
|
|
222
233
|
const canShareFiles = navigator.canShare && navigator.canShare({ files: [file] });
|
|
223
|
-
console.log('[Screenshot] Can share files:', canShareFiles);
|
|
234
|
+
// console.log('[Screenshot] Can share files:', canShareFiles);
|
|
224
235
|
// Try sharing with file
|
|
225
236
|
if (canShareFiles) {
|
|
226
|
-
console.log('[Screenshot] Sharing file...');
|
|
237
|
+
// console.log('[Screenshot] Sharing file...');
|
|
227
238
|
try {
|
|
228
239
|
await navigator.share({
|
|
229
240
|
files: [file],
|
|
230
241
|
title: 'My Huxxle Recap',
|
|
231
242
|
text: `Check out ${businessName}'s Wrapped ${year} highlights! 🎉`
|
|
232
243
|
});
|
|
233
|
-
console.log('[Screenshot] Share successful!');
|
|
244
|
+
// console.log('[Screenshot] Share successful!');
|
|
234
245
|
return;
|
|
235
246
|
}
|
|
236
247
|
catch (shareError) {
|
|
@@ -239,7 +250,7 @@ async function shareFile(file, businessName, year) {
|
|
|
239
250
|
}
|
|
240
251
|
// Fallback: share URL only
|
|
241
252
|
if (navigator.share) {
|
|
242
|
-
console.log('[Screenshot] Sharing URL fallback...');
|
|
253
|
+
// console.log('[Screenshot] Sharing URL fallback...');
|
|
243
254
|
try {
|
|
244
255
|
await navigator.share({
|
|
245
256
|
title: 'My Huxxle Recap',
|
|
@@ -253,7 +264,7 @@ async function shareFile(file, businessName, year) {
|
|
|
253
264
|
}
|
|
254
265
|
}
|
|
255
266
|
// Final fallback: download
|
|
256
|
-
console.log('[Screenshot] Download fallback...');
|
|
267
|
+
// console.log('[Screenshot] Download fallback...');
|
|
257
268
|
const blob = new Blob([await file.arrayBuffer()], { type: file.type });
|
|
258
269
|
downloadImage(blob, file.name);
|
|
259
270
|
}
|
|
@@ -261,7 +272,7 @@ async function shareFile(file, businessName, year) {
|
|
|
261
272
|
* Downloads an image blob
|
|
262
273
|
*/
|
|
263
274
|
function downloadImage(blob, fileName) {
|
|
264
|
-
console.log('[Screenshot] Downloading:', fileName);
|
|
275
|
+
// console.log('[Screenshot] Downloading:', fileName);
|
|
265
276
|
const url = URL.createObjectURL(blob);
|
|
266
277
|
const a = document.createElement('a');
|
|
267
278
|
a.href = url;
|
|
@@ -270,5 +281,5 @@ function downloadImage(blob, fileName) {
|
|
|
270
281
|
a.click();
|
|
271
282
|
document.body.removeChild(a);
|
|
272
283
|
URL.revokeObjectURL(url);
|
|
273
|
-
console.log('[Screenshot] Download complete');
|
|
284
|
+
// console.log('[Screenshot] Download complete');
|
|
274
285
|
}
|
package/package.json
CHANGED
package/src/App.tsx
CHANGED
package/src/RecapStory.css
CHANGED
|
@@ -251,3 +251,291 @@
|
|
|
251
251
|
.recap-story.screenshot-mode .slide7-products__frames {
|
|
252
252
|
overflow: visible !important;
|
|
253
253
|
}
|
|
254
|
+
|
|
255
|
+
/* ===== FIXED-SIZE SCREENSHOT CONTAINER =====
|
|
256
|
+
* Used to render screenshots at consistent 1080x1920 resolution
|
|
257
|
+
* regardless of the user's actual screen size.
|
|
258
|
+
* The container is positioned off-screen and removed after capture.
|
|
259
|
+
*
|
|
260
|
+
* KEY INSIGHT: vw/vh units reference browser viewport, NOT container.
|
|
261
|
+
* We must override ALL vw/vh-based values with fixed pixels.
|
|
262
|
+
* Container: 390px × 692px (~9:16 aspect ratio)
|
|
263
|
+
*
|
|
264
|
+
* This container mimics .app__shell behavior - the actual viewport slides expect.
|
|
265
|
+
*/
|
|
266
|
+
:root {
|
|
267
|
+
/* Fixed screenshot container dimensions used throughout this file */
|
|
268
|
+
--screenshot-container-width: 390px;
|
|
269
|
+
--screenshot-container-height: 692px;
|
|
270
|
+
/*
|
|
271
|
+
* Background is slightly taller than the container (≈1.22x) so the noisy
|
|
272
|
+
* texture tiles cleanly at 1080×1920 export resolution without visible seams.
|
|
273
|
+
* 692px * 1.22 ≈ 844px (original hard-coded value).
|
|
274
|
+
*/
|
|
275
|
+
--screenshot-background-height: calc(var(--screenshot-container-height) * 1.22);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.screenshot-capture-container {
|
|
279
|
+
position: fixed !important;
|
|
280
|
+
left: -9999px !important;
|
|
281
|
+
top: 0 !important;
|
|
282
|
+
z-index: -9999 !important;
|
|
283
|
+
|
|
284
|
+
width: var(--screenshot-container-width) !important;
|
|
285
|
+
height: var(--screenshot-container-height) !important;
|
|
286
|
+
overflow: hidden !important;
|
|
287
|
+
pointer-events: none !important;
|
|
288
|
+
--screenshot-text-offset: -6px;
|
|
289
|
+
/* Mimic .app__shell background */
|
|
290
|
+
background: var(--bg-white) url('https://katajereassets.blob.core.windows.net/recap-videos/noisy-background.png') repeat !important;
|
|
291
|
+
background-size: var(--screenshot-container-width) var(--screenshot-background-height) !important;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
@media (max-width: 768px) {
|
|
295
|
+
.screenshot-capture-container {
|
|
296
|
+
--screenshot-text-offset: -3px;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
@media (max-width: 600px) {
|
|
301
|
+
.screenshot-capture-container {
|
|
302
|
+
--screenshot-text-offset: 0px;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/* Force the cloned recap-story to fill the fixed container exactly */
|
|
307
|
+
.screenshot-capture-container .recap-story {
|
|
308
|
+
width: var(--screenshot-container-width) !important;
|
|
309
|
+
height: var(--screenshot-container-height) !important;
|
|
310
|
+
min-width: var(--screenshot-container-width) !important;
|
|
311
|
+
min-height: var(--screenshot-container-height) !important;
|
|
312
|
+
max-width: var(--screenshot-container-width) !important;
|
|
313
|
+
max-height: var(--screenshot-container-height) !important;
|
|
314
|
+
position: relative !important;
|
|
315
|
+
transform: none !important;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/* Force slides to fill the fixed container */
|
|
319
|
+
.screenshot-capture-container .recap-story__slides {
|
|
320
|
+
width: 100% !important;
|
|
321
|
+
height: 100% !important;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.screenshot-capture-container .recap-story__slides > div {
|
|
325
|
+
width: 100% !important;
|
|
326
|
+
height: 100% !important;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* ===== GLOBAL VW/VH → PX OVERRIDES =====
|
|
330
|
+
* Fix env(safe-area-inset) and vw-based font sizes
|
|
331
|
+
* These affect ALL slides consistently
|
|
332
|
+
*/
|
|
333
|
+
|
|
334
|
+
/* ===== HTML2CANVAS TEXT OFFSET FIX =====
|
|
335
|
+
* html2canvas renders text ~6px lower than browsers.
|
|
336
|
+
* Apply negative transform to ALL text elements to compensate.
|
|
337
|
+
*/
|
|
338
|
+
.screenshot-capture-container .header__badge,
|
|
339
|
+
.screenshot-capture-container .stats-number,
|
|
340
|
+
.screenshot-capture-container .slide3-revenue__amount,
|
|
341
|
+
.screenshot-capture-container .slide4-orders__number,
|
|
342
|
+
.screenshot-capture-container .slide5-buyers__number,
|
|
343
|
+
.screenshot-capture-container .slide6-customer__number,
|
|
344
|
+
.screenshot-capture-container .slide7-products__title,
|
|
345
|
+
.screenshot-capture-container .slide7-products__subtitle,
|
|
346
|
+
.screenshot-capture-container .slide7-products__lead,
|
|
347
|
+
.screenshot-capture-container .slide8-months__entry--current,
|
|
348
|
+
.screenshot-capture-container .slide9-year__crown {
|
|
349
|
+
transform: translateY(var(--screenshot-text-offset, -6px)) !important;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/* Top group: remove safe-area-inset dependency */
|
|
353
|
+
.screenshot-capture-container .recap-story__top-group {
|
|
354
|
+
margin: 24px 16px 0 16px !important;
|
|
355
|
+
gap: 6px !important;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/* Header badge: fix vw-based font-size clamp(14px, 5.13vw, 20px) */
|
|
359
|
+
.screenshot-capture-container .header__badge {
|
|
360
|
+
font-size: 20px !important;
|
|
361
|
+
line-height: 1.2 !important;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/* ===== SLIDE 1 (Intro) OVERRIDES =====
|
|
365
|
+
* Fix env(safe-area-inset) padding and vw/vh font sizes
|
|
366
|
+
*/
|
|
367
|
+
.screenshot-capture-container .slide1-intro {
|
|
368
|
+
/* Remove safe-area-inset from padding: calc(48px + env(safe-area-inset-top)) etc */
|
|
369
|
+
padding: 48px 16px 94px 16px !important;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/* Fix clamp(40px, 16.41vw, 64px) - set to 32px per design */
|
|
373
|
+
.screenshot-capture-container .slide1-intro__brand-container {
|
|
374
|
+
gap: 8px !important;
|
|
375
|
+
transform: translateY(var(--screenshot-text-offset, -6px)) !important;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/* Fix clamp(28px, 10vw, 56px) - 10vw × 390 / 100 = 39px, capped at 56px for short */
|
|
379
|
+
.screenshot-capture-container .slide1-intro__brand {
|
|
380
|
+
font-size: 39px !important;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.screenshot-capture-container .slide1-intro__brand--short {
|
|
384
|
+
font-size: 55px !important; /* clamp(40px, 14vw, 72px) - 14vw = 54.6px */
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.screenshot-capture-container .slide1-intro__brand--medium {
|
|
388
|
+
font-size: 39px !important; /* clamp(32px, 10vw, 56px) */
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.screenshot-capture-container .slide1-intro__brand--long {
|
|
392
|
+
font-size: 27px !important; /* clamp(24px, 7vw, 44px) - 7vw = 27.3px */
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* Fix clamp(24px, 4.7vh, 40px) - 4.7vh × 692 / 100 = 32.5px */
|
|
396
|
+
.screenshot-capture-container .slide1-intro__headline {
|
|
397
|
+
font-size: 33px !important;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/* Fix clamp(14px, 4.1vw, 16px) - already covered globally */
|
|
401
|
+
.screenshot-capture-container .slide1-intro__subtitle {
|
|
402
|
+
font-size: 16px !important;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/* Fix frames gap: clamp(8px, 3.08vw, 12px) - 3.08vw = 12px */
|
|
406
|
+
.screenshot-capture-container .slide1-intro__frames {
|
|
407
|
+
gap: 12px !important;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/* Fix frame width: clamp(140px, 46.15vw, 180px) - 46.15vw = 180px */
|
|
411
|
+
.screenshot-capture-container .slide1-intro__frames .frame-rect {
|
|
412
|
+
width: 180px !important;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/* ===== GLOBAL FONT SIZE FIXES =====
|
|
416
|
+
* Many text elements use clamp() with vw units
|
|
417
|
+
* Convert to fixed pixels for 390px width
|
|
418
|
+
* Formula: X vw × 390px / 100 = Y px
|
|
419
|
+
*/
|
|
420
|
+
|
|
421
|
+
/* Large numbers/stats: clamp(32px, 10.26vw, 40px) → 40px */
|
|
422
|
+
.screenshot-capture-container .stats-number,
|
|
423
|
+
.screenshot-capture-container .streak-number,
|
|
424
|
+
.screenshot-capture-container .slide3-revenue__amount,
|
|
425
|
+
.screenshot-capture-container .slide4-orders__number,
|
|
426
|
+
.screenshot-capture-container .slide5-buyers__number,
|
|
427
|
+
.screenshot-capture-container .slide6-customer__number,
|
|
428
|
+
.screenshot-capture-container .slide3-revenue__currency,
|
|
429
|
+
.screenshot-capture-container .slide8-months__entry--current {
|
|
430
|
+
font-size: 40px !important;
|
|
431
|
+
}
|
|
432
|
+
.screenshot-capture-container .slide9-year__crown{
|
|
433
|
+
font-size: 60px !important;
|
|
434
|
+
}
|
|
435
|
+
/* Medium text: clamp(18px, 6.15vw, 24px) → 24px */
|
|
436
|
+
.screenshot-capture-container .slide7-products__rank {
|
|
437
|
+
font-size: 24px !important;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/* Product titles: clamp(16px, 5.13vw, 20px) → 20px */
|
|
441
|
+
.screenshot-capture-container .slide7-products__title {
|
|
442
|
+
font-size: 18px !important;
|
|
443
|
+
padding-bottom: 10px !important;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.screenshot-capture-container .slide7-products__subtitle {
|
|
447
|
+
font-size: 10px !important;
|
|
448
|
+
}
|
|
449
|
+
/* Labels/subtitles: clamp(14px, 4.1vw, 16px) → 16px */
|
|
450
|
+
.screenshot-capture-container .stats-label,
|
|
451
|
+
.screenshot-capture-container .stats-sublabel,
|
|
452
|
+
.screenshot-capture-container .streak-label,
|
|
453
|
+
.screenshot-capture-container .slide5-buyers__label,
|
|
454
|
+
.screenshot-capture-container .slide6-customer__label,
|
|
455
|
+
.screenshot-capture-container .slide7-products__lead,
|
|
456
|
+
.screenshot-capture-container .slide7-products__subtitle {
|
|
457
|
+
font-size: 16px !important;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/* ===== SLIDE 9 (Year) VH OVERRIDES =====
|
|
461
|
+
* Convert vh units to fixed pixels for 692px height
|
|
462
|
+
*/
|
|
463
|
+
.screenshot-capture-container .slide9-year {
|
|
464
|
+
padding-top: 121px !important; /* 17.54vh = 121px */
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.screenshot-capture-container .slide9-year__rect-layer--top {
|
|
468
|
+
top: 346px !important; /* 50vh = 346px */
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
.screenshot-capture-container .slide9-year__rect-layer--bottom {
|
|
472
|
+
top: 553px !important; /* 79.86vh = 553px */
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.screenshot-capture-container .slide9-year__rect {
|
|
476
|
+
height: 197px !important; /* 28.4vh = 197px */
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/* .screenshot-capture-container .slide6-customer__link-text {
|
|
480
|
+
padding-bottom: 14px !important;
|
|
481
|
+
} */
|
|
482
|
+
|
|
483
|
+
/* ===== SLIDE 7 (Products) VH OVERRIDES =====
|
|
484
|
+
* Convert vh units to fixed pixels for 692px height
|
|
485
|
+
*/
|
|
486
|
+
.screenshot-capture-container .slide7-products {
|
|
487
|
+
margin-top: 89px !important; /* 12.8vh = 89px */
|
|
488
|
+
gap: 33px !important; /* 4.74vh = 33px */
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.screenshot-capture-container .slide7-products__list {
|
|
492
|
+
gap: 6px !important; /* 0.9vh = 6px */
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.screenshot-capture-container .slide7-products__row {
|
|
496
|
+
height: 79px !important; /* 11.37vh = 79px */
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.screenshot-capture-container .slide7-products__card {
|
|
500
|
+
height: 72px !important; /* 10.37vh = 72px */
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.screenshot-capture-container .slide7-products__frames {
|
|
504
|
+
top: 500px !important; /* 72.27vh = 500px */
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
.screenshot-capture-container .slide7-products__title, .slide7-products__subtitle{
|
|
508
|
+
max-width: 300px !important;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.screenshot-capture-container .slide7-products__text{
|
|
512
|
+
gap: 8px !important; /* 1.15vh = 8px */
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.screenshot-capture-container .slide7-products__subtitle{
|
|
516
|
+
margin-top: -10px !important;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/* ===== SLIDE 2 (Days) SAFE-AREA OVERRIDES =====
|
|
520
|
+
* Fix env(safe-area-inset) margins
|
|
521
|
+
*/
|
|
522
|
+
.screenshot-capture-container .slide2-days__streak-section{
|
|
523
|
+
gap: 16px !important;
|
|
524
|
+
}
|
|
525
|
+
.screenshot-capture-container .slide2-days__stats {
|
|
526
|
+
margin: 128px 16px 0 16px !important; /* Remove safe-area-inset */
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.screenshot-capture-container .slide2-days__streak {
|
|
530
|
+
margin: 393px 16px 0 16px !important; /* 56.75vh × 692 / 100 = 393px */
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
/* ===== SLIDE 6 (Customer) SAFE-AREA OVERRIDES ===== */
|
|
534
|
+
.screenshot-capture-container .slide6-customer__link-bar {
|
|
535
|
+
bottom: 100px !important; /* Remove safe-area-inset */
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/* ===== SLIDE 10 (Final) SAFE-AREA OVERRIDES ===== */
|
|
539
|
+
.screenshot-capture-container .slide10-final__bottom {
|
|
540
|
+
padding-bottom: 24px !important; /* Remove safe-area-inset */
|
|
541
|
+
}
|