cuwebframework 0.1.2 → 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 c=["u-theme-dark","u-theme-light"],r=document.documentElement;let e=null;try{const t=localStorage.getItem("theme");t&&c.includes(t)&&(e=t)}catch(t){}e||(e=window.matchMedia("(prefers-color-scheme: dark)").matches?"u-theme-dark":"u-theme-light"),r.classList.remove(...c),r.classList.add(e),r.setAttribute("color-scheme",e==="u-theme-dark"?"dark":"light")}o();
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
- function P(){const o=["u-theme-dark","u-theme-light"],n=document.documentElement,e=document.getElementById("tgl-theme");if(!e){console.warn('Toggle-Button mit ID "tgl-theme" nicht gefunden.');return}e.addEventListener("click",()=>{const t=n.classList.contains("u-theme-dark")?"u-theme-light":"u-theme-dark";n.classList.remove(...o),n.classList.add(t),n.setAttribute("color-scheme",t==="u-theme-dark"?"dark":"light");try{localStorage.setItem("theme",t)}catch(s){}})}function D(){var v,p;if(!window.gsap)return;const o=window.gsap,n=document.getElementById("g_nav_menu_toggle"),e=document.querySelector('label[for="g_nav_menu_toggle"]'),r=document.querySelector(".g_nav_menu"),t=(v=e==null?void 0:e.querySelector("use"))!=null?v:null;if(!n||!e||!t)return;const s=c=>{e.setAttribute("aria-label",c?"Menü schließen":"Menü öffnen"),e.setAttribute("aria-expanded",c?"true":"false")},i=c=>{t.setAttribute("href",c?"#icon-x-lg":"#icon-menu")},l=c=>{document.body.classList.toggle("u-overflow-hidden",c)},a=c=>{r&&o.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;s(c),i(c),a(c),l(c)};document.documentElement.classList.add("js-nav");const m=(p=o.matchMedia)==null?void 0:p.call(o);m&&typeof m.add=="function"?m.add("(max-width: 1040px)",()=>{o.set(r,{height:0,opacity:0,display:"none"}),u(),n.addEventListener("change",u)}):(u(),n.addEventListener("change",u))}function x(){if(!window.gsap||!window.ScrollTrigger)return;const o=window.gsap,n=document.querySelector(".g_nav");if(!n)return;let e="shown";const r=50,t=350,s=()=>{e!=="shown"&&(o.to(n,{yPercent:0,duration:.25,ease:"power2.out",overwrite:!0}),e="shown")},i=()=>{e!=="hidden"&&(o.to(n,{yPercent:-100,duration:.25,ease:"power2.out",overwrite:!0}),e="hidden")},l=()=>{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){s();return}Math.abs(a.getVelocity())<t||(a.direction===1?(l(),i()):s())}}),window.ScrollTrigger.addEventListener("refresh",()=>{window.scrollY<=r&&s()}),window.scrollY<=r?s():i()}function H(){if(!window.gsap)return;const n=t=>t==null?!0:window.innerWidth>t,e=(t,s,i)=>{var a,u;const l=(u=(a=t.dataset)==null?void 0:a[s])!=null?u:void 0;return l===void 0?i:l==="true"},r=(t,s,i)=>{var u,m;const l=(m=(u=t.dataset)==null?void 0:u[s])!=null?m:void 0;if(l===void 0||l==="")return i;const a=parseInt(l,10);return Number.isNaN(a)?i:a};document.querySelectorAll("details").forEach(t=>{var k;const s=t.querySelector("summary"),i=s==null?void 0:s.nextElementSibling;if(!s||!i)return;const l=Array.from(i.children),a=e(t,"hover",!1),u=r(t,"hoverMinWidth",null),m=(k=r(t,"hoverDelay",750))!=null?k:750,v=e(t,"animate",!0);let p=!1,c=!1,d=null;const y=()=>{d!=null&&(clearTimeout(d),d=null)};let f=null;const E=e(t,"autoclose",!1),b=()=>{!E||f||(f=h=>{var I,q;if(!t.open)return;const L=(q=(I=h.composedPath)==null?void 0:I.call(h))!=null?q:[];if(L.length){if(L.includes(s)||L.includes(i))return;A();return}const _=h.target;!!(_&&(s.contains(_)||i.contains(_)))||A()},document.addEventListener("pointerdown",f,{capture:!0}))},T=()=>{f&&(document.removeEventListener("pointerdown",f,{capture:!0}),f=null)},S=v;let w=null;const g={open:()=>{t.open=!0},close:()=>{t.open=!1}};if(S){const h=window.gsap;h.set(i,{height:0,overflow:"hidden"}),h.set(l,{opacity:0}),w=h.timeline({paused:!0,defaults:{duration:.35,ease:"power2.out"},onReverseComplete:()=>{t.open=!1,T()}}),w.set(t,{attr:{open:""}},0),w.to(i,{height:()=>i.scrollHeight}),w.set(i,{clearProps:"height"}),w.to(l,{opacity:1,stagger:.04,duration:.38},"-=0.25"),g.open=()=>{w.invalidate().play(0),b()},g.close=()=>{w.reverse()}}function C(){g.open(),S||b()}function A(){g.close(),S||T()}t.addEventListener("details:request-close",h=>{h.stopPropagation(),t.open&&A()}),s.addEventListener("click",h=>{if(h.preventDefault(),!t.open)C();else{if(p&&c){b();return}A()}}),a&&(t.addEventListener("mouseenter",()=>{n(u)&&(t.open||(p=!0,c=!0,y(),d=window.setTimeout(()=>{c=!1},m),C()))}),t.addEventListener("mouseleave",()=>{p&&(p=!1,c=!1,y(),t.open&&A())}))})}function Y(){document.querySelectorAll('[cu-list-sort="abc"]').forEach(n=>{const e=Array.from(n.children);e.sort((r,t)=>r.textContent.trim().localeCompare(t.textContent.trim(),"de",{sensitivity:"base"})),e.forEach(r=>n.appendChild(r))})}function N(){const o=String(new Date().getFullYear()),n=document.querySelectorAll('time[datetime="currentYear"]');n.length!==0&&n.forEach(e=>{e.setAttribute("datetime",o),e.textContent=o})}function O(){const o=document.querySelectorAll("[data-yt-id]");o.length&&o.forEach(async n=>{const e=n.dataset.ytId,r=n.querySelector("img");if(!e||!r)return;const t=await V(e);n.ariaLabel=`Video Abspielen: ${t}`,W(r,e,n.ariaLabel),n.dataset.listenerAdded||(n.addEventListener("click",()=>{const s=n.parentElement;s&&s.replaceChildren(F(e,t))}),n.dataset.listenerAdded="true")})}function W(o,n,e){return o.src=`https://img.youtube.com/vi_webp/${n}/sddefault.webp`,o.alt=e,o.title=e,o.onerror=()=>{o.onerror=null,o.src=`https://img.youtube.com/vi/${n}/sddefault.jpg`},o}function F(o,n){const e=document.createElement("iframe");return e.width="100%",e.height="100%",e.src=`https://www.youtube-nocookie.com/embed/${o}?autoplay=1&rel=0`,e.title=n,e.setAttribute("frameborder","0"),e.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",e.allowFullscreen=!0,e.loading="lazy",e}async function V(o){const n=`https://www.youtube.com/oembed?url=https://youtu.be/${encodeURIComponent(o)}&format=json`;try{const e=await fetch(n);if(!e.ok)throw new Error(`HTTP-Error: ${e.status}`);return(await e.json()).title}catch(e){return console.error("Fehler beim Abrufen des Titels:",e),"Titel konnte nicht geladen werden"}}function $(){const o=(n,e=100)=>{let r;return(...t)=>{clearTimeout(r),r=setTimeout(()=>n(...t),e)}};document.querySelectorAll(".horizontal_slider_container").forEach(n=>{const e=n.querySelector('[data-slider="content"]'),r=n.querySelector('[data-slider="btn-right"]'),t=n.querySelector('[data-slider="btn-left"]'),s=n.querySelector(".button_group_wrapper"),i=r==null?void 0:r.closest(".button_main_wrap"),l=t==null?void 0:t.closest(".button_main_wrap"),a=()=>e.querySelectorAll('[data-slider="item"]').length?Array.from(e.querySelectorAll('[data-slider="item"]')):Array.from(e.children),u=d=>{const y=a();d<0||d>=y.length||y[d].scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},m=()=>{const d=a(),y=e.getBoundingClientRect().left+e.clientWidth/2;let f=0,E=1/0;return d.forEach((b,T)=>{const S=b.getBoundingClientRect(),w=S.left+S.width/2,g=Math.abs(w-y);g<E&&(E=g,f=T)}),f},v=()=>u(m()+1),p=()=>u(m()-1),c=()=>{const d=e.scrollLeft,y=e.scrollWidth-e.clientWidth,f=d<=0,E=d>=y-1;if(!(e.scrollWidth>e.clientWidth)){s==null||s.style.setProperty("display","none"),l==null||l.style.setProperty("display","none"),i==null||i.style.setProperty("display","none");return}s==null||s.style.setProperty("display","flex"),l==null||l.style.setProperty("display",f?"none":"flex"),i==null||i.style.setProperty("display",E?"none":"flex")};r==null||r.addEventListener("click",v),t==null||t.addEventListener("click",p),e==null||e.addEventListener("scroll",o(c)),window.addEventListener("resize",o(c,150)),setTimeout(c,200)})}P();D();x();H();Y();N();O();$();
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();
@@ -0,0 +1 @@
1
+ function s(){const r=document.querySelectorAll("[data-yt-id]");r.length&&r.forEach(async t=>{const e=t.dataset.ytId,o=t.querySelector("img");if(!e||!o)return;const a=await i(e);t.ariaLabel=`Video Abspielen: ${a}`,c(o,e,t.ariaLabel),t.dataset.listenerAdded||(t.addEventListener("click",()=>{const n=t.parentElement;n&&n.replaceChildren(l(e,a))}),t.dataset.listenerAdded="true")})}function c(r,t,e){return r.src=`https://img.youtube.com/vi_webp/${t}/sddefault.webp`,r.alt=e,r.title=e,r.onerror=()=>{r.onerror=null,r.src=`https://img.youtube.com/vi/${t}/sddefault.jpg`},r}function l(r,t){const e=document.createElement("iframe");return e.width="100%",e.height="100%",e.src=`https://www.youtube-nocookie.com/embed/${r}?autoplay=1&rel=0`,e.title=t,e.setAttribute("frameborder","0"),e.allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",e.allowFullscreen=!0,e.loading="lazy",e}async function i(r){const t=`https://www.youtube.com/oembed?url=https://youtu.be/${encodeURIComponent(r)}&format=json`;try{const e=await fetch(t);if(!e.ok)throw new Error(`HTTP-Error: ${e.status}`);return(await e.json()).title}catch(e){return console.error("Fehler beim Abrufen des Titels:",e),"Titel konnte nicht geladen werden"}}export{s as ytLoader};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cuwebframework",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "description": "Lightweight web framework by Copteruni",
5
5
  "type": "module",
6
6
  "main": "dist/scripts/main.built.js",