cuwebframework 0.2.0 → 0.2.1
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 +1 @@
|
|
|
1
|
-
function o(){const
|
|
1
|
+
const y="modulepreload",w=function(s){return"/"+s},h={},k=function(a,e,c){let u=Promise.resolve();if(e&&e.length>0){let m=function(r){return Promise.all(r.map(i=>Promise.resolve(i).then(l=>({status:"fulfilled",value:l}),l=>({status:"rejected",reason:l}))))};var p=m;document.getElementsByTagName("link");const t=document.querySelector("meta[property=csp-nonce]"),n=(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"));u=m(e.map(r=>{if(r=w(r),r in h)return;h[r]=!0;const i=r.endsWith(".css"),l=i?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${r}"]${l}`))return;const o=document.createElement("link");if(o.rel=i?"stylesheet":y,i||(o.as="script"),o.crossOrigin="",o.href=r,n&&o.setAttribute("nonce",n),document.head.appendChild(o),i)return new Promise((v,E)=>{o.addEventListener("load",v),o.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${r}`)))})}))}function d(t){const n=new Event("vite:preloadError",{cancelable:!0});if(n.payload=t,window.dispatchEvent(n),!n.defaultPrevented)throw t}return u.then(t=>{for(const n of t||[])n.status==="rejected"&&d(n.reason);return a().catch(d)})};function g(){const s=["u-theme-dark","u-theme-light"],a=document.documentElement;let e=null;try{const c=localStorage.getItem("theme");c&&s.includes(c)&&(e=c)}catch(c){}e||(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"u-theme-dark":"u-theme-light"),a.classList.remove(...s),a.classList.add(e),a.setAttribute("color-scheme",e==="u-theme-dark"?"dark":"light")}g();let f=!1;window.addEventListener("ucEvent",async s=>{const e=s.detail;if(!e||e.event!=="consent_status")return;if(e["YouTube Video"]===!0&&!f){f=!0;const{ytLoader:u}=await k(async()=>{const{ytLoader:d}=await import("./ytLoader-DPWaHXzc.js");return{ytLoader:d}},[]);u()}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function D(){const l=["u-theme-dark","u-theme-light"],n=document.documentElement,t=document.getElementById("tgl-theme");if(!t){console.warn('Toggle-Button mit ID "tgl-theme" nicht gefunden.');return}t.addEventListener("click",()=>{const e=n.classList.contains("u-theme-dark")?"u-theme-light":"u-theme-dark";n.classList.remove(...l),n.classList.add(e),n.setAttribute("color-scheme",e==="u-theme-dark"?"dark":"light");try{localStorage.setItem("theme",e)}catch(o){}})}function x(){var w,g;if(!window.gsap)return;const l=window.gsap,n=document.getElementById("g_nav_menu_toggle"),t=document.querySelector('label[for="g_nav_menu_toggle"]'),r=document.querySelector(".g_nav_menu"),e=(w=t==null?void 0:t.querySelector("use"))!=null?w:null;if(!n||!t||!e)return;const o=c=>{t.setAttribute("aria-label",c?"Menü schließen":"Menü öffnen"),t.setAttribute("aria-expanded",c?"true":"false")},s=c=>{e.setAttribute("href",c?"#icon-x-lg":"#icon-menu")},i=c=>{document.body.classList.toggle("u-overflow-hidden",c)},a=c=>{r&&l.to(r,c?{display:"block",height:"calc(100vh - var(--global-nav--height))",opacity:1,duration:.3,ease:"power2.out"}:{display:"none",height:0,opacity:0,duration:.25,ease:"power2.in"})},u=()=>{const c=!!n.checked;o(c),s(c),a(c),i(c)};document.documentElement.classList.add("js-nav");const h=(g=l.matchMedia)==null?void 0:g.call(l);h&&typeof h.add=="function"?h.add("(max-width: 1040px)",()=>{l.set(r,{height:0,opacity:0,display:"none"}),u(),n.addEventListener("change",u)}):(u(),n.addEventListener("change",u))}function H(){if(!window.gsap||!window.ScrollTrigger)return;const l=window.gsap,n=document.querySelector(".g_nav");if(!n)return;let t="shown";const r=50,e=350,o=()=>{t!=="shown"&&(l.to(n,{yPercent:0,duration:.25,ease:"power2.out",overwrite:!0}),t="shown")},s=()=>{t!=="hidden"&&(l.to(n,{yPercent:-100,duration:.25,ease:"power2.out",overwrite:!0}),t="hidden")},i=()=>{n.querySelectorAll("details[open]").forEach(a=>{a.dispatchEvent(new CustomEvent("details:request-close",{bubbles:!0}))})};window.ScrollTrigger.create({start:0,end:document.body.scrollHeight,onUpdate(a){if(a.scroll()<=r){o();return}Math.abs(a.getVelocity())<e||(a.direction===1?(i(),s()):o())}}),window.ScrollTrigger.addEventListener("refresh",()=>{window.scrollY<=r&&o()}),window.scrollY<=r?o():s()}function O(){if(!window.gsap)return;const n=e=>e==null?!0:window.innerWidth>e,t=(e,o,s)=>{var a,u;const i=(u=(a=e.dataset)==null?void 0:a[o])!=null?u:void 0;return i===void 0?s:i==="true"},r=(e,o,s)=>{var u,h;const i=(h=(u=e.dataset)==null?void 0:u[o])!=null?h:void 0;if(i===void 0||i==="")return s;const a=parseInt(i,10);return Number.isNaN(a)?s:a};document.querySelectorAll("details").forEach(e=>{var T;const o=e.querySelector("summary"),s=o==null?void 0:o.nextElementSibling;if(!o||!s)return;const i=Array.from(s.children),a=t(e,"hover",!1),u=r(e,"hoverMinWidth",null),h=(T=r(e,"hoverDelay",750))!=null?T:750,w=t(e,"animate",!0);let g=!1,c=!1,d=null;const v=()=>{d!=null&&(clearTimeout(d),d=null)};let m=null;const E=t(e,"autoclose",!1),S=()=>{!E||m||(m=f=>{var q,I;if(!e.open)return;const C=(I=(q=f.composedPath)==null?void 0:q.call(f))!=null?I:[];if(C.length){if(C.includes(o)||C.includes(s))return;L();return}const b=f.target;!!(b&&(o.contains(b)||s.contains(b)))||L()},document.addEventListener("pointerdown",m,{capture:!0}))},_=()=>{m&&(document.removeEventListener("pointerdown",m,{capture:!0}),m=null)},A=w;let p=null;const y={open:()=>{e.open=!0},close:()=>{e.open=!1}};if(A){const f=window.gsap;f.set(s,{height:0,overflow:"hidden"}),i.length>0&&f.set(i,{opacity:0}),p=f.timeline({paused:!0,defaults:{duration:.35,ease:"power2.out"},onReverseComplete:()=>{e.open=!1,_()}}),p.set(e,{attr:{open:""}},0),p.to(s,{height:()=>s.scrollHeight}),p.set(s,{clearProps:"height"}),i.length>0&&p.to(i,{opacity:1,stagger:.04,duration:.38},"-=0.25"),y.open=()=>{p.invalidate().play(0),S()},y.close=()=>{p.reverse()}}function k(){y.open(),A||S()}function L(){y.close(),A||_()}e.addEventListener("details:request-close",f=>{f.stopPropagation(),e.open&&L()}),o.addEventListener("click",f=>{if(f.preventDefault(),!e.open)k();else{if(g&&c){S();return}L()}}),a&&(e.addEventListener("mouseenter",()=>{n(u)&&(e.open||(g=!0,c=!0,v(),d=window.setTimeout(()=>{c=!1},h),k()))}),e.addEventListener("mouseleave",()=>{g&&(g=!1,c=!1,v(),e.open&&L())}))})}function N(){document.querySelectorAll('[cu-list-sort="abc"]').forEach(n=>{const t=Array.from(n.children);t.sort((r,e)=>r.textContent.trim().localeCompare(e.textContent.trim(),"de",{sensitivity:"base"})),t.forEach(r=>n.appendChild(r))})}function W(){const l=String(new Date().getFullYear()),n=document.querySelectorAll('time[datetime="currentYear"]');n.length!==0&&n.forEach(t=>{t.setAttribute("datetime",l),t.textContent=l})}function Y(){const l=(n,t=100)=>{let r;return(...e)=>{clearTimeout(r),r=setTimeout(()=>n(...e),t)}};document.querySelectorAll(".horizontal_slider_container").forEach(n=>{const t=n.querySelector('[data-slider="content"]'),r=n.querySelector('[data-slider="btn-right"]'),e=n.querySelector('[data-slider="btn-left"]'),o=n.querySelector(".button_group_wrapper"),s=r==null?void 0:r.closest(".button_main_wrap"),i=e==null?void 0:e.closest(".button_main_wrap"),a=()=>t.querySelectorAll('[data-slider="item"]').length?Array.from(t.querySelectorAll('[data-slider="item"]')):Array.from(t.children),u=d=>{const v=a();d<0||d>=v.length||v[d].scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},h=()=>{const d=a(),v=t.getBoundingClientRect().left+t.clientWidth/2;let m=0,E=1/0;return d.forEach((S,_)=>{const A=S.getBoundingClientRect(),p=A.left+A.width/2,y=Math.abs(p-v);y<E&&(E=y,m=_)}),m},w=()=>u(h()+1),g=()=>u(h()-1),c=()=>{const d=t.scrollLeft,v=t.scrollWidth-t.clientWidth,m=d<=0,E=d>=v-1;if(!(t.scrollWidth>t.clientWidth)){o==null||o.style.setProperty("display","none"),i==null||i.style.setProperty("display","none"),s==null||s.style.setProperty("display","none");return}o==null||o.style.setProperty("display","flex"),i==null||i.style.setProperty("display",m?"none":"flex"),s==null||s.style.setProperty("display",E?"none":"flex")};r==null||r.addEventListener("click",w),e==null||e.addEventListener("click",g),t==null||t.addEventListener("scroll",l(c)),window.addEventListener("resize",l(c,150)),setTimeout(c,200)})}function B(){D(),x(),H(),O(),N(),W(),Y()}function P(){B()}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",P,{once:!0}):P();
|