@hortonstudio/main 1.2.15 → 1.2.19

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.
@@ -1 +0,0 @@
1
- var w="hsmain",r=()=>window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,a={global:{animationDelay:0},wordSplit:{duration:1.5,stagger:.075,yPercent:110,ease:"power4.out",start:"top 97%"},lineSplit:{duration:1.5,stagger:.1,yPercent:110,ease:"power4.out",start:"top 97%"},charSplit:{duration:1.2,stagger:.03,yPercent:110,ease:"power4.out",start:"top 97%"},appear:{y:50,duration:1.5,ease:"power3.out",start:"top 97%"}};function S(e){function t(i,l){for(let n in l)l[n]&&typeof l[n]=="object"&&!Array.isArray(l[n])?(i[n]=i[n]||{},t(i[n],l[n])):i[n]=l[n];return i}t(a,e)}function c(){o.forEach(({timeline:e,element:t})=>{e&&e.kill(),t?.splitTextInstance&&t.splitTextInstance.revert()}),o.length=0}function p(){if(r()){u();return}f().then(()=>{g()})}var o=[];function s(){return document.fonts.ready}function u(){[...document.querySelectorAll(".a-char-split > *:first-child"),...document.querySelectorAll(".a-word-split > *:first-child"),...document.querySelectorAll(".a-line-split > *:first-child"),...document.querySelectorAll(".a-appear")].forEach(t=>{gsap.set(t,{autoAlpha:1,y:0,yPercent:0,opacity:1})})}var d={async initial(){if(await s(),r())return;document.querySelectorAll(".a-char-split > *:first-child").forEach(t=>{let i=SplitText.create(t,{type:"chars",mask:"chars",charsClass:"char"});t.splitTextInstance=i,gsap.set(i.chars,{yPercent:a.charSplit.yPercent}),gsap.set(t,{autoAlpha:1})})},async animate(){await s(),!r()&&document.querySelectorAll(".a-char-split > *:first-child").forEach(e=>{let t=e.querySelectorAll(".char"),i=gsap.timeline({scrollTrigger:{trigger:e,start:a.charSplit.start,invalidateOnRefresh:!0},onComplete:()=>{}});i.to(t,{yPercent:0,duration:a.charSplit.duration,stagger:a.charSplit.stagger,ease:a.charSplit.ease}),o.push({timeline:i,element:e})})}},y={async initial(){if(await s(),r())return;document.querySelectorAll(".a-word-split > *:first-child").forEach(t=>{let i=SplitText.create(t,{type:"words",mask:"words",wordsClass:"word"});t.splitTextInstance=i,gsap.set(i.words,{yPercent:a.wordSplit.yPercent}),gsap.set(t,{autoAlpha:1})})},async animate(){await s(),!r()&&document.querySelectorAll(".a-word-split > *:first-child").forEach(e=>{let t=e.querySelectorAll(".word"),i=gsap.timeline({scrollTrigger:{trigger:e,start:a.wordSplit.start,invalidateOnRefresh:!0},onComplete:()=>{}});i.to(t,{yPercent:0,duration:a.wordSplit.duration,stagger:a.wordSplit.stagger,ease:a.wordSplit.ease}),o.push({timeline:i,element:e})})}},h={async initial(){if(await s(),r())return;document.querySelectorAll(".a-line-split > *:first-child").forEach(t=>{let i=SplitText.create(t,{type:"lines",mask:"lines",linesClass:"line"});t.splitTextInstance=i,gsap.set(i.lines,{yPercent:a.lineSplit.yPercent}),gsap.set(t,{autoAlpha:1})})},async animate(){await s(),!r()&&document.querySelectorAll(".a-line-split > *:first-child").forEach(e=>{let t=e.querySelectorAll(".line"),i=gsap.timeline({scrollTrigger:{trigger:e,start:a.lineSplit.start,invalidateOnRefresh:!0},onComplete:()=>{}});i.to(t,{yPercent:0,duration:a.lineSplit.duration,stagger:a.lineSplit.stagger,ease:a.lineSplit.ease}),o.push({timeline:i,element:e})})}},m={async initial(){if(await s(),r())return;document.querySelectorAll(".a-appear").forEach(t=>{gsap.set(t,{y:a.appear.y,opacity:0})})},async animate(){await s(),!r()&&document.querySelectorAll(".a-appear").forEach(e=>{let t=gsap.timeline({scrollTrigger:{trigger:e,start:a.appear.start,invalidateOnRefresh:!0}});t.to(e,{y:0,opacity:1,duration:a.appear.duration,ease:a.appear.ease}),o.push({timeline:t,element:e})})}};async function f(){await Promise.all([d.initial(),y.initial(),h.initial(),m.initial()])}async function g(){a.global.animationDelay>0&&await new Promise(e=>setTimeout(e,a.global.animationDelay*1e3)),await Promise.all([d.animate(),y.animate(),h.animate(),m.animate()])}async function A(){r()?u():(await f(),g()),window.addEventListener("resize",ScrollTrigger.refresh());let e=window[w]||{};return e.textAnimations={config:a,updateConfig:S,start:p,kill:c,restart:()=>{c(),p()}},{result:"anim-text initialized"}}export{A as init};
@@ -1 +0,0 @@
1
- async function p(){let s=document.querySelector('[data-hs-toc="content"]'),o=document.querySelector('[data-hs-toc="list"]');if(!s||!o||o.children.length===0)return;let u=o.children[0];o.innerHTML="";let d=s.querySelectorAll("h2");return d.forEach((n,a)=>{let c=n.textContent.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""),e=document.createElement("div");e.id=c,n.parentNode.insertBefore(e,n),e.appendChild(n);let t=e.nextElementSibling;for(;t&&t.tagName!=="H2";){let r=t;t=t.nextElementSibling,e.appendChild(r)}}),d.forEach((n,a)=>{let c=u.cloneNode(!0),e=c.querySelector("a"),t=n.parentElement.id;e.href="#"+t;let r=document.createElement("strong");r.textContent=a+1+". ",e.innerHTML="",e.appendChild(r),e.appendChild(document.createTextNode(n.textContent)),e.addEventListener("click",m=>{m.preventDefault();let l=document.getElementById(t);l&&(l.scrollIntoView({behavior:"smooth"}),setTimeout(()=>{l.focus()},100))});let i=document.getElementById(t);i&&(i.setAttribute("tabindex","-1"),i.style.outline="none",i.style.setProperty("outline","none","important")),o.appendChild(c)}),{result:"util-toc initialized"}}export{p as init};
@@ -1 +0,0 @@
1
- var a="hsmain";async function l(){return window[a].afterReady(()=>{typeof $<"u"&&r()}),{result:"anim-transition initialized"}}function r(){let i=$(".transition-trigger"),n=800,o=400,e="no-transition";i.length>0&&(window.Webflow&&window.Webflow.push?Webflow.push(function(){i.click()}):setTimeout(()=>{i.click()},100),$("body").addClass("no-scroll-transition"),setTimeout(()=>{$("body").removeClass("no-scroll-transition")},n)),$("a").on("click",function(t){if($(this).prop("hostname")==window.location.host&&$(this).attr("href").indexOf("#")===-1&&!$(this).hasClass(e)&&$(this).attr("target")!=="_blank"&&i.length>0){t.preventDefault(),$("body").addClass("no-scroll-transition");let s=$(this).attr("href");i.click(),setTimeout(function(){window.location=s},o)}}),window.onpageshow=function(t){t.persisted&&window.location.reload()},setTimeout(()=>{$(window).on("resize",function(){setTimeout(()=>{$(".transition").css("display","none")},50)})},n)}export{l as init};