@albi_scando/as-design-system-threejs-lib 1.1.4 → 1.1.5

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.
@@ -3962,7 +3962,7 @@ void main() {
3962
3962
  headline="Switch language?"
3963
3963
  ></confirmation-dialog>
3964
3964
  </section>
3965
- `,lI=":host{display:block;width:100%;height:100%}.root{position:relative;width:100%;height:100%;overflow:hidden}canvas{position:absolute;inset:0;display:block;touch-action:none}.menu-container{position:absolute;bottom:25%;left:50%}",gc=new CSSStyleSheet;gc.replaceSync(lI);const ca={LANGUAGES:"languages",SELECTED:"selected"};class wl extends HTMLElement{static textureLoader=new MA;shadowRoot;static get observedAttributes(){return Object.values(ca)}_renderer;_scene;_camera;_root;_canvas;_controls;_resizeObserver;_clock=new PA;_lastTime=0;_lights=[];_spotlight;_flagsGroup;_wind=null;_circleRadius=5;_cameraLookAtY=2;_targetGroupRotation=0;_currentGroupRotation=0;_unwrappedGroupRotation=0;_animationFrameId=0;_introCameraStartPosition=new O(0,5,10);_introCameraEndPosition=new O(0,5,10);_introCameraElapsed=0;_introCameraMoveDuration=2.2;_introCameraHoldDuration=.4;_isIntroCameraAnimating=!1;_isIntroCameraHolding=!1;options=Tl.options;flags=[];selected=Tl.selected;selectedTmp=Tl.selected;_menuContainer;_menuIntroStartScale=.72;_barMenu;_languageButtons=[];_confirmationDialog;_isInitialized=!1;_isInitializing=!1;_barMenuVisibleIndex=-1;_programmaticScrollTimer=null;constructor(){super(),this.shadowRoot=this.attachShadow({mode:"open"}),this.shadowRoot.adoptedStyleSheets.push(gc)}attributeChangedCallback(t,e,i){if(!(e===i||i==null))switch(t){case ca.LANGUAGES:{const n=JSON.parse(i);this._initializeComponent(new Set(n))}break;case ca.SELECTED:{const n=i;this.selectLanguage(n)}break}}connectedCallback(){this._isInitialized&&this._animationFrameId===0&&(this._animationFrameId=requestAnimationFrame(this._animate))}disconnectedCallback(){cancelAnimationFrame(this._animationFrameId),this._animationFrameId=0,this._programmaticScrollTimer!==null&&(clearTimeout(this._programmaticScrollTimer),this._programmaticScrollTimer=null),this.flags.forEach(t=>{t.flagGroup?.destroy(),this._scene.remove(t.object)}),this._lights.forEach(t=>{t.dispose()}),this._scene.clear(),this._renderer.dispose(),this._resizeObserver.disconnect()}_initializeComponent(t){if(!(this._isInitialized||this._isInitializing)){if(this.options=t,this.options.size===0){console.warn("LanguagePickerComponent: No languages provided");return}this._isInitializing=!0,this.setupHtmlElements(),this.setupScene(),this.setupUI(),this.setupFlags(),this.setupConfirmationDialog(),this._isInitialized=!0,this._isInitializing=!1,this.isConnected&&this._animationFrameId===0&&(this._animationFrameId=requestAnimationFrame(this._animate))}}setupHtmlElements(){this.shadowRoot.innerHTML=oI,this._root=this.shadowRoot.querySelector(".root")??(()=>{throw new Error(`${this.constructor.name}: root element not found`)})(),this._canvas=this.shadowRoot.querySelector(Dl.CANVAS)??(()=>{throw new Error(`${this.constructor.name}: canvas element not found`)})(),this._confirmationDialog=this.shadowRoot.querySelector(gn.selector)??(()=>{throw new Error(`${this.constructor.name}: confirmation-dialog element not found`)})()}setupScene(){this._scene=new EA,this._scene.background=new Wt(1710618),this._scene.fog=new cl(1710618,8,50),this._camera=new ke(45,1,.1,100),this._camera.position.set(0,5,10),this._camera.lookAt(0,2,0),this._scene.add(this._camera),this._renderer=new Ac({antialias:!0,canvas:this._canvas,alpha:!0}),this._renderer.debug.checkShaderErrors=!0,this._renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this._renderer.shadowMap.enabled=!1,this._controls=new ZC(this._camera,this._canvas),this._controls.enableDamping=!0,this._controls.dampingFactor=.05,this._controls.autoRotate=!1,this._controls.enableRotate=!1,this._controls.enablePan=!1,this._controls.enableZoom=!1,this._controls.target.set(0,this._cameraLookAtY,0);const t=new Gf(16777215,.3);this._scene.add(t),this._lights.push(t);const e=new RA(14674943,3);e.position.set(10,20,10),this._scene.add(e),this._lights.push(e);const i=new RA(11329439,.15);i.position.set(0,-1,0),this._scene.add(i),this._lights.push(i),this._spotlight=new zf(16777215,150),this._spotlight.angle=Math.PI/6,this._spotlight.penumbra=.3,this._spotlight.decay=2,this._spotlight.distance=30,this._scene.add(this._spotlight),this._scene.add(this._spotlight.target),this._lights.push(this._spotlight);const n=new Ci(new or(100,100),new Df({color:1710618,roughness:.8,metalness:.2}));n.rotation.x=-Math.PI/2,n.receiveShadow=!0,this._scene.add(n),this.resizeHandler(),this.shadowRoot.appendChild(this._root)}setupFlags(){this._flagsGroup=new ar,this._scene.add(this._flagsGroup),this._wind=new Ni.Wind({speed:8,direction:new O(1,0,0)});const t=this.options.size;this._circleRadius=Math.max(5,3+t*.5),this._cameraLookAtY=this._circleRadius*.4,[...this.options].forEach((n,r)=>{const a=-(r/t*Math.PI*2),o=-Math.sin(a)*this._circleRadius,h=Math.cos(a)*this._circleRadius,l=Ni.buildFlag(),A=Ni.buildFlagpole({flagpoleType:Ni.FLAG_POLE_TYPE.VERTICAL},l),c=new Ni.FlagGroup({flagpole:A,flag:l});c.object.position.set(o,0,h);const u=pa.get(n)?.isoCode,d=u!=null?Wn[u]:void 0;d!=null&&wl.textureLoader.load(d,p=>{c.setTexture(p)},void 0,()=>{console.warn(`LanguagePickerComponent: Failed to load texture for ${n}`)}),this._flagsGroup.add(c.object),this.flags.push({id:n,flagGroup:c,object:c.object,angle:a,windPhase:Math.random()*Math.PI*2,randomSeed:Math.random()})});const e=this.flags.find(n=>n.id===this.selected)??this.flags[0];if(e===void 0)return;this.selected=e.id,this.selectedTmp=this.selected,this._targetGroupRotation=e.angle,this._currentGroupRotation=e.angle,this._unwrappedGroupRotation=e.angle,this._flagsGroup.rotation.y=e.angle;const i=this._computeIntroCameraEndPosition();this._introCameraEndPosition.copy(i),this._introCameraStartPosition.set(0,i.y+this._circleRadius*3.1,i.z+this._circleRadius*4.6),this._camera.position.copy(this._introCameraStartPosition),this._controls.target.set(0,this._cameraLookAtY,0),this._controls.update(),this._introCameraElapsed=0,this._isIntroCameraHolding=!0,this._isIntroCameraAnimating=!0,this._setMenuIntroScale(0),this._spotlight.position.set(0,8,this._circleRadius),this._spotlight.target.position.set(0,0,this._circleRadius),this._spotlight.target.updateMatrixWorld()}resizeHandler=()=>{const t=()=>{const e=this._root.clientWidth,i=this._root.clientHeight;e===0||i===0||(this._camera.aspect=e/i,this._camera.updateProjectionMatrix(),this._renderer.setSize(e,i,!1))};this._resizeObserver=new ResizeObserver(t),this._resizeObserver.observe(this._root),t()};listenToBarMenuNavigation(){new MutationObserver(()=>{if(this._programmaticScrollTimer!==null)return;const e=this._barMenu.querySelectorAll(Bl.selector);for(let i=0;i<e.length;i++){const n=window.getComputedStyle(e[i]);if(n.display!=="none"&&n.visibility!=="hidden"&&parseFloat(n.opacity)>0){if(i===this._barMenuVisibleIndex)return;this._barMenuVisibleIndex=i;const a=[...this.options][i];if(a==null)return;this.selectedTmp=a,this._rotateToId(a);break}}}).observe(this._barMenu,{attributes:!0,subtree:!0,attributeFilter:["style","class"]})}setupUI(){this._menuContainer=this.shadowRoot.querySelector(".menu-container")??(()=>{throw new Error(`${this.constructor.name}: menu-container not found`)})(),this._barMenu=this.shadowRoot.querySelector(iu.selector)??(()=>{throw new Error(`${this.constructor.name}: bar menu element not found`)})()}_computeIntroCameraEndPosition(){const t=new gs().setFromObject(this._flagsGroup),e=new O,i=new O;t.getSize(e),t.getCenter(i);const n=t.min.y,r=Math.max(e.x,e.y,e.z)*.5,a=this._camera.fov*Math.PI/180,o=this._camera.aspect>0?this._camera.aspect:1,h=2*Math.atan(Math.tan(a*.5)*o),l=Math.max(r/Math.tan(a*.5),r/Math.tan(h*.5))*1.05,A=n+e.y*.25;this._cameraLookAtY=A+e.y*.06;const c=A+Math.max(e.y*.8,this._circleRadius*.28),u=i.z+l+this._circleRadius*.01;return new O(0,c,u)}selectLanguage(t){if(this._isInitialized===!1){this.selected=t,this.selectedTmp=t;return}if(this.options.has(t)===!1){console.warn(`LanguagePickerComponent: Language '${t}' not found`);return}t!==this.selected&&(this.selected=t,this.selectedTmp=t,this._rotateToId(this.selected),this._syncBarMenuToId(this.selected))}addLanguage(t){}addLocales(t){}removeLanguage(t){}removeLocales(t){}_rotateToId(t){const e=this.flags.find(r=>r.id===t);if(e===void 0)return;const i=2*Math.PI;let n=e.angle;for(;Math.abs(n-this._unwrappedGroupRotation)>Math.PI;)n+=n<this._unwrappedGroupRotation?i:-i;this._targetGroupRotation=n,this._unwrappedGroupRotation=n,this._controls.enabled=!1}_syncBarMenuToId(t){const e=[...this.options].indexOf(t);e!==-1&&(this._barMenuVisibleIndex=e,this._programmaticScrollTimer!==null&&clearTimeout(this._programmaticScrollTimer),this._programmaticScrollTimer=setTimeout(()=>{this._programmaticScrollTimer=null},500),this._barMenu.scrollToButton(e))}setupConfirmationDialog(){this._confirmationDialog.addEventListener(gn.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_CONFIRM,this._handleConfirmation),this.options.forEach(t=>{const e=document.createElement(Bl.selector);e.textContent=pa.get(t)?.autonyms??t,e.addEventListener(ma.CLICK,()=>{this.barMenuButtonClickHandler()}),this._languageButtons.push(e),this._barMenu.appendChild(e)}),this._barMenu.visibleButtons=1,this._barMenu.cyclicalNavigation=!0,requestAnimationFrame(()=>{this._syncBarMenuToId(this.selected),this.listenToBarMenuNavigation()})}barMenuButtonClickHandler=()=>{const t=pa.get(this.selectedTmp);t!==void 0&&(this._confirmationDialog.text=`Switch to ${t.language.toLowerCase()}?`,this._confirmationDialog.showModal())};_handleConfirmation=()=>{this.selectedTmp!==this.selected&&this.dispatchEvent(new CustomEvent(fc.LANGUAGE_CHANGE_CONFIRMED,{detail:{value:this.selectedTmp},bubbles:!0,composed:!0}))};_animate=()=>{this._animationFrameId=requestAnimationFrame(this._animate);try{if(!this._isInitialized||this._camera==null||this._renderer==null)return;const t=this._clock.getElapsedTime(),e=t-this._lastTime;this._lastTime=t,this._wind?.update(),this.flags.forEach((i,n)=>{if(i.flagGroup==null)return;i.windPhase+=e*(.5+i.randomSeed*1.5),Ni.applyGravityToCloth(i.flagGroup.flag.cloth,i.flagGroup.flag.object),this._wind!=null&&Ni.applyWindForceToCloth(i.flagGroup.flag.cloth,this._wind,i.flagGroup.flag.object,{randomizeAmount:.6,randomSeed:i.randomSeed});const r=new Ni.Wind({speed:.3+Math.sin(i.windPhase)*.2,direction:new O(Math.sin(i.windPhase+n)*.5,Math.cos(i.windPhase*.7),Math.sin(i.windPhase*.5+n)).normalize()});Ni.applyWindForceToCloth(i.flagGroup.flag.cloth,r,i.flagGroup.flag.object,{randomizeAmount:.5,randomSeed:i.randomSeed*2}),i.flagGroup.simulate(e),i.flagGroup.render()}),this._updateGroupRotation(),this._updateIntroCamera(e),this._controls.update(),this._renderer.render(this._scene,this._camera)}catch(t){console.error("Animation loop error:",t),cancelAnimationFrame(this._animationFrameId)}};_updateGroupRotation(){if(this._flagsGroup==null)return;const t=this._targetGroupRotation-this._currentGroupRotation;this._currentGroupRotation+=t*.1,this._flagsGroup.rotation.y=this._currentGroupRotation,Math.abs(t)<.01&&(this._controls.enabled=!0)}_updateIntroCamera(t){if(!this._isIntroCameraAnimating)return;if(this._isIntroCameraHolding){this._introCameraElapsed+=t,this._camera.position.copy(this._introCameraStartPosition),this._controls.target.set(0,this._cameraLookAtY,0),this._setMenuIntroScale(0),this._introCameraElapsed>=this._introCameraHoldDuration&&(this._isIntroCameraHolding=!1,this._introCameraElapsed=0);return}this._introCameraElapsed+=t;const e=Math.min(1,this._introCameraElapsed/this._introCameraMoveDuration),i=e*e*(3-2*e),n=1-Math.pow(1-e,4);this._camera.position.set(0,this._introCameraStartPosition.y+(this._introCameraEndPosition.y-this._introCameraStartPosition.y)*n,this._introCameraStartPosition.z+(this._introCameraEndPosition.z-this._introCameraStartPosition.z)*i),this._controls.target.set(0,this._cameraLookAtY,0),this._setMenuIntroScale(i),e>=1&&(this._isIntroCameraAnimating=!1,this._camera.position.copy(this._introCameraEndPosition),this._setMenuIntroScale(1))}_setMenuIntroScale(t){if(this._menuContainer==null)return;const e=Math.min(1,Math.max(0,t)),i=this._menuIntroStartScale+(1-this._menuIntroStartScale)*e;this._menuContainer.style.transform=`translateX(-50%) scale(${i})`}}const hI=Object.freeze(Object.defineProperty({__proto__:null,COMPONENT_CUSTOM_MESSAGES:fc,LanguagePickerComponent:wl,OBSERVED_ATTRIBUTES:ca,selector:"as-language-picker"},Symbol.toStringTag,{value:"Module"})),pc={THEME_CHANGE_CONFIRMED:ga.THEME_CHANGE_CONFIRMED},ua={RIGHT:new O(1,0,0),LEFT:new O(-1,0,0),TOP:new O(0,1,0),BOTTOM:new O(0,-1,0),FRONT:new O(0,0,1),BACK:new O(0,0,-1)},mc=`<section class="root">
3965
+ `,lI=":host{display:block;width:100%;height:100%}.root{position:relative;width:100%;height:100%;overflow:hidden}canvas{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none}.menu-container{position:absolute;bottom:clamp(1rem,12vh,25%);left:50%}@media(max-width:768px){.menu-container{bottom:max(1rem,env(safe-area-inset-bottom) + 1rem)}}",gc=new CSSStyleSheet;gc.replaceSync(lI);const ca={LANGUAGES:"languages",SELECTED:"selected"};class wl extends HTMLElement{static textureLoader=new MA;shadowRoot;static get observedAttributes(){return Object.values(ca)}_renderer;_scene;_camera;_root;_canvas;_controls;_resizeObserver;_clock=new PA;_lastTime=0;_lights=[];_spotlight;_flagsGroup;_wind=null;_circleRadius=5;_cameraLookAtY=2;_targetGroupRotation=0;_currentGroupRotation=0;_unwrappedGroupRotation=0;_animationFrameId=0;_introCameraStartPosition=new O(0,5,10);_introCameraEndPosition=new O(0,5,10);_introCameraElapsed=0;_introCameraMoveDuration=2.2;_introCameraHoldDuration=.4;_isIntroCameraAnimating=!1;_isIntroCameraHolding=!1;options=Tl.options;flags=[];selected=Tl.selected;selectedTmp=Tl.selected;_menuContainer;_menuIntroStartScale=.72;_barMenu;_languageButtons=[];_confirmationDialog;_isInitialized=!1;_isInitializing=!1;_barMenuVisibleIndex=-1;_programmaticScrollTimer=null;constructor(){super(),this.shadowRoot=this.attachShadow({mode:"open"}),this.shadowRoot.adoptedStyleSheets.push(gc)}attributeChangedCallback(t,e,i){if(!(e===i||i==null))switch(t){case ca.LANGUAGES:{const n=JSON.parse(i);this._initializeComponent(new Set(n))}break;case ca.SELECTED:{const n=i;this.selectLanguage(n)}break}}connectedCallback(){this._isInitialized&&this._animationFrameId===0&&(this._animationFrameId=requestAnimationFrame(this._animate))}disconnectedCallback(){cancelAnimationFrame(this._animationFrameId),this._animationFrameId=0,this._programmaticScrollTimer!==null&&(clearTimeout(this._programmaticScrollTimer),this._programmaticScrollTimer=null),this.flags.forEach(t=>{t.flagGroup?.destroy(),this._scene.remove(t.object)}),this._lights.forEach(t=>{t.dispose()}),this._scene.clear(),this._renderer.dispose(),this._resizeObserver.disconnect()}_initializeComponent(t){if(!(this._isInitialized||this._isInitializing)){if(this.options=t,this.options.size===0){console.warn("LanguagePickerComponent: No languages provided");return}this._isInitializing=!0,this.setupHtmlElements(),this.setupScene(),this.setupUI(),this.setupFlags(),this.setupConfirmationDialog(),this._isInitialized=!0,this._isInitializing=!1,this.isConnected&&this._animationFrameId===0&&(this._animationFrameId=requestAnimationFrame(this._animate))}}setupHtmlElements(){this.shadowRoot.innerHTML=oI,this._root=this.shadowRoot.querySelector(".root")??(()=>{throw new Error(`${this.constructor.name}: root element not found`)})(),this._canvas=this.shadowRoot.querySelector(Dl.CANVAS)??(()=>{throw new Error(`${this.constructor.name}: canvas element not found`)})(),this._confirmationDialog=this.shadowRoot.querySelector(gn.selector)??(()=>{throw new Error(`${this.constructor.name}: confirmation-dialog element not found`)})()}setupScene(){this._scene=new EA,this._scene.background=new Wt(1710618),this._scene.fog=new cl(1710618,8,50),this._camera=new ke(45,1,.1,100),this._camera.position.set(0,5,10),this._camera.lookAt(0,2,0),this._scene.add(this._camera),this._renderer=new Ac({antialias:!0,canvas:this._canvas,alpha:!0}),this._renderer.debug.checkShaderErrors=!0,this._renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this._renderer.shadowMap.enabled=!1,this._controls=new ZC(this._camera,this._canvas),this._controls.enableDamping=!0,this._controls.dampingFactor=.05,this._controls.autoRotate=!1,this._controls.enableRotate=!1,this._controls.enablePan=!1,this._controls.enableZoom=!1,this._controls.target.set(0,this._cameraLookAtY,0);const t=new Gf(16777215,.3);this._scene.add(t),this._lights.push(t);const e=new RA(14674943,3);e.position.set(10,20,10),this._scene.add(e),this._lights.push(e);const i=new RA(11329439,.15);i.position.set(0,-1,0),this._scene.add(i),this._lights.push(i),this._spotlight=new zf(16777215,150),this._spotlight.angle=Math.PI/6,this._spotlight.penumbra=.3,this._spotlight.decay=2,this._spotlight.distance=30,this._scene.add(this._spotlight),this._scene.add(this._spotlight.target),this._lights.push(this._spotlight);const n=new Ci(new or(100,100),new Df({color:1710618,roughness:.8,metalness:.2}));n.rotation.x=-Math.PI/2,n.receiveShadow=!0,this._scene.add(n),this.resizeHandler(),this.shadowRoot.appendChild(this._root)}setupFlags(){this._flagsGroup=new ar,this._scene.add(this._flagsGroup),this._wind=new Ni.Wind({speed:8,direction:new O(1,0,0)});const t=this.options.size;this._circleRadius=Math.max(5,3+t*.5),this._cameraLookAtY=this._circleRadius*.4,[...this.options].forEach((n,r)=>{const a=-(r/t*Math.PI*2),o=-Math.sin(a)*this._circleRadius,h=Math.cos(a)*this._circleRadius,l=Ni.buildFlag(),A=Ni.buildFlagpole({flagpoleType:Ni.FLAG_POLE_TYPE.VERTICAL},l),c=new Ni.FlagGroup({flagpole:A,flag:l});c.object.position.set(o,0,h);const u=pa.get(n)?.isoCode,d=u!=null?Wn[u]:void 0;d!=null&&wl.textureLoader.load(d,p=>{c.setTexture(p)},void 0,()=>{console.warn(`LanguagePickerComponent: Failed to load texture for ${n}`)}),this._flagsGroup.add(c.object),this.flags.push({id:n,flagGroup:c,object:c.object,angle:a,windPhase:Math.random()*Math.PI*2,randomSeed:Math.random()})});const e=this.flags.find(n=>n.id===this.selected)??this.flags[0];if(e===void 0)return;this.selected=e.id,this.selectedTmp=this.selected,this._targetGroupRotation=e.angle,this._currentGroupRotation=e.angle,this._unwrappedGroupRotation=e.angle,this._flagsGroup.rotation.y=e.angle;const i=this._computeIntroCameraEndPosition();this._introCameraEndPosition.copy(i),this._introCameraStartPosition.set(0,i.y+this._circleRadius*3.1,i.z+this._circleRadius*4.6),this._camera.position.copy(this._introCameraStartPosition),this._controls.target.set(0,this._cameraLookAtY,0),this._controls.update(),this._introCameraElapsed=0,this._isIntroCameraHolding=!0,this._isIntroCameraAnimating=!0,this._setMenuIntroScale(0),this._spotlight.position.set(0,8,this._circleRadius),this._spotlight.target.position.set(0,0,this._circleRadius),this._spotlight.target.updateMatrixWorld()}resizeHandler=()=>{const t=()=>{const e=this._root.clientWidth,i=this._root.clientHeight;e===0||i===0||(this._camera.aspect=e/i,this._camera.updateProjectionMatrix(),this._renderer.setSize(e,i,!1))};this._resizeObserver=new ResizeObserver(t),this._resizeObserver.observe(this._root),t()};listenToBarMenuNavigation(){new MutationObserver(()=>{if(this._programmaticScrollTimer!==null)return;const e=this._barMenu.querySelectorAll(Bl.selector);for(let i=0;i<e.length;i++){const n=window.getComputedStyle(e[i]);if(n.display!=="none"&&n.visibility!=="hidden"&&parseFloat(n.opacity)>0){if(i===this._barMenuVisibleIndex)return;this._barMenuVisibleIndex=i;const a=[...this.options][i];if(a==null)return;this.selectedTmp=a,this._rotateToId(a);break}}}).observe(this._barMenu,{attributes:!0,subtree:!0,attributeFilter:["style","class"]})}setupUI(){this._menuContainer=this.shadowRoot.querySelector(".menu-container")??(()=>{throw new Error(`${this.constructor.name}: menu-container not found`)})(),this._barMenu=this.shadowRoot.querySelector(iu.selector)??(()=>{throw new Error(`${this.constructor.name}: bar menu element not found`)})()}_computeIntroCameraEndPosition(){const t=new gs().setFromObject(this._flagsGroup),e=new O,i=new O;t.getSize(e),t.getCenter(i);const n=t.min.y,r=Math.max(e.x,e.y,e.z)*.5,a=this._camera.fov*Math.PI/180,o=this._camera.aspect>0?this._camera.aspect:1,h=2*Math.atan(Math.tan(a*.5)*o),l=Math.max(r/Math.tan(a*.5),r/Math.tan(h*.5))*1.05,A=n+e.y*.25;this._cameraLookAtY=A+e.y*.06;const c=A+Math.max(e.y*.8,this._circleRadius*.28),u=i.z+l+this._circleRadius*.01;return new O(0,c,u)}selectLanguage(t){if(this._isInitialized===!1){this.selected=t,this.selectedTmp=t;return}if(this.options.has(t)===!1){console.warn(`LanguagePickerComponent: Language '${t}' not found`);return}t!==this.selected&&(this.selected=t,this.selectedTmp=t,this._rotateToId(this.selected),this._syncBarMenuToId(this.selected))}addLanguage(t){}addLocales(t){}removeLanguage(t){}removeLocales(t){}_rotateToId(t){const e=this.flags.find(r=>r.id===t);if(e===void 0)return;const i=2*Math.PI;let n=e.angle;for(;Math.abs(n-this._unwrappedGroupRotation)>Math.PI;)n+=n<this._unwrappedGroupRotation?i:-i;this._targetGroupRotation=n,this._unwrappedGroupRotation=n,this._controls.enabled=!1}_syncBarMenuToId(t){const e=[...this.options].indexOf(t);e!==-1&&(this._barMenuVisibleIndex=e,this._programmaticScrollTimer!==null&&clearTimeout(this._programmaticScrollTimer),this._programmaticScrollTimer=setTimeout(()=>{this._programmaticScrollTimer=null},500),this._barMenu.scrollToButton(e))}setupConfirmationDialog(){this._confirmationDialog.addEventListener(gn.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_CONFIRM,this._handleConfirmation),this.options.forEach(t=>{const e=document.createElement(Bl.selector);e.textContent=pa.get(t)?.autonyms??t,e.addEventListener(ma.CLICK,()=>{this.barMenuButtonClickHandler()}),this._languageButtons.push(e),this._barMenu.appendChild(e)}),this._barMenu.visibleButtons=1,this._barMenu.cyclicalNavigation=!0,requestAnimationFrame(()=>{this._syncBarMenuToId(this.selected),this.listenToBarMenuNavigation()})}barMenuButtonClickHandler=()=>{const t=pa.get(this.selectedTmp);t!==void 0&&(this._confirmationDialog.text=`Switch to ${t.language.toLowerCase()}?`,this._confirmationDialog.showModal())};_handleConfirmation=()=>{this.selectedTmp!==this.selected&&this.dispatchEvent(new CustomEvent(fc.LANGUAGE_CHANGE_CONFIRMED,{detail:{value:this.selectedTmp},bubbles:!0,composed:!0}))};_animate=()=>{this._animationFrameId=requestAnimationFrame(this._animate);try{if(!this._isInitialized||this._camera==null||this._renderer==null)return;const t=this._clock.getElapsedTime(),e=t-this._lastTime;this._lastTime=t,this._wind?.update(),this.flags.forEach((i,n)=>{if(i.flagGroup==null)return;i.windPhase+=e*(.5+i.randomSeed*1.5),Ni.applyGravityToCloth(i.flagGroup.flag.cloth,i.flagGroup.flag.object),this._wind!=null&&Ni.applyWindForceToCloth(i.flagGroup.flag.cloth,this._wind,i.flagGroup.flag.object,{randomizeAmount:.6,randomSeed:i.randomSeed});const r=new Ni.Wind({speed:.3+Math.sin(i.windPhase)*.2,direction:new O(Math.sin(i.windPhase+n)*.5,Math.cos(i.windPhase*.7),Math.sin(i.windPhase*.5+n)).normalize()});Ni.applyWindForceToCloth(i.flagGroup.flag.cloth,r,i.flagGroup.flag.object,{randomizeAmount:.5,randomSeed:i.randomSeed*2}),i.flagGroup.simulate(e),i.flagGroup.render()}),this._updateGroupRotation(),this._updateIntroCamera(e),this._controls.update(),this._renderer.render(this._scene,this._camera)}catch(t){console.error("Animation loop error:",t),cancelAnimationFrame(this._animationFrameId)}};_updateGroupRotation(){if(this._flagsGroup==null)return;const t=this._targetGroupRotation-this._currentGroupRotation;this._currentGroupRotation+=t*.1,this._flagsGroup.rotation.y=this._currentGroupRotation,Math.abs(t)<.01&&(this._controls.enabled=!0)}_updateIntroCamera(t){if(!this._isIntroCameraAnimating)return;if(this._isIntroCameraHolding){this._introCameraElapsed+=t,this._camera.position.copy(this._introCameraStartPosition),this._controls.target.set(0,this._cameraLookAtY,0),this._setMenuIntroScale(0),this._introCameraElapsed>=this._introCameraHoldDuration&&(this._isIntroCameraHolding=!1,this._introCameraElapsed=0);return}this._introCameraElapsed+=t;const e=Math.min(1,this._introCameraElapsed/this._introCameraMoveDuration),i=e*e*(3-2*e),n=1-Math.pow(1-e,4);this._camera.position.set(0,this._introCameraStartPosition.y+(this._introCameraEndPosition.y-this._introCameraStartPosition.y)*n,this._introCameraStartPosition.z+(this._introCameraEndPosition.z-this._introCameraStartPosition.z)*i),this._controls.target.set(0,this._cameraLookAtY,0),this._setMenuIntroScale(i),e>=1&&(this._isIntroCameraAnimating=!1,this._camera.position.copy(this._introCameraEndPosition),this._setMenuIntroScale(1))}_setMenuIntroScale(t){if(this._menuContainer==null)return;const e=Math.min(1,Math.max(0,t)),i=this._menuIntroStartScale+(1-this._menuIntroStartScale)*e;this._menuContainer.style.transform=`translateX(-50%) scale(${i})`}}const hI=Object.freeze(Object.defineProperty({__proto__:null,COMPONENT_CUSTOM_MESSAGES:fc,LanguagePickerComponent:wl,OBSERVED_ATTRIBUTES:ca,selector:"as-language-picker"},Symbol.toStringTag,{value:"Module"})),pc={THEME_CHANGE_CONFIRMED:ga.THEME_CHANGE_CONFIRMED},ua={RIGHT:new O(1,0,0),LEFT:new O(-1,0,0),TOP:new O(0,1,0),BOTTOM:new O(0,-1,0),FRONT:new O(0,0,1),BACK:new O(0,0,-1)},mc=`<section class="root">
3966
3966
  <canvas></canvas>
3967
3967
  <header-body-footer-dialog class="dialog-details">
3968
3968
  <section slot="header" class="header">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@albi_scando/as-design-system-threejs-lib",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "A library of reusable, strongly typed threejs Web Components built with TypeScript, designed for creating consistent and maintainable user interfaces.",
5
5
  "type": "module",
6
6
  "files": [
@@ -58,8 +58,8 @@
58
58
  "@semantic-release/git": "^10.0.1",
59
59
  "@semantic-release/github": "^12.0.3",
60
60
  "@semantic-release/npm": "^13.1.3",
61
- "@storybook/addon-docs": "10.3.1",
62
- "@storybook/html-vite": "10.3.1",
61
+ "@storybook/addon-docs": "10.3.3",
62
+ "@storybook/html-vite": "10.3.3",
63
63
  "@types/node": "^25.2.1",
64
64
  "@types/numeric": "^1.2.6",
65
65
  "@vitest/coverage-v8": "^4.0.18",
@@ -72,7 +72,7 @@
72
72
  "eslint-plugin-prettier": "^5.5.5",
73
73
  "eslint-plugin-regexp": "^3.0.0",
74
74
  "eslint-plugin-security": "^3.0.1",
75
- "eslint-plugin-storybook": "10.3.1",
75
+ "eslint-plugin-storybook": "10.3.3",
76
76
  "globals": "^17.3.0",
77
77
  "http-server": "^14.1.1",
78
78
  "husky": "^9.1.7",
@@ -80,7 +80,7 @@
80
80
  "prettier": "3.8.1",
81
81
  "sass": "^1.97.3",
82
82
  "semantic-release": "^25.0.3",
83
- "storybook": "10.3.1",
83
+ "storybook": "10.3.3",
84
84
  "typedoc": "^0.28.16",
85
85
  "typescript": "^5.9.3",
86
86
  "typescript-eslint": "^8.54.0",