@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.
@@ -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
+ }
@@ -23,8 +23,8 @@
23
23
  left: 50%;
24
24
  top: 16px;
25
25
  transform: translateX(-50%);
26
- /* Height calculated: from 16px top to 16px below link bar (link bar is at ~312px, height 36px) */
27
- height: clamp(280px, 41vh, 348px);
26
+ /* Height: ~41% of container height */
27
+ height: clamp(280px, 41%, 348px);
28
28
  animation: rectBounce1 3s ease-in-out infinite;
29
29
  }
30
30
 
@@ -32,10 +32,10 @@
32
32
  width: calc(100% - 64px);
33
33
  max-width: 334px;
34
34
  left: 50%;
35
- top: clamp(80px, 12vh, 108px);
35
+ top: clamp(80px, 12%, 108px);
36
36
  transform: translateX(-50%);
37
- /* Height calculated: from 108px top to 32px below link bar */
38
- height: clamp(220px, 32vh, 272px);
37
+ /* Height: ~32% of container height */
38
+ height: clamp(220px, 32%, 272px);
39
39
  animation: rectBounce2 3s ease-in-out infinite;
40
40
  }
41
41
 
@@ -53,12 +53,10 @@
53
53
  /* Globe icon wrapper */
54
54
  .slide6-customer__globe-wrapper {
55
55
  position: absolute;
56
- width: 24vw;
57
- max-width: 94px;
58
- min-width: 60px;
56
+ width: clamp(60px, 24%, 94px);
59
57
  aspect-ratio: 94 / 100;
60
58
  left: 50%;
61
- top: 18.5vh;
59
+ top: 18.5%;
62
60
  transform: translateX(-50%);
63
61
  display: flex;
64
62
  align-items: center;
@@ -79,13 +77,13 @@
79
77
  max-width: 302px;
80
78
  height: 36px;
81
79
  left: 50%;
82
- top: clamp(260px, 37vh, 312px);
80
+ top: clamp(260px, 37%, 312px);
83
81
  transform: translateX(-50%);
84
82
  display: flex;
85
83
  flex-direction: row;
86
84
  align-items: center;
87
85
  justify-content: space-evenly;
88
- padding: 8px;
86
+ /* padding: 8px; */
89
87
  gap: 8px;
90
88
  background: #FCFCFC;
91
89
  border: 1px solid #CDCCF4;
@@ -96,6 +94,7 @@
96
94
  width: 20px;
97
95
  height: 20px;
98
96
  flex-shrink: 0;
97
+ align-self: center;
99
98
  }
100
99
 
101
100
  .slide6-customer__link-text {
@@ -103,12 +102,13 @@
103
102
  font-style: normal;
104
103
  font-weight: 600;
105
104
  font-size: 12px;
106
- line-height: 120%;
105
+ line-height: 36px; /* Match link-bar height for vertical centering */
107
106
  text-align: center;
108
107
  color: #4F4CD8;
109
108
  white-space: nowrap;
110
109
  overflow: hidden;
111
110
  text-overflow: ellipsis;
111
+ align-self: center;
112
112
  }
113
113
 
114
114
  /* Stats content */
@@ -139,8 +139,8 @@
139
139
  font-family: 'Lora', serif;
140
140
  font-style: normal;
141
141
  font-weight: 700;
142
- font-size: clamp(60px, 10vh, 80px);
143
- line-height: 1;
142
+ font-size: clamp(60px, 10%, 80px);
143
+ /* line-height: 1; */
144
144
  text-align: center;
145
145
  color: #4F4CD8;
146
146
  margin: 0;
@@ -148,7 +148,7 @@
148
148
 
149
149
  /* Secondary number styling - like repeat buyers in Slide5 */
150
150
  .slide6-customer__number--secondary {
151
- font-size: clamp(50px, 8vh, 70px);
151
+ font-size: clamp(50px, 8%, 70px);
152
152
  color: #FFFFFF;
153
153
  -webkit-text-stroke: 1.5px #4F4CD8;
154
154
  paint-order: stroke fill;
@@ -160,7 +160,7 @@
160
160
  font-style: normal;
161
161
  font-weight: 400;
162
162
  font-size: clamp(14px, 4.1vw, 16px);
163
- line-height: 1.5;
163
+ /* line-height: 1.5; */
164
164
  text-align: center;
165
165
  color: #3734D3;
166
166
  margin: 0;
@@ -177,7 +177,7 @@
177
177
  font-style: normal;
178
178
  font-weight: 400;
179
179
  font-size: clamp(14px, 4.1vw, 16px);
180
- line-height: 1.5;
180
+ /* line-height: 1.5; */
181
181
  text-align: center;
182
182
  color: #3734D3;
183
183
  }
@@ -197,7 +197,7 @@
197
197
  .slide6-customer__globe-wrapper {
198
198
  width: 70px;
199
199
  min-width: 70px;
200
- top: 16vh;
200
+ top: 16%;
201
201
  }
202
202
 
203
203
  .slide6-customer__link-bar {
@@ -210,11 +210,11 @@
210
210
  }
211
211
 
212
212
  .slide6-customer__number {
213
- font-size: clamp(50px, 9dvh, 70px);
213
+ font-size: clamp(50px, 10%, 70px);
214
214
  }
215
215
 
216
216
  .slide6-customer__number--secondary {
217
- font-size: clamp(42px, 7dvh, 60px);
217
+ font-size: clamp(42px, 8%, 60px);
218
218
  }
219
219
  }
220
220
 
@@ -233,17 +233,18 @@
233
233
  .slide6-customer__globe-wrapper {
234
234
  width: 60px;
235
235
  min-width: 60px;
236
- top: 14vh;
236
+ top: 14%;
237
237
  }
238
238
 
239
239
  .slide6-customer__link-bar {
240
240
  height: 32px;
241
- padding: 6px;
241
+ /* padding: 6px; */
242
242
  top: 220px;
243
243
  }
244
244
 
245
245
  .slide6-customer__link-text {
246
246
  font-size: 11px;
247
+ line-height: 32px; /* Match link-bar height */
247
248
  }
248
249
 
249
250
  .slide6-customer__content {
@@ -256,11 +257,11 @@
256
257
  }
257
258
 
258
259
  .slide6-customer__number {
259
- font-size: clamp(44px, 8dvh, 60px);
260
+ font-size: clamp(44px, 9%, 60px);
260
261
  }
261
262
 
262
263
  .slide6-customer__number--secondary {
263
- font-size: clamp(36px, 6dvh, 52px);
264
+ font-size: clamp(36px, 7%, 52px);
264
265
  }
265
266
 
266
267
  .slide6-customer__label {
@@ -288,17 +289,18 @@
288
289
  .slide6-customer__globe-wrapper {
289
290
  width: 50px;
290
291
  min-width: 50px;
291
- top: 12vh;
292
+ top: 12%;
292
293
  }
293
294
 
294
295
  .slide6-customer__link-bar {
295
296
  height: 28px;
296
- padding: 4px 6px;
297
+ /* padding: 4px 6px; */
297
298
  top: 180px;
298
299
  }
299
300
 
300
301
  .slide6-customer__link-text {
301
302
  font-size: 10px;
303
+ line-height: 28px; /* Match link-bar height */
302
304
  }
303
305
 
304
306
  .slide6-customer__search-icon {
@@ -316,11 +318,11 @@
316
318
  }
317
319
 
318
320
  .slide6-customer__number {
319
- font-size: clamp(38px, 7dvh, 52px);
321
+ font-size: clamp(38px, 8%, 52px);
320
322
  }
321
323
 
322
324
  .slide6-customer__number--secondary {
323
- font-size: clamp(30px, 5dvh, 44px);
325
+ font-size: clamp(30px, 6%, 44px);
324
326
  }
325
327
 
326
328
  .slide6-customer__label {
@@ -48,7 +48,7 @@
48
48
  font-family: 'Lora', serif;
49
49
  font-size: clamp(18px, 6.15vw, 24px);
50
50
  font-weight: 700;
51
- line-height: 1.3;
51
+ /* line-height: 1.3; */
52
52
  background: var(--bg-gradient);
53
53
  -webkit-background-clip: text;
54
54
  -webkit-text-fill-color: transparent;
@@ -89,7 +89,7 @@
89
89
  .slide7-products__text {
90
90
  display: flex;
91
91
  flex-direction: column;
92
- gap: 0.83%;
92
+ /* gap: 0.83%; */
93
93
  }
94
94
 
95
95
  .slide7-products__title,
@@ -106,7 +106,7 @@
106
106
  .slide7-products__title {
107
107
  font-size: clamp(16px, 5.13vw, 20px);
108
108
  font-weight: 700;
109
- line-height: 1.3;
109
+ /* line-height: 1.3; */
110
110
  display: -webkit-box;
111
111
  -webkit-box-orient: vertical;
112
112
  -webkit-line-clamp: 2;
@@ -6,6 +6,7 @@ export interface ScreenshotOptions {
6
6
  /**
7
7
  * Pre-captures a screenshot of the slide and caches it.
8
8
  * Call this when a slide becomes active so the image is ready for instant sharing.
9
+ * Uses fixed 1080x1920 dimensions for consistent output across all devices.
9
10
  */
10
11
  export declare function preCaptureSlide(containerRef: HTMLElement | null, options: ScreenshotOptions): Promise<void>;
11
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"slideScreenshot.d.ts","sourceRoot":"","sources":["../../src/utils/slideScreenshot.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AAaD;;;GAGG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,WAAW,GAAG,IAAI,EAChC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAiEf;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAItE;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,WAAW,GAAG,IAAI,EAChC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CAqIf"}
1
+ {"version":3,"file":"slideScreenshot.d.ts","sourceRoot":"","sources":["../../src/utils/slideScreenshot.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AA4ED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,WAAW,GAAG,IAAI,EAChC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CA+Cf;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAItE;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,YAAY,EAAE,WAAW,GAAG,IAAI,EAChC,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,IAAI,CAAC,CA8Gf"}