@widelab-nc/widehue 1.0.39 → 1.0.40
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 +4 -4
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
- package/src/index.js +128 -33
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -24,12 +24,32 @@ function customGsapEasing() {
|
|
|
24
24
|
// Contact form open animation
|
|
25
25
|
let contactFormOpen;
|
|
26
26
|
|
|
27
|
+
// 1. GŁÓWNY PROBLEM: Refresh ScrollTrigger po pełnym załadowaniu
|
|
27
28
|
function refreshScrollTriggersAfterLoad() {
|
|
28
29
|
window.addEventListener('load', () => {
|
|
29
30
|
console.log('[ScrollTrigger] Page fully loaded — refreshing all triggers');
|
|
31
|
+
|
|
32
|
+
// ZWIĘKSZ DELAY dla Safari
|
|
30
33
|
setTimeout(() => {
|
|
31
34
|
ScrollTrigger.refresh();
|
|
32
|
-
|
|
35
|
+
|
|
36
|
+
// DODATKOWY refresh dla Safari
|
|
37
|
+
if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
ScrollTrigger.refresh();
|
|
40
|
+
console.log('[Safari] Additional ScrollTrigger refresh');
|
|
41
|
+
}, 500);
|
|
42
|
+
}
|
|
43
|
+
}, 200); // Zwiększone z 100ms do 200ms
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// DODAJ refresh na resize dla Safari
|
|
47
|
+
window.addEventListener('resize', () => {
|
|
48
|
+
if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
|
49
|
+
setTimeout(() => {
|
|
50
|
+
ScrollTrigger.refresh();
|
|
51
|
+
}, 100);
|
|
52
|
+
}
|
|
33
53
|
});
|
|
34
54
|
}
|
|
35
55
|
|
|
@@ -89,12 +109,30 @@ const lenis = new Lenis({
|
|
|
89
109
|
duration: 1.2,
|
|
90
110
|
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
|
|
91
111
|
});
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
// 2. POPRAWKA DLA LENIS + Safari
|
|
92
115
|
function lenisScroll() {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
116
|
+
// Sprawdź czy to Safari
|
|
117
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
118
|
+
|
|
119
|
+
lenis.on('scroll', (e) => {
|
|
120
|
+
ScrollTrigger.update();
|
|
121
|
+
|
|
122
|
+
// Dodatkowe wymuszenie update dla Safari
|
|
123
|
+
if (isSafari) {
|
|
124
|
+
requestAnimationFrame(() => {
|
|
125
|
+
ScrollTrigger.update();
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
gsap.ticker.add((time) => {
|
|
131
|
+
lenis.raf(time * 1000);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
gsap.ticker.lagSmoothing(0);
|
|
135
|
+
|
|
98
136
|
function raf(time) {
|
|
99
137
|
lenis.raf(time);
|
|
100
138
|
requestAnimationFrame(raf);
|
|
@@ -102,6 +140,8 @@ function lenisScroll() {
|
|
|
102
140
|
requestAnimationFrame(raf);
|
|
103
141
|
}
|
|
104
142
|
|
|
143
|
+
|
|
144
|
+
|
|
105
145
|
// Lazy load videos
|
|
106
146
|
function lazyLoadVideos() {
|
|
107
147
|
let lazyVideos = [].slice.call(document.querySelectorAll("video.lazyload"));
|
|
@@ -202,10 +242,10 @@ function initBasicAnimations() {
|
|
|
202
242
|
}
|
|
203
243
|
}
|
|
204
244
|
|
|
245
|
+
// 5. ULEPSZONE pageLoadAnimation
|
|
205
246
|
function pageLoadAnimation() {
|
|
206
247
|
console.log('pageLoadAnimation function called');
|
|
207
248
|
|
|
208
|
-
// Check if all required loader elements exist
|
|
209
249
|
const requiredElements = [
|
|
210
250
|
'.loader_ract.is-left',
|
|
211
251
|
'.loader_ract.is-right',
|
|
@@ -228,10 +268,20 @@ function pageLoadAnimation() {
|
|
|
228
268
|
console.log('First animation step triggered: scrollRestoration and scrollTo');
|
|
229
269
|
history.scrollRestoration = 'manual';
|
|
230
270
|
|
|
231
|
-
//
|
|
271
|
+
// POPRAWKA: Lepszy scroll to top dla Safari
|
|
272
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
273
|
+
|
|
232
274
|
if (typeof lenis !== 'undefined' && lenis.scrollTo) {
|
|
233
275
|
try {
|
|
234
276
|
lenis.scrollTo(0, { immediate: true });
|
|
277
|
+
|
|
278
|
+
// Dodatkowe wymuszenie dla Safari
|
|
279
|
+
if (isSafari) {
|
|
280
|
+
setTimeout(() => {
|
|
281
|
+
window.scrollTo(0, 0);
|
|
282
|
+
lenis.scrollTo(0, { immediate: true });
|
|
283
|
+
}, 50);
|
|
284
|
+
}
|
|
235
285
|
} catch (e) {
|
|
236
286
|
console.warn('Lenis scrollTo failed, using fallback:', e);
|
|
237
287
|
window.scrollTo(0, 0);
|
|
@@ -263,6 +313,11 @@ function pageLoadAnimation() {
|
|
|
263
313
|
console.log('lenis started');
|
|
264
314
|
if (typeof lenis !== 'undefined' && lenis.start) {
|
|
265
315
|
lenis.start();
|
|
316
|
+
|
|
317
|
+
// Refresh ScrollTrigger po starcie lenis
|
|
318
|
+
setTimeout(() => {
|
|
319
|
+
ScrollTrigger.refresh();
|
|
320
|
+
}, 100);
|
|
266
321
|
}
|
|
267
322
|
}, '>')
|
|
268
323
|
.to('.loader_wrapper', {
|
|
@@ -275,23 +330,19 @@ function pageLoadAnimation() {
|
|
|
275
330
|
|
|
276
331
|
console.log('Animation timeline defined');
|
|
277
332
|
|
|
278
|
-
// Update on screen resize - with element existence check
|
|
279
333
|
window.addEventListener('resize', function () {
|
|
280
334
|
console.log('Window resize event triggered');
|
|
281
335
|
setTimeout(function () {
|
|
282
336
|
if (document.querySelector('.loader_wrapper')) {
|
|
283
337
|
console.log('Set .loader_wrapper to display:none on resize');
|
|
284
338
|
gsap.set('.loader_wrapper', { display: 'none' });
|
|
285
|
-
} else {
|
|
286
|
-
console.warn('Loader wrapper not found on resize');
|
|
287
339
|
}
|
|
288
340
|
}, 50);
|
|
289
341
|
});
|
|
290
|
-
|
|
291
|
-
console.log('Resize event listener added');
|
|
292
342
|
}
|
|
293
343
|
|
|
294
344
|
|
|
345
|
+
|
|
295
346
|
// Page transition animation
|
|
296
347
|
function pageTransitionAnimation() {
|
|
297
348
|
const transitionLinks = document.querySelectorAll(
|
|
@@ -500,37 +551,60 @@ window.heroAnimationOnLoad = function(e) {
|
|
|
500
551
|
console.log('Page reloaded; session flag cleared.');
|
|
501
552
|
}
|
|
502
553
|
|
|
554
|
+
// POPRAWKA: Ustaw initial state przed SplitText
|
|
503
555
|
gsap.set('.wideletter', { y: '-150%', scale: 1 });
|
|
556
|
+
gsap.set('#heroHeading', { opacity: 0 }); // DODANE
|
|
504
557
|
|
|
558
|
+
// POPRAWKA: Scroll to top z większym delay dla Safari
|
|
505
559
|
if (typeof lenis !== 'undefined') {
|
|
506
560
|
console.log('Lenis instance found, attempting to scroll to top');
|
|
561
|
+
|
|
562
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
563
|
+
const delay = isSafari ? 300 : 100; // Większy delay dla Safari
|
|
564
|
+
|
|
507
565
|
setTimeout(() => {
|
|
508
566
|
lenis.scrollTo(0, { duration: 0, easing: (t) => t });
|
|
509
567
|
console.log('Lenis scrollTo action called after delay');
|
|
510
|
-
},
|
|
511
|
-
} else {
|
|
512
|
-
console.log('Lenis instance not found');
|
|
568
|
+
}, delay);
|
|
513
569
|
}
|
|
514
570
|
|
|
515
571
|
const videoMask = e.querySelector('.hero_headline_ract-mask');
|
|
516
572
|
const video = e.querySelector('video.lazyload');
|
|
517
573
|
const heroAnimation = gsap.timeline({});
|
|
518
|
-
const homeHeroHeading = new SplitText('#heroHeading', {
|
|
519
|
-
type: 'lines',
|
|
520
|
-
linesClass: 'hero-line',
|
|
521
|
-
});
|
|
522
|
-
const homeHeroHeadingMask = new SplitText('#heroHeading', {
|
|
523
|
-
type: 'lines',
|
|
524
|
-
linesClass: 'hero-line-mask',
|
|
525
|
-
});
|
|
526
574
|
|
|
527
|
-
|
|
575
|
+
// POPRAWKA: Dodaj fallback jeśli SplitText nie działa
|
|
576
|
+
let homeHeroHeading, homeHeroHeadingMask, heroLines;
|
|
577
|
+
|
|
578
|
+
try {
|
|
579
|
+
homeHeroHeading = new SplitText('#heroHeading', {
|
|
580
|
+
type: 'lines',
|
|
581
|
+
linesClass: 'hero-line',
|
|
582
|
+
});
|
|
583
|
+
homeHeroHeadingMask = new SplitText('#heroHeading', {
|
|
584
|
+
type: 'lines',
|
|
585
|
+
linesClass: 'hero-line-mask',
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
heroLines = document.querySelectorAll('.hero-line');
|
|
589
|
+
|
|
590
|
+
if (heroLines.length === 0) {
|
|
591
|
+
throw new Error('SplitText failed to create lines');
|
|
592
|
+
}
|
|
593
|
+
} catch (error) {
|
|
594
|
+
console.error('SplitText error:', error);
|
|
595
|
+
// Fallback: użyj oryginalnego elementu
|
|
596
|
+
heroLines = [document.querySelector('#heroHeading')];
|
|
597
|
+
if (heroLines[0]) {
|
|
598
|
+
heroLines[0].classList.add('hero-line');
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
|
|
528
602
|
if (heroLines.length === 0) {
|
|
529
603
|
console.error('GSAP target .hero-line not found.');
|
|
530
604
|
return;
|
|
531
605
|
}
|
|
532
606
|
|
|
533
|
-
//
|
|
607
|
+
// Reszta funkcji bez zmian...
|
|
534
608
|
function updateVideoSources() {
|
|
535
609
|
const isMobile = window.innerWidth < 992;
|
|
536
610
|
const mobileMp4 = video.getAttribute('mobile-mp4');
|
|
@@ -546,24 +620,19 @@ window.heroAnimationOnLoad = function(e) {
|
|
|
546
620
|
webmSource.setAttribute('data-src', mobileWebm);
|
|
547
621
|
}
|
|
548
622
|
} else {
|
|
549
|
-
// Revert to desktop sources if necessary
|
|
550
623
|
mp4Source.setAttribute('data-src', mp4Source.getAttribute('data-src').replace('mobile-', ''));
|
|
551
624
|
webmSource.setAttribute('data-src', webmSource.getAttribute('data-src').replace('mobile-', ''));
|
|
552
625
|
}
|
|
553
626
|
}
|
|
554
627
|
|
|
555
|
-
// Initial call to update video sources
|
|
556
628
|
updateVideoSources();
|
|
557
|
-
|
|
558
|
-
// Add event listener for window resize to update video sources
|
|
559
629
|
window.addEventListener('resize', updateVideoSources);
|
|
560
630
|
|
|
561
631
|
if (video) {
|
|
562
|
-
// Prevent the video from autoplaying when lazy-loaded
|
|
563
632
|
video.setAttribute('data-no-autoplay', 'true');
|
|
564
633
|
video.addEventListener('loadeddata', () => {
|
|
565
634
|
if (video.hasAttribute('data-no-autoplay')) {
|
|
566
|
-
video.pause();
|
|
635
|
+
video.pause();
|
|
567
636
|
}
|
|
568
637
|
});
|
|
569
638
|
}
|
|
@@ -577,7 +646,6 @@ window.heroAnimationOnLoad = function(e) {
|
|
|
577
646
|
|
|
578
647
|
heroAnimation.to('.navbar_brand_lottie', {
|
|
579
648
|
duration: 1.5,
|
|
580
|
-
// Usuń progress: 1 całkowicie
|
|
581
649
|
onComplete: function() {
|
|
582
650
|
console.log('Lottie animation completed');
|
|
583
651
|
gsap.to('.navbar_brand_lottie', { opacity: 0, duration: 0.25 });
|
|
@@ -637,6 +705,33 @@ window.heroAnimationOnLoad = function(e) {
|
|
|
637
705
|
console.log('Animation timeline setup completed');
|
|
638
706
|
}
|
|
639
707
|
|
|
708
|
+
// 4. DODAJ GLOBAL FIX dla Safari
|
|
709
|
+
function initSafariFixes() {
|
|
710
|
+
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
711
|
+
|
|
712
|
+
if (isSafari) {
|
|
713
|
+
console.log('Safari detected - applying fixes');
|
|
714
|
+
|
|
715
|
+
// Fix dla viewport height na mobile Safari
|
|
716
|
+
const fixViewportHeight = () => {
|
|
717
|
+
const vh = window.innerHeight * 0.01;
|
|
718
|
+
document.documentElement.style.setProperty('--vh', `${vh}px`);
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
fixViewportHeight();
|
|
722
|
+
window.addEventListener('resize', fixViewportHeight);
|
|
723
|
+
window.addEventListener('orientationchange', () => {
|
|
724
|
+
setTimeout(fixViewportHeight, 100);
|
|
725
|
+
});
|
|
726
|
+
|
|
727
|
+
// Dodatkowy refresh ScrollTrigger po orientationchange
|
|
728
|
+
window.addEventListener('orientationchange', () => {
|
|
729
|
+
setTimeout(() => {
|
|
730
|
+
ScrollTrigger.refresh();
|
|
731
|
+
}, 300);
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
}
|
|
640
735
|
|
|
641
736
|
window.briefContact = function(e) {
|
|
642
737
|
const button = document.querySelector('.brief-button');
|