Files
michaelschiemer/public/assets/js/modules-CRN5oHhr.js
Michael Schiemer 55a330b223 Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug
- Add DISCOVERY_SHOW_PROGRESS=true
- Temporary changes for debugging InitializerProcessor fixes on production
2025-08-11 20:13:26 +02:00

2 lines
16 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{L as e,r as t,u as o,a as n,D as i,b as s,m as l,d as r,s as a}from"./core-DN7oYUfN.js";let c="example-module",d=null,u=null;const g=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){e.info("[example-module] destroy"),d&&(window.removeEventListener("resize",d),d=null),o(c),u&&"function"==typeof u.cleanup&&u.cleanup(),u=null},init:function(o={},n=null){e.info("[example-module] init"),u=n,u&&(u.register("windowSize",{width:window.innerWidth,height:window.innerHeight}),u.register("scrollPosition",{x:0,y:0}),u.register("isVisible",!0)),d=()=>{const t={width:window.innerWidth,height:window.innerHeight};e.info("Fenstergröße geändert:",t),u&&u.set("windowSize",t)},window.addEventListener("resize",d),t(c,()=>{const e=window.scrollY,t=window.scrollX;if(u){const o=u.get("scrollPosition");o.x===t&&o.y===e||u.set("scrollPosition",{x:t,y:e})}},{autoStart:!0})}},Symbol.toStringTag,{value:"Module"}));let m,f="inertia-scroll",p=0,h=window.scrollY,y=!1,b=.9,w=.2;function v(){y=!0,clearTimeout(m),m=setTimeout(()=>{y=!1},50)}const S=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){window.removeEventListener("scroll",v),o(f),p=0,h=window.scrollY,y=!1,clearTimeout(m);const e=document.documentElement;delete e.dataset.scrollState,delete e.dataset.scrollDirection,delete e.dataset.scrollSpeed},init:function(e={}){b="number"==typeof e.damping?e.damping:.9,w="number"==typeof e.minVelocity?contig.minVelocity:.1,window.addEventListener("scroll",v,{passive:!0}),t(f,()=>{const e=document.documentElement,t=window.scrollY,o=t-h,n=o>0?"down":o<0?"up":"none",i=Math.abs(o);!y&&Math.abs(p)>w?(window.scrollTo(0,t+p),p*=b,e.dataset.scrollState="inertia"):y?(p=o,h=t,e.dataset.scrollState="active"):delete e.dataset.scrollState,e.dataset.scrollDirection=n,e.dataset.scrollSpeed=i.toFixed(2)},{autoStart:!0})}},Symbol.toStringTag,{value:"Module"}));class _{constructor({content:e="",className:t="",onClose:o=null}={}){this.onClose=o,this.dialog=document.createElement("dialog"),this.dialog.className=t,this.dialog.innerHTML=`\n <form method="dialog" class="${t}-content">\n ${e}\n <button class="${t}-close" value="close">×</button>\n </form>\n `,n(this.dialog,"click",e=>{!e.target.closest(t+"-content")&&this.close()}),n(this.dialog,"cancel",e=>{e.preventDefault(),this.close()})}open(){var e,t;document.body.appendChild(this.dialog),(null==(t=(e=this.dialog).showModal)?void 0:t.call(e))||this.dialog.setAttribute("open",""),document.documentElement.dataset[`${this.dialog.className}Open`]="true"}close(){var e,t,o;(null==(t=(e=this.dialog).close)?void 0:t.call(e))||this.dialog.removeAttribute("open"),this.dialog.remove(),delete document.documentElement.dataset[`${this.dialog.className}Open`],null==(o=this.onClose)||o.call(this)}}const x={modal:class extends _{constructor(e){super({...e,className:"modal"})}}},j={open(t,o={}){const n=x[t];if(!n)return e.warn(`[UIManager] Unknown type: ${t}`),null;const i=new n(o);return i.open(),i},close(e){(null==e?void 0:e.close)&&e.close()}};function E(e){const t=e.target.closest("[data-lightbox]");t&&"IMG"===t.tagName&&(e.preventDefault(),j.open("lightbox",{content:`<img src="${t.src}" alt="${t.alt||""}" />`}))}const L=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){e.info("[lightbox-trigger] destroy")},init:function(){e.info("[lightbox-trigger] init"),n(document,"click",E)}},Symbol.toStringTag,{value:"Module"}));const M=Object.freeze(Object.defineProperty({__proto__:null,init:function(t={}){e.log("Noise Toggle Init",t);const{selector:o=".noise-overlay",toggleKey:n="g",className:i="grainy",enableTransition:s=!0}=t,l=document.body,r=document.querySelector(o);if(!r)return;function a(){s?r.classList.toggle("hidden",!l.classList.contains(i)):r.style.display=l.classList.contains(i)?"block":"none"}a(),document.addEventListener("keydown",e=>{var t;e.key.toLowerCase()!==n||e.ctrlKey||e.metaKey||e.altKey||(t=e.target,["input","textarea"].includes(t.tagName.toLowerCase()))||(l.classList.toggle(i),a())})}},Symbol.toStringTag,{value:"Module"}));const k=Object.freeze(Object.defineProperty({__proto__:null,init:function(o={}){e.info("Parallax init");const n={selector:"[data-parallax]",speedAttr:"data-parallax-speed",defaultSpeed:.5,...o},i=document.querySelectorAll(n.selector);t("parallax",function(){const e=window.scrollY;i.forEach(t=>{const o=parseFloat(t.getAttribute(n.speedAttr))||n.defaultSpeed,i=e*o;t.style.transform=`translateY(${i}px)`})},{autoStart:!0})}},Symbol.toStringTag,{value:"Module"})),O=i.createDefinition("scroll-dependent","1.0.0").depends("example-module","1.0.0").depends("scrollfx","1.0.0",!0).provides("scroll-coordination").priority(10);let $=null,A=null;const T=Object.freeze(Object.defineProperty({__proto__:null,definition:O,destroy:function(){e.info("[scroll-dependent] destroy"),$&&A&&(A.unsubscribe($),$=null),A&&"function"==typeof A.cleanup&&A.cleanup(),A=null},init:function(t={},o=null){e.info("[scroll-dependent] init"),A=o,A&&(A.register("isScrolling",!1),A.register("scrollDirection","none"),$=A.subscribe("example-module.scrollPosition",(t,o)=>{if(o.y!==t.y){const n=t.y>o.y?"down":"up";A.set("scrollDirection",n),A.set("isScrolling",!0),setTimeout(()=>{A&&A.set("isScrolling",!1)},150),e.info(`[scroll-dependent] Scroll ${n}: ${t.y}`)}}))}},Symbol.toStringTag,{value:"Module"}));const z=Object.freeze(Object.defineProperty({__proto__:null,init:function(e={}){const o=document.querySelectorAll("[data-scroll-loop]");o.forEach(e=>{if("translate"===(e.dataset.scrollType||"translate")&&1===e.children.length){const t=e.firstElementChild.cloneNode(!0);t.setAttribute("aria-hidden","true"),e.appendChild(t)}}),t("scroll-loop",()=>{const t=window.scrollY,n=window.scrollX;o.forEach(o=>{const i=parseFloat(o.dataset.scrollSpeed||e.speed||.2),s=o.dataset.scrollAxis||"y",l=o.dataset.scrollType||"translate",r="true"===o.dataset.loopPause,a=parseFloat(o.dataset.loopOffset||0),c=parseFloat(o.dataset.loopLimit||0),d="x"===s?n:t;if(c&&d>c)return;if(r&&(o.matches(":hover")||o.matches(":active")))return;const u=(d+a)*i;switch(l){case"translate":{const e=-u%("x"===s?o.offsetWidth:o.offsetHeight),t="x"===s?`translateX(${e}px)`:`translateY(${e}px)`;o.style.transform=t;break}case"rotate":{const e=u%360;o.style.transform=`rotate(${e}deg)`;break}case"background":{const e=u%100;o.style.backgroundPosition="x"===s?`${e}% center`:`center ${e}%`;break}case"scale":{const e=1+.1*Math.sin(.01*u);o.style.transform=`scale(${e.toFixed(3)})`;break}}})},{autoStart:!0})}},Symbol.toStringTag,{value:"Module"})),P={onEnter(t,o){o.classList.add("active"),document.body.dataset.activeScrollStep=t,e.info(`[ScrollStep] Enter: ${t}`),1===t&&e.info("Intro sichtbar"),2===t&&e.info("Chart aktiviert"),3===t&&e.info("Zitat eingeblendet")},onLeave(t,o){o.classList.remove("active"),o.style.transitionDelay="",e.info(`[ScrollStep] Leave: ${t}`),document.body.dataset.activeScrollStep===String(t)&&delete document.body.dataset.activeScrollStep,1===t&&e.info("Intro ausgeblendet"),2===t&&e.info("Chart deaktiviert"),3===t&&e.info("Zitat ausgeblendet")}};const q=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){o("scroll-timeline")},init:function(o={}){e.info("ScrollTimeline init");const n={attribute:"data-scroll-step",triggerPoint:.4,once:!0,...o},i=Array.from(document.querySelectorAll(`[${n.attribute}]`)).map(e=>({el:e,index:parseInt(e.getAttribute(n.attribute),10),active:!1}));t("scroll-timeline",function(){const t=window.innerHeight*n.triggerPoint;i.forEach(o=>{var i,s;const l=o.el.getBoundingClientRect(),r=l.top<t&&l.bottom>0;r&&!o.active&&(o.active=!0,o.el.classList.add("active"),e.log(`➡️ ENTER step ${o.index}`),null==(i=P.onEnter)||i.call(P,o.index,o.el)),!r&&o.active&&(o.active=!1,o.el.classList.remove("active"),e.log(`⬅️ LEAVE step ${o.index}`),n.once||null==(s=P.onLeave)||s.call(P,o.index,o.el))})},{autoStart:!0})}},Symbol.toStringTag,{value:"Module"}));const C=new class{constructor(){this.triggers=new Set,this.viewportHeight=window.innerHeight,this._loop=this._loop.bind(this),window.addEventListener("resize",()=>{this.viewportHeight=window.innerHeight}),requestAnimationFrame(this._loop)}register(e){this.triggers.add(e)}unregister(e){this.triggers.delete(e)}clear(){this.triggers.clear()}_loop(){this.triggers.forEach(e=>{e.update(this.viewportHeight)}),requestAnimationFrame(this._loop)}};class D{constructor(e){if(this.element=this.resolveElement(e.element),this.target=e.target?this.element.querySelector(e.target):this.element,e.target&&!this.target)throw new Error(`Target selector '${e.target}' not found inside element '${e.element}'.`);this.start=e.start||"top 80%",this.end=e.end||"bottom 20%",this.scrub=e.scrub||!1,this.onEnter=e.onEnter||null,this.onLeave=e.onLeave||null,this.onUpdate=e.onUpdate||null,this._wasVisible=!1,this._progress=0}resolveElement(e){if("string"==typeof e){const t=document.querySelectorAll(e);if(1===t.length)return t[0];throw new Error(`Selector '${e}' matched ${t.length} elements, expected exactly 1.`)}return e}getScrollProgress(e){const t=this.element.getBoundingClientRect(),o=this.parsePosition(this.start,e),n=this.parsePosition(this.end,e)-o,i=t.top-o;return 1-Math.min(Math.max(i/n,0),1)}parsePosition(e,t){const[o,n]=e.split(" ");return("top"===o?0:t)-t*(parseFloat(n)/100)}update(e){const t=this.element.getBoundingClientRect(),o=t.bottom>0&&t.top<e;if(o&&!this._wasVisible&&(this._wasVisible=!0,this.onEnter&&this.onEnter(this.target)),!o&&this._wasVisible&&(this._wasVisible=!1,this.onLeave&&this.onLeave(this.target)),this.scrub&&o){const t=this.getScrollProgress(e);this.onUpdate&&this.onUpdate(this.target,t)}}}const H=Object.freeze(Object.defineProperty({__proto__:null,createTrigger:function(e){const t="string"==typeof e.element?document.querySelectorAll(e.element):[e.element],o=[];return t.forEach(t=>{const n=new D({...e,element:t});C.register(n),o.push(n)}),1===o.length?o[0]:o},init:function(e={}){const{selector:t=".fade-in-on-scroll, .zoom-in, .fade-out, .fade",offset:o=.85,baseDelay:n=.05,once:i=!0}=e,s=Array.from(document.querySelectorAll(t)).map(e=>({el:e,triggered:!1}));requestAnimationFrame(function e(){const t=window.innerHeight*o;s.forEach((e,o)=>{if(e.triggered&&i)return;e.el.getBoundingClientRect().top<t?(e.el.style.transitionDelay=o*n+"s",e.el.classList.add("visible","entered"),e.el.classList.remove("fade-out"),e.triggered=!0):i||(e.el.classList.remove("visible","entered"),e.triggered=!1)}),requestAnimationFrame(e)})}},Symbol.toStringTag,{value:"Module"}));let N=null,F=null;const I=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){s("sidebar")},init:function(){document.getElementById("sidebar-menu");const e=document.getElementById("menu-toggle"),t=document.getElementById("sidebar"),o=document.querySelector(".backdrop"),i=document.querySelector("footer"),s=document.querySelector("header a");n(e,"click",e=>{t.classList.toggle("show"),t.classList.contains("show")?(o.classList.add("visible"),i.setAttribute("inert","true"),s.setAttribute("inert","true")):(o.classList.remove("visible"),i.removeAttribute("inert"),s.removeAttribute("inert"))}),N=e=>{"Escape"===e.key&&t.classList.contains("show")&&(t.classList.remove("show"),o.classList.remove("visible"))},n(document,"keydown",N),F=e=>{t.classList.remove("show"),o.classList.remove("visible"),i.removeAttribute("inert"),s.removeAttribute("inert")},n(o,"click",F)}},Symbol.toStringTag,{value:"Module"})),Y=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));let B="sticky-fade",V=[],K=window.scrollY,R=new WeakMap,U={direction:!1,reset:!1};const W=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){o(B),V.forEach(e=>{e.style.opacity="",e.style.transform="",e.classList.remove("visible"),delete e.dataset.scrollDir}),V=[],R=new WeakMap},init:function(e={}){V=Array.from(document.querySelectorAll("[data-sticky-fade]")),0!==V.length&&(U.direction=e.direction??!1,U.reset=e.reset??!1,t(B,()=>{const e=window.scrollY,t=e>K?"down":e<K?"up":"none";K=e;const o=window.innerHeight;V.forEach(e=>{const n=e.getBoundingClientRect(),i=1-Math.min(Math.max(n.top/o,0),1);if(e.style.opacity=i.toFixed(3),e.style.transform=`translateY(${20*(1-i)}px)`,U.direction&&(e.dataset.scrollDir=t),U.reset){const t=i>=1,o=R.get(e)||!1;t&&!o?(e.classList.add("visible"),R.set(e,!0)):!t&&o&&(e.classList.remove("visible"),R.set(e,!1))}})},{autoStart:!0}))}},Symbol.toStringTag,{value:"Module"}));const X=Object.freeze(Object.defineProperty({__proto__:null,destroy:function(){o("sticky-steps")},init:function(o={}){e.info("StickySteps init");const n={containerSelector:"[data-sticky-container]",stepSelector:"[data-sticky-step]",activeClass:"is-sticky-active",datasetKey:"activeStickyStep",...o};document.querySelectorAll(n.containerSelector).forEach(e=>{const o=e.querySelectorAll(n.stepSelector),i=e.offsetTop;t(`sticky-steps-${e.dataset.moduleId||Math.random()}`,function(){const t=window.scrollY,s=e.offsetHeight;o.forEach((l,r)=>{const a=i+r*(s/o.length),c=i+(r+1)*(s/o.length),d=t>=a&&t<c;l.classList.toggle(n.activeClass,d),d&&(e.dataset[n.datasetKey]=r)})},{autoStart:!0})})}},Symbol.toStringTag,{value:"Module"}));const Z=Object.freeze(Object.defineProperty({__proto__:null,init:function(){}},Symbol.toStringTag,{value:"Module"})),G=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"})),J={noise:{selector:".noise-overlay",toggleKey:"g",className:"grainy",enableTransition:!0},"shortcut-handler.js":{debug:!1},scrollfx:{selector:".fade-in-on-scroll, .zoom-in",offset:.8,baseDelay:.075,once:!0},"scroll-timeline":{attribute:"data-scroll-step",triggerPoint:.4,once:!1},"smooth-scroll":{speed:.2}},Q=new Map;async function ee(){var t;let o;o="undefined"!=typeof global&&(null==(t=global.importMeta)?void 0:t.glob)?global.importMeta.glob("./*/index.js",{eager:!0}):Object.assign({"./example-module/index.js":g,"./inertia-scroll/index.js":S,"./lightbox-trigger/index.js":L,"./noise/index.js":M,"./parallax/index.js":k,"./scroll-dependent/index.js":T,"./scroll-loop/index.js":z,"./scroll-timeline/index.js":q,"./scrollfx/index.js":H,"./sidebar/index.js":I,"./smooth-scroll/index.js":Y,"./sticky-fade/index.js":W,"./sticky-steps/index.js":X,"./ui/index.js":Z,"./wheel-boost/index.js":G});const n=new Set(Array.from(document.querySelectorAll("[data-module]")).map(e=>e.dataset.module).filter(Boolean)),i=new Set(n),s=0===i.size;Object.entries(o).forEach(([t,o])=>{const n=t.split("/").slice(-2,-1)[0];if(s||i.has(n))if("object"==typeof o.definition)r.register(o.definition);else{const e={name:n,version:"1.0.0",dependencies:[],provides:[],priority:0};r.register(e)}else e.info(`⏭️ [Module] Skipping unused module: ${n}`)});const c=r.calculateInitializationOrder();for(const u of c){if(!s&&!i.has(u)){e.info(`⏭️ [Module] Skipped (not used in DOM): ${u}`);continue}const t=Object.keys(o).find(e=>e.split("/").slice(-2,-1)[0]===u);if(!t){e.warn(`⛔ [Module] No implementation found for: ${u}`);continue}const n=o[t],c=J[u]||{},g=r.checkDependencies(u);if(g.satisfied)if("function"==typeof n.init)try{r.markInitializing(u);const t=a.createScope(u),o=l.wrapModule(n,u);await o.init(c,t),r.markInitialized(u),Q.set(u,{mod:o,config:c,state:t,original:n}),e.info(`✅ [Module] Initialized: ${u}`)}catch(d){e.error(`❌ [Module] Failed to initialize ${u}:`,d),Q.set(u,{mod:null,config:c,error:d,original:n})}else e.warn(`⛔ [Module] No init() in ${u}`);else e.error(`❌ [Module] Cannot initialize ${u}: ${g.reason}`),Q.set(u,{mod:null,config:c,error:new Error(g.reason),original:n})}s&&e.info("⚠️ [Module] No data-module usage detected, fallback to full init mode")}"undefined"!=typeof window&&(window.moduleHealth=function(){const e={total:Q.size,active:0,failed:0,modules:{},errorBoundary:l.getHealthStatus()};for(const[t,{mod:o,error:n}]of Q.entries())n?(e.failed++,e.modules[t]={status:"failed",error:n.message}):o?(e.active++,e.modules[t]={status:"active"}):e.modules[t]={status:"unknown"};return e});export{ee as r};