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