@widelab-nc/widehue 1.0.61 → 1.0.62

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widelab-nc/widehue",
3
- "version": "1.0.61",
3
+ "version": "1.0.62",
4
4
  "description": "Widelab starter template based on Finsweet template + add-ons.",
5
5
  "homepage": "https://widelab.co",
6
6
  "license": "ISC",
package/src/index.js CHANGED
@@ -767,70 +767,50 @@ window.caseCategories = function(e) {
767
767
 
768
768
  }
769
769
 
770
+ // 3. TEXT SCROLL (SplitText) - tylko desktop
770
771
  window.textScroll = function(e) {
771
- // Create a GSAP timeline for the reveal animation
772
- const revealTimeline = gsap.timeline({
773
- scrollTrigger: {
774
- trigger: '.stats-content_wrapper',
775
- start: 'top center+=200', // Start the animation when the top of the element reaches the center of the viewport
776
- }
777
- });
772
+ let mm = gsap.matchMedia();
778
773
 
779
- // Initialize SplitText for the target text
780
- const homeHeroHeading = new SplitText('#heroHeading', {
781
- type: 'lines',
782
- linesClass: 'hero-line',
783
- });
784
- const homeHeroHeadingMask = new SplitText('#heroHeading', {
785
- type: 'lines',
786
- linesClass: 'hero-line-mask',
774
+ mm.add(isDesktop, () => {
775
+ const homeHeroHeading = new SplitText('#heroHeading', { type: 'lines', linesClass: 'hero-line' });
776
+ const homeHeroHeadingMask = new SplitText('#heroHeading', { type: 'lines', linesClass: 'hero-line-mask' });
777
+ const revealScrollElements = document.querySelectorAll('.reveal-scroll');
778
+
779
+ const tl = gsap.timeline({
780
+ scrollTrigger: {
781
+ trigger: '.stats-content_wrapper',
782
+ start: 'top center+=200',
783
+ }
784
+ });
785
+
786
+ tl.fromTo(revealScrollElements, { y: '100%', opacity: 0 }, { y: '0%', opacity: 1, duration: 1.2, stagger: 0.2, ease: 'loader2' })
787
+ .fromTo('.hero-line', { y: '100%' }, { duration: 1.2, y: '0%', stagger: 0.2, ease: 'loader2' }, '<')
788
+ .fromTo('.hero-line-mask', { y: '100%' }, { duration: 1.2, y: '0%', stagger: 0.2, ease: 'loader2' }, '<');
787
789
  });
788
790
 
789
- // Ensure .hero-line elements are created
790
- const heroLines = document.querySelectorAll('.hero-line');
791
- if (heroLines.length === 0) {
792
- return;
793
- }
791
+ mm.add("(max-width: 991px)", () => {
792
+ gsap.set(['#heroHeading', '.reveal-scroll'], { opacity: 1, y: 0 });
793
+ });
794
+ };
794
795
 
795
- // Set initial state for hero lines and masks
796
- gsap.set('.hero-line', { y: '100%' });
797
- gsap.set('.hero-line-mask', { y: '100%' });
796
+ // 4. SPAN VIDEO MASK - tylko desktop
797
+ window.spanVideoMaskAnimation = function(e) {
798
+ let mm = gsap.matchMedia();
798
799
 
799
- // Select all .reveal-scroll elements
800
- const revealScrollElements = document.querySelectorAll('.reveal-scroll');
800
+ mm.add(isDesktop, () => {
801
+ gsap.to(e, {
802
+ scrollTrigger: { trigger: e, start: 'bottom bottom-=5%' },
803
+ width: 0,
804
+ ease: 'loader2',
805
+ duration: 0.6,
806
+ });
807
+ });
801
808
 
802
- // Add animations to the timeline with a stagger
803
- revealTimeline.fromTo(revealScrollElements, {
804
- y: '100%',
805
- opacity: 0
806
- }, {
807
- y: '0%',
808
- opacity: 1,
809
- duration: 1.2,
810
- stagger: 0.2,
811
- ease: 'loader2',
809
+ mm.add("(max-width: 991px)", () => {
810
+ gsap.set(e, { width: 0 });
812
811
  });
812
+ }
813
813
 
814
- // Sync the hero-line animation with the opacity change of #heroHeading
815
- revealTimeline.fromTo('.hero-line', {
816
- y: '100%'
817
- }, {
818
- duration: 1.2,
819
- y: '0%',
820
- stagger: 0.2,
821
- ease: 'loader2',
822
- }, '<'); // Sync with the opacity change of #heroHeading
823
-
824
- // Sync the hero-line-mask animation with the hero-line animation
825
- revealTimeline.fromTo('.hero-line-mask', {
826
- y: '100%'
827
- }, {
828
- duration: 1.2,
829
- y: '0%',
830
- stagger: 0.2,
831
- ease: 'loader2',
832
- }, '<'); // Sync with the hero-line animation
833
- };
834
814
 
835
815
  window.HoverMaskVideo = function(root) {
836
816
  const hoverTitles = root.querySelectorAll('.hover-title');
@@ -1560,36 +1540,29 @@ window.addEventListener('resize', function() {
1560
1540
  });
1561
1541
 
1562
1542
 
1563
-
1543
+ // 5. CASE STUDY MASK (caseStudyInteraction) - tylko desktop
1564
1544
  window.caseStudyInteraction = function(e) {
1565
1545
  const mask = e.querySelector('.portfolio_item_image-mask');
1546
+ if (!mask) return;
1566
1547
 
1567
- if (mask) {
1568
- console.log("Maska znaleziona dla:", e);
1569
- console.log("Początkowa szerokość maski:", mask.offsetWidth);
1548
+ let mm = gsap.matchMedia();
1570
1549
 
1571
- const maskAnimation = gsap.to(mask, {
1550
+ mm.add(isDesktop, () => {
1551
+ gsap.to(mask, {
1572
1552
  scaleX: 0,
1573
- duration: 1.5, // Dajemy długi czas, żebyś NA PEWNO widział jeśli ruszy
1553
+ duration: 1.5,
1574
1554
  ease: 'power2.out',
1575
- paused: true,
1576
- onStart: () => console.log("Animacja maski wystartowała!"),
1577
- onComplete: () => console.log("Animacja maski zakończona!")
1578
- });
1579
-
1580
- ScrollTrigger.create({
1581
- trigger: mask,
1582
- start: 'top 85%',
1583
- markers: false, // DODAJEMY MARKERY - zobaczysz na ekranie linie start/end
1584
- onEnter: () => {
1585
- console.log("ScrollTrigger: Enter!");
1586
- maskAnimation.play();
1555
+ scrollTrigger: {
1556
+ trigger: mask,
1557
+ start: 'top 85%'
1587
1558
  }
1588
1559
  });
1589
- }
1590
- }
1591
-
1560
+ });
1592
1561
 
1562
+ mm.add("(max-width: 991px)", () => {
1563
+ gsap.set(mask, { scaleX: 0 });
1564
+ });
1565
+ }
1593
1566
 
1594
1567
  let panels = gsap.utils.toArray(".panel");
1595
1568
  // we'll create a ScrollTrigger for each panel just to track when each panel's top hits the top of the viewport (we only need this for snapping)
@@ -2395,26 +2368,31 @@ window.whatsNext = function () {
2395
2368
  }
2396
2369
  };
2397
2370
 
2398
- // Case study - images mask animation
2371
+
2399
2372
  window.csMaskAnimation = function() {
2400
- const csImageMasks = document.querySelectorAll('.portfolio_item_image-mask');
2401
- csImageMasks.forEach((mask, index) => {
2402
- if (index === 0) {
2403
- return;
2404
- }
2405
- const maskAnimation = gsap.from(mask, {
2406
- width: '100%',
2407
- duration: 0.7,
2408
- ease: 'loader2',
2409
- paused: true,
2410
- });
2411
- ScrollTrigger.create({
2412
- animation: maskAnimation,
2413
- trigger: mask,
2414
- start: 'top 80%',
2415
- onEnter: () => maskAnimation.play(),
2373
+ let mm = gsap.matchMedia();
2374
+
2375
+ mm.add(isDesktop, () => {
2376
+ const csImageMasks = document.querySelectorAll('.portfolio_item_image-mask');
2377
+ csImageMasks.forEach((mask, index) => {
2378
+ if (index === 0) return;
2379
+
2380
+ gsap.from(mask, {
2381
+ width: '100%',
2382
+ duration: 0.7,
2383
+ ease: 'loader2',
2384
+ scrollTrigger: {
2385
+ trigger: mask,
2386
+ start: 'top 80%',
2387
+ toggleActions: 'play none none none'
2388
+ }
2389
+ });
2416
2390
  });
2417
2391
  });
2392
+
2393
+ mm.add("(max-width: 991px)", () => {
2394
+ gsap.set('.portfolio_item_image-mask', { width: '0%' });
2395
+ });
2418
2396
  }
2419
2397
 
2420
2398
  // Update the scroll trigger on page load
@@ -2677,7 +2655,132 @@ window.heroAnimation2026 = function(e) {
2677
2655
 
2678
2656
 
2679
2657
 
2658
+ window.CaseHeroAnimation = function(e) {
2659
+ const wideletters = document.querySelectorAll('.wideletter');
2660
+ const isCshero = document.querySelector('.is-cshero');
2661
+ const firstAfterSticky = document.querySelector('.first-after-sticky');
2662
+
2663
+ let mm = gsap.matchMedia();
2664
+
2665
+ mm.add("(min-width: 992px)", () => {
2666
+ // --- LOGIKA TYLKO DLA DESKTOP ---
2667
+
2668
+ // Page load animation timeline (starts after 200ms)
2669
+ const pageLoadTimeline = gsap.timeline({ delay: 0.2 });
2670
+
2671
+ // 1. .wideletter IN
2672
+ if (wideletters.length > 0) {
2673
+ pageLoadTimeline.fromTo(wideletters,
2674
+ { y: '-150%', opacity: 0 },
2675
+ { y: '0%', opacity: 1, duration: 1.2, ease: 'loader', stagger: 0.1 },
2676
+ 0
2677
+ );
2678
+ }
2679
+
2680
+ // 2. .navbar i przyciski
2681
+ const navbar = document.querySelector('.navbar');
2682
+ const navButtons = document.querySelectorAll('.button_small.is-navbar');
2683
+ if (navbar || navButtons.length > 0) {
2684
+ const navbarElements = navbar ? [navbar, ...Array.from(navButtons)] : Array.from(navButtons);
2685
+ pageLoadTimeline.from(navbarElements, {
2686
+ y: '-100%',
2687
+ duration: 1.2,
2688
+ ease: 'loader',
2689
+ stagger: 0.15,
2690
+ }, 0);
2691
+ }
2692
+
2693
+ // 3. .hero_headline (SplitText)
2694
+ const heroHeadline = document.querySelector('.hero_headline');
2695
+ if (heroHeadline) {
2696
+ new SplitText(heroHeadline, { type: 'lines', linesClass: 'gsap-title-line' });
2697
+ new SplitText(heroHeadline, { type: 'lines', linesClass: 'gsap-title-line-mask' });
2698
+ const heroLines = heroHeadline.querySelectorAll('.gsap-title-line');
2699
+ if (heroLines.length > 0) {
2700
+ gsap.set(heroLines, { y: '100%', opacity: 0 });
2701
+ pageLoadTimeline.to(heroLines, {
2702
+ y: '0%',
2703
+ duration: 1,
2704
+ opacity: 1,
2705
+ stagger: 0.15,
2706
+ ease: 'loader',
2707
+ }, 0.2);
2708
+ }
2709
+ }
2710
+
2711
+ // 4. .cs-tags
2712
+ const csTags = document.querySelector('.cs-tags');
2713
+ if (csTags && csTags.children.length > 0) {
2714
+ pageLoadTimeline.from(Array.from(csTags.children), {
2715
+ y: '100%',
2716
+ opacity: 0,
2717
+ duration: 1.2,
2718
+ ease: 'loader',
2719
+ stagger: 0.15,
2720
+ }, 0.4);
2721
+ }
2722
+
2723
+ // Timelines dla scrolla (OUT / IN)
2724
+ const lettersOutTimeline = gsap.timeline({ paused: true });
2725
+ if (wideletters.length > 0) {
2726
+ lettersOutTimeline.fromTo(wideletters, { y: '0%', opacity: 1 }, {
2727
+ y: '-150%', opacity: 0, duration: 0.6, ease: 'power2.in', stagger: 0.03
2728
+ });
2729
+ }
2730
+ if (isCshero) {
2731
+ lettersOutTimeline.to(isCshero, { opacity: 0, duration: 0.6, ease: 'power2.in' }, 0);
2732
+ }
2733
+
2734
+ const lettersInTimeline = gsap.timeline({ paused: true });
2735
+ if (wideletters.length > 0) {
2736
+ lettersInTimeline.fromTo(wideletters, { y: '-150%', opacity: 0 }, {
2737
+ y: '0%', opacity: 1, duration: 1, ease: 'loader2', stagger: 0.1
2738
+ });
2739
+ }
2740
+
2741
+ // ScrollTrigger
2742
+ let scrollTriggerActive = false;
2743
+ let st;
2744
+ if (firstAfterSticky) {
2745
+ st = ScrollTrigger.create({
2746
+ trigger: firstAfterSticky,
2747
+ start: 'top 80%',
2748
+ end: 'top top',
2749
+ onEnter: () => { scrollTriggerActive = true; lettersOutTimeline.play(); },
2750
+ onLeaveBack: () => { scrollTriggerActive = false; lettersOutTimeline.reverse(); }
2751
+ });
2752
+ }
2680
2753
 
2754
+ // Global scroll listener (zabezpieczony)
2755
+ let lastScrollY = window.scrollY;
2756
+ let pageLoadComplete = false;
2757
+ pageLoadTimeline.eventCallback('onComplete', () => { pageLoadComplete = true; });
2758
+
2759
+ const handleScroll = () => {
2760
+ if (!pageLoadComplete || scrollTriggerActive) return;
2761
+ const currentScrollY = window.scrollY;
2762
+ if (currentScrollY < lastScrollY && wideletters.length > 0) {
2763
+ lettersInTimeline.play();
2764
+ }
2765
+ lastScrollY = currentScrollY;
2766
+ };
2767
+
2768
+ window.addEventListener('scroll', handleScroll);
2769
+
2770
+ // CLEANUP - sprzątanie przy zmianie na Mobile
2771
+ return () => {
2772
+ window.removeEventListener('scroll', handleScroll);
2773
+ if (st) st.kill();
2774
+ gsap.set([wideletters, isCshero, '.navbar', '.button_small.is-navbar', '.gsap-title-line', '.cs-tags > *'], { clearProps: "all" });
2775
+ };
2776
+ });
2777
+
2778
+ // --- REAKCJA DLA MOBILE (< 992px) ---
2779
+ if (window.innerWidth < 992) {
2780
+ // Wymuszamy widoczność, żeby uniknąć initial state (opacity 0) na iPhone
2781
+ gsap.set([wideletters, isCshero, '.hero_headline', '.cs-tags > *'], { opacity: 1, y: '0%', visibility: 'visible' });
2782
+ }
2783
+ };
2681
2784
 
2682
2785
 
2683
2786
 
@@ -2787,16 +2890,17 @@ window.introAnimation = function(e) {
2787
2890
  }
2788
2891
  };
2789
2892
 
2790
-
2791
-
2893
+ const isDesktop = "(min-width: 992px)";
2792
2894
 
2793
2895
  function gsapTitleAnimation() {
2794
- if (!window.isPageUnlocked) return; // Jeśli strona zablokowana, nie rób nic
2896
+ if (window.innerWidth < 992) return; // BRUTALNE CIĘCIE #1
2795
2897
 
2796
2898
  const gsapTitles = document.querySelectorAll('[gsap-title]');
2797
2899
  gsapTitles.forEach((titleElement) => {
2798
- new SplitText(titleElement, { type: 'lines', linesClass: 'gsap-title-line' });
2900
+ // Inicjalizacja SplitText tylko na desktopie
2901
+ const split = new SplitText(titleElement, { type: 'lines', linesClass: 'gsap-title-line' });
2799
2902
  new SplitText(titleElement, { type: 'lines', linesClass: 'gsap-title-line-mask' });
2903
+
2800
2904
  const lines = titleElement.querySelectorAll('.gsap-title-line');
2801
2905
  if (lines.length === 0) return;
2802
2906
 
@@ -2806,15 +2910,14 @@ function gsapTitleAnimation() {
2806
2910
  scrollTrigger: {
2807
2911
  trigger: titleElement,
2808
2912
  start: 'top 90%',
2809
- toggleActions: 'play none none none',
2810
- fastScrollEnd: true
2913
+ toggleActions: 'play none none none'
2811
2914
  }
2812
2915
  });
2813
2916
  });
2814
2917
  }
2815
2918
 
2816
2919
  function gsapContainerAnimation() {
2817
- if (!window.isPageUnlocked) return;
2920
+ if (window.innerWidth < 992) return; // BRUTALNE CIĘCIE #2
2818
2921
 
2819
2922
  const gsapContainers = document.querySelectorAll('[gsap-container]');
2820
2923
  gsapContainers.forEach((container) => {
@@ -2827,15 +2930,17 @@ function gsapContainerAnimation() {
2827
2930
  scrollTrigger: {
2828
2931
  trigger: container,
2829
2932
  start: 'top 90%',
2830
- toggleActions: 'play none none none',
2831
- fastScrollEnd: true
2933
+ toggleActions: 'play none none none'
2832
2934
  }
2833
2935
  });
2834
2936
  });
2835
2937
  }
2836
2938
 
2939
+
2940
+
2941
+
2837
2942
  function gsapFadeAnimation() {
2838
- if (!window.isPageUnlocked) return;
2943
+ if (window.innerWidth < 992) return; // BRUTALNE CIĘCIE #3
2839
2944
 
2840
2945
  const gsapFadeElements = document.querySelectorAll('[gsap-fade]');
2841
2946
  gsapFadeElements.forEach((element) => {
@@ -2845,8 +2950,7 @@ function gsapFadeAnimation() {
2845
2950
  scrollTrigger: {
2846
2951
  trigger: element,
2847
2952
  start: 'top 85%',
2848
- toggleActions: 'play none none none',
2849
- fastScrollEnd: true
2953
+ toggleActions: 'play none none none'
2850
2954
  }
2851
2955
  });
2852
2956
  });
@@ -2858,7 +2962,6 @@ function gsapFadeAnimation() {
2858
2962
 
2859
2963
 
2860
2964
 
2861
-
2862
2965
  // !!!!!!!!! Keep this Alpine init at the end !!!!!!!!!
2863
2966
  window.Webflow ||= [];
2864
2967
  window.Webflow.push(() => {