@albi_scando/as-design-system-threejs-lib 1.1.9 → 1.1.11

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.
@@ -800,7 +800,7 @@ tu.replaceSync($c);
800
800
  const eu = `<dialog part="dialog">
801
801
  <slot></slot>
802
802
  </dialog>
803
- `, iu = "*{box-sizing:border-box}dialog{background-color:var(--color-bg-primary);color:var(--color-text-primary);border:var(--border-width-1) solid var(--color-border-secondary);border-radius:var(--border-radius-xl);padding:var(--spacing-4);max-width:90vw;max-height:90vh;font-family:var(--font-family-base);line-height:var(--line-height-normal);font-size:var(--font-size-sm);box-shadow:var(--shadow-2xl);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);animation:slideIn var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog.closing{animation:slideOut var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog::backdrop{background:var(--window-backdrop);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);animation:fadeIn var(--transition-base) ease-out forwards}dialog.closing::backdrop{animation:fadeOut var(--transition-base) ease-out forwards}@keyframes slideIn{0%{opacity:0;transform:scale(.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes slideOut{0%{opacity:1;transform:scale(1) translateY(0)}to{opacity:0;transform:scale(.95) translateY(-20px)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}", xh = new CSSStyleSheet();
803
+ `, iu = "*{box-sizing:border-box}dialog{background-color:var(--color-bg-primary);color:var(--color-text-primary);border:var(--border-width-1) solid var(--color-border-secondary);border-radius:var(--border-radius-xl);padding:var(--spacing-4);font-family:var(--font-family-base);line-height:var(--line-height-normal);font-size:var(--font-size-sm);box-shadow:var(--shadow-2xl);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);animation:slideIn var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog.closing{animation:slideOut var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog::backdrop{background:var(--window-backdrop);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);animation:fadeIn var(--transition-base) ease-out forwards}dialog.closing::backdrop{animation:fadeOut var(--transition-base) ease-out forwards}@keyframes slideIn{0%{opacity:0;transform:scale(.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes slideOut{0%{opacity:1;transform:scale(1) translateY(0)}to{opacity:0;transform:scale(.95) translateY(-20px)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}", xh = new CSSStyleSheet();
804
804
  xh.replaceSync(iu);
805
805
  class wn extends HTMLElement {
806
806
  /**
@@ -954,7 +954,7 @@ const nu = `<dialog part="dialog">
954
954
  <slot name="footer"></slot>
955
955
  </footer>
956
956
  </dialog>
957
- `, au = '*{box-sizing:border-box}dialog[open]{display:flex;flex-direction:column;gap:var(--spacing-4)}dialog>[part]{position:relative}dialog>[part][hidden]{display:none}dialog>[part][data-divider=true]:after{content:"";position:absolute;left:0;right:0;bottom:0;border-bottom:var(--border-width-1) solid var(--color-neutral-600)}dialog>[part][data-divider=true]{padding-bottom:var(--spacing-4)}dialog div[part=body]{flex:1;min-height:0}', Eh = new CSSStyleSheet();
957
+ `, au = '*{box-sizing:border-box}dialog[open]{max-width:100%;max-height:100%;display:flex;flex-direction:column;gap:var(--spacing-4)}dialog>[part]{position:relative}dialog>[part][hidden]{display:none}dialog>[part][data-divider=true]:after{content:"";position:absolute;left:0;right:0;bottom:0;border-bottom:var(--border-width-1) solid var(--color-neutral-600)}dialog>[part][data-divider=true]{padding-bottom:var(--spacing-4)}dialog div[part=body]{flex:1;min-height:0;overflow-y:auto}', Eh = new CSSStyleSheet();
958
958
  Eh.replaceSync(au);
959
959
  class VA extends wn {
960
960
  _sectionNames = ["header", "body", "footer"];
@@ -30387,13 +30387,10 @@ class _A extends HTMLElement {
30387
30387
  */
30388
30388
  resizeHandler = () => {
30389
30389
  const t = () => {
30390
- const e = this._canvas.parentElement;
30391
- if (e === null)
30392
- return;
30393
- const i = e.clientWidth, n = e.clientHeight;
30394
- i === 0 || n === 0 || (this._camera.aspect = i / n, this._camera.updateProjectionMatrix(), this._renderer.setSize(i, n, !1));
30390
+ const e = this._root.clientWidth, i = this._root.clientHeight;
30391
+ e === 0 || i === 0 || (this._camera.aspect = e / i, this._camera.updateProjectionMatrix(), this._renderer.setSize(e, i, !1));
30395
30392
  };
30396
- this._resizeObserver = new ResizeObserver(t), this._resizeObserver.observe(this._canvas.parentElement), t();
30393
+ this._resizeObserver = new ResizeObserver(t), this._resizeObserver.observe(this._root), t();
30397
30394
  };
30398
30395
  // ─────────────────────────────────────────────────────────────────────────
30399
30396
  // BarMenu navigation listener — replaces per-frame DOM polling
@@ -20,7 +20,7 @@
20
20
  `,Hc="*{box-sizing:border-box}:where(button,input[type=button],input[type=submit],input[type=reset]),:where(input[type=file])::file-selector-button{cursor:pointer;-webkit-user-select:none;user-select:none;font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);font-family:var(--font-family-base);letter-spacing:var(--letter-spacing-normal);line-height:var(--line-height-normal);padding-block:var(--button-padding-block-md);padding-inline:var(--button-padding-inline-md);display:inline-flex;justify-content:center;align-items:center;text-align:center;gap:var(--gap-sm);background:var(--color-bg-secondary);color:var(--color-text-primary);border:var(--border-width-1) solid var(--color-border-primary);border-radius:var(--border-radius-lg);transition:all var(--transition-base)}:where(button,input[type=button],input[type=submit],input[type=reset])>.material-symbols-outlined{font-size:var(--font-size-xl);font-family:Material Symbols Outlined;line-height:1}:where(button,input[type=button],input[type=submit],input[type=reset])[disabled]{opacity:.3;cursor:not-allowed}:where(button,input[type=button],input[type=submit],input[type=reset]):where(:not(:disabled):hover),:where(button,input[type=button],input[type=submit],input[type=reset]):where(:not(:disabled):active){background:var(--color-hover-bg-secondary);border-color:var(--color-hover-border-secondary)}:where(input[type=file]){inline-size:100%;max-inline-size:max-content;background-color:var(--color-bg-secondary)}",UA=new CSSStyleSheet;UA.replaceSync(Hc);class Ht extends HTMLElement{static autofocusAttribute="autofocus";static commandAttribute="command";static commandforAttribute="commandfor";static disabledAttribute="disabled";static nameAttribute="name";static titleAttribute="title";static typeAttribute="type";static valueAttribute="value";constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot?.adoptedStyleSheets.push(UA)}static get observedAttributes(){return[Ht.autofocusAttribute,Ht.commandAttribute,Ht.commandforAttribute,Ht.disabledAttribute,Ht.nameAttribute,Ht.titleAttribute,Ht.typeAttribute,Ht.valueAttribute]}get buttonElement(){return this.shadowRoot?.querySelector("button")}get autofocus(){return this.hasAttribute(Ht.autofocusAttribute)}set autofocus(t){t?this.setAttribute(Ht.autofocusAttribute,Ae):this.removeAttribute(Ht.autofocusAttribute)}get command(){return this.getAttribute(Ht.commandAttribute)??Ae}set command(t){this.setAttribute(Ht.commandAttribute,t)}get commandfor(){return this.getAttribute(Ht.commandforAttribute)??Ae}set commandfor(t){t!==Ae?this.setAttribute(Ht.commandforAttribute,t):this.removeAttribute(Ht.commandforAttribute)}get disabled(){return this.hasAttribute(Ht.disabledAttribute)}set disabled(t){t?this.setAttribute(Ht.disabledAttribute,Ae):this.removeAttribute(Ht.disabledAttribute)}get name(){return this.getAttribute(Ht.nameAttribute)??Ae}set name(t){t!==Ae?this.setAttribute(Ht.nameAttribute,t):this.removeAttribute(Ht.nameAttribute)}get headline(){return this.getAttribute(Ht.titleAttribute)??Ae}set headline(t){t!==Ae?this.setAttribute(Ht.titleAttribute,t):this.removeAttribute(Ht.titleAttribute)}get type(){return this.getAttribute(Ht.typeAttribute)??"button"}set type(t){t!==Ae?this.setAttribute(Ht.typeAttribute,t):this.removeAttribute(Ht.typeAttribute)}get value(){return this.getAttribute(Ht.valueAttribute)??"button"}set value(t){t!==Ae?this.setAttribute(Ht.valueAttribute,t):this.removeAttribute(Ht.valueAttribute)}connectedCallback(){this._render(),this._addEventListeners()}disconnectedCallback(){this._removeEventListeners()}attributeChangedCallback(t,e,i){i!==e&&this._syncAttribute(t)}_render(){this.shadowRoot!==null&&(this.shadowRoot.innerHTML=kc,this._syncAttributes())}_addEventListeners(){this.buttonElement.addEventListener(Wi.CLICK,this._handleClick)}_removeEventListeners(){this.buttonElement.addEventListener(Wi.CLICK,this._handleClick)}_handleClick=()=>{if(this.command===Ae||this.commandfor===Ae)return;let t=document.getElementById(this.commandfor);if(t??=this._findElementInShadowDOM(this.commandfor),t===null)return;const e=t;switch(this.command){case BA.SHOW_MODAL:e.showModal?.();break;case BA.CLOSE:e.close?.();break}};_findElementInShadowDOM(t){const e=`#${CSS.escape(t)}`;let i=this.querySelector(e);if(i!==null||(i=this._searchInShadowRootsOfChildren(this,e),i!==null))return i;let n=this.parentElement;for(;n!==null;){if(i=n.querySelector(e),i!==null||(i=this._searchInShadowRootsOfChildren(n,e),i!==null))return i;const s=n.parentElement;if(s!==null)n=s;else{const a=n.getRootNode();if(a instanceof ShadowRoot&&a.host!==null)n=a.host;else break}}return null}_searchInShadowRootsOfChildren(t,e){const i=t.children;for(const n of i){if(n.shadowRoot!==null){const a=n.shadowRoot.querySelector(e);if(a!==null)return a;const o=this._searchInShadowRootsOfChildren(n.shadowRoot,e);if(o!==null)return o}const s=this._searchInShadowRootsOfChildren(n,e);if(s!==null)return s}return null}_syncAttribute(t){const e=this.buttonElement;e!==null&&(this.hasAttribute(t)?e.setAttribute(t,this.getAttribute(t)??Ae):e.removeAttribute(t))}_syncAttributes(){Ht.observedAttributes.forEach(t=>{this._syncAttribute(t)})}}const zA=Object.freeze(Object.defineProperty({__proto__:null,BaseButtonComponent:Ht,selector:Gc},Symbol.toStringTag,{value:"Module"}));new CSSStyleSheet().replaceSync("*{box-sizing:border-box}button[part=button]{background:var(--color-warning);font-weight:var(--font-weight-medium);padding-block:var(--button-padding-block-md);padding-inline:var(--button-padding-inline-md);border-radius:var(--border-radius-lg);border:none;box-shadow:var(--shadow-md);transition:all var(--transition-base);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--gap-sm)}button[part=button]:hover{filter:brightness(1.2)}");const GA="undo-button";new CSSStyleSheet().replaceSync("*{box-sizing:border-box}button[part=button]{background:var(--color-success);font-weight:var(--font-weight-medium);padding-block:var(--button-padding-block-md);padding-inline:var(--button-padding-inline-md);border-radius:var(--border-radius-lg);border:none;box-shadow:var(--shadow-md);transition:all var(--transition-base);cursor:pointer;display:flex;align-items:center;justify-content:center;gap:var(--gap-sm)}button[part=button]:hover{filter:brightness(1.2)}");const kA="confirm-button";new CSSStyleSheet().replaceSync("*{box-sizing:border-box}button[part=button]{border:none;background:transparent}button[part=button]:not(:disabled):hover{transform:scale(1.2)}"),new CSSStyleSheet().replaceSync("*{box-sizing:border-box}button[part=button]{border:none;background:transparent}button[part=button]:not(:disabled):hover{transform:scale(1.2)}");const Vc=`<dialog part="dialog">
21
21
  <slot></slot>
22
22
  </dialog>
23
- `,Wc="*{box-sizing:border-box}dialog{background-color:var(--color-bg-primary);color:var(--color-text-primary);border:var(--border-width-1) solid var(--color-border-secondary);border-radius:var(--border-radius-xl);padding:var(--spacing-4);max-width:90vw;max-height:90vh;font-family:var(--font-family-base);line-height:var(--line-height-normal);font-size:var(--font-size-sm);box-shadow:var(--shadow-2xl);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);animation:slideIn var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog.closing{animation:slideOut var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog::backdrop{background:var(--window-backdrop);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);animation:fadeIn var(--transition-base) ease-out forwards}dialog.closing::backdrop{animation:fadeOut var(--transition-base) ease-out forwards}@keyframes slideIn{0%{opacity:0;transform:scale(.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes slideOut{0%{opacity:1;transform:scale(1) translateY(0)}to{opacity:0;transform:scale(.95) translateY(-20px)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}",HA=new CSSStyleSheet;HA.replaceSync(Wc);class cn extends HTMLElement{static closedByAttribute="closedby";_closedBy=xa.ANY;constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot?.adoptedStyleSheets.push(HA)}static get observedAttributes(){return[cn.closedByAttribute]}get dialogElement(){return this.shadowRoot?.querySelector("dialog")}get command(){return this.getAttribute(cn.closedByAttribute)??xa.ANY}get closedBy(){return this._closedBy}set closedBy(t){this._closedBy=t,this.setAttribute(cn.closedByAttribute,t)}connectedCallback(){this._render(),this._addEventListeners()}disconnectedCallback(){this._removeEventListeners()}attributeChangedCallback(t,e,i){this.dialogElement!=null&&i!==e&&this._syncAttribute(t)}_addEventListeners(){}_removeEventListeners(){}_render(){this.shadowRoot!==null&&(this.shadowRoot.innerHTML=Vc,this._syncAttributes())}_syncAttribute(t){const e=this.dialogElement;e!=null&&(this.hasAttribute(t)===!0?e.setAttribute(t,this.getAttribute(t)??Ae):e.removeAttribute(t))}_syncAttributes(){cn.observedAttributes.forEach(t=>{this._syncAttribute(t)})}show(){this.dialogElement.show()}showModal(){this.dialogElement.showModal()}close(t){const e=this.dialogElement;e.classList.add("closing"),setTimeout(()=>{e.close(t),e.classList.remove("closing")},300)}}const Yc=`<dialog part="dialog">
23
+ `,Wc="*{box-sizing:border-box}dialog{background-color:var(--color-bg-primary);color:var(--color-text-primary);border:var(--border-width-1) solid var(--color-border-secondary);border-radius:var(--border-radius-xl);padding:var(--spacing-4);font-family:var(--font-family-base);line-height:var(--line-height-normal);font-size:var(--font-size-sm);box-shadow:var(--shadow-2xl);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);animation:slideIn var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog.closing{animation:slideOut var(--transition-base) cubic-bezier(.34,1.56,.64,1) forwards}dialog::backdrop{background:var(--window-backdrop);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);animation:fadeIn var(--transition-base) ease-out forwards}dialog.closing::backdrop{animation:fadeOut var(--transition-base) ease-out forwards}@keyframes slideIn{0%{opacity:0;transform:scale(.95) translateY(-20px)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes slideOut{0%{opacity:1;transform:scale(1) translateY(0)}to{opacity:0;transform:scale(.95) translateY(-20px)}}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@keyframes fadeOut{0%{opacity:1}to{opacity:0}}",HA=new CSSStyleSheet;HA.replaceSync(Wc);class cn extends HTMLElement{static closedByAttribute="closedby";_closedBy=xa.ANY;constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot?.adoptedStyleSheets.push(HA)}static get observedAttributes(){return[cn.closedByAttribute]}get dialogElement(){return this.shadowRoot?.querySelector("dialog")}get command(){return this.getAttribute(cn.closedByAttribute)??xa.ANY}get closedBy(){return this._closedBy}set closedBy(t){this._closedBy=t,this.setAttribute(cn.closedByAttribute,t)}connectedCallback(){this._render(),this._addEventListeners()}disconnectedCallback(){this._removeEventListeners()}attributeChangedCallback(t,e,i){this.dialogElement!=null&&i!==e&&this._syncAttribute(t)}_addEventListeners(){}_removeEventListeners(){}_render(){this.shadowRoot!==null&&(this.shadowRoot.innerHTML=Vc,this._syncAttributes())}_syncAttribute(t){const e=this.dialogElement;e!=null&&(this.hasAttribute(t)===!0?e.setAttribute(t,this.getAttribute(t)??Ae):e.removeAttribute(t))}_syncAttributes(){cn.observedAttributes.forEach(t=>{this._syncAttribute(t)})}show(){this.dialogElement.show()}showModal(){this.dialogElement.showModal()}close(t){const e=this.dialogElement;e.classList.add("closing"),setTimeout(()=>{e.close(t),e.classList.remove("closing")},300)}}const Yc=`<dialog part="dialog">
24
24
  <header part="header">
25
25
  <h2></h2>
26
26
  </header>
@@ -43,7 +43,7 @@
43
43
  <slot name="footer"></slot>
44
44
  </footer>
45
45
  </dialog>
46
- `,Jc='*{box-sizing:border-box}dialog[open]{display:flex;flex-direction:column;gap:var(--spacing-4)}dialog>[part]{position:relative}dialog>[part][hidden]{display:none}dialog>[part][data-divider=true]:after{content:"";position:absolute;left:0;right:0;bottom:0;border-bottom:var(--border-width-1) solid var(--color-neutral-600)}dialog>[part][data-divider=true]{padding-bottom:var(--spacing-4)}dialog div[part=body]{flex:1;min-height:0}',VA=new CSSStyleSheet;VA.replaceSync(Jc);class WA extends cn{_sectionNames=["header","body","footer"];_handleSlotChange=()=>{this._updateSectionState()};constructor(){super(),this.shadowRoot?.adoptedStyleSheets.push(VA)}static get observedAttributes(){return cn.observedAttributes}_render(){this.shadowRoot!==null&&(this.shadowRoot.innerHTML=Zc,this._syncAttributes())}_addEventListeners(){super._addEventListeners(),this.shadowRoot!==null&&(this.shadowRoot.querySelectorAll("slot").forEach(t=>{t.addEventListener("slotchange",this._handleSlotChange)}),this._updateSectionState())}_removeEventListeners(){super._removeEventListeners(),this.shadowRoot!==null&&this.shadowRoot.querySelectorAll("slot").forEach(t=>{t.removeEventListener("slotchange",this._handleSlotChange)})}_updateSectionState(){if(this.shadowRoot===null)return;const t=[];this._sectionNames.forEach(e=>{const i=this.shadowRoot?.querySelector(`[part='${e}']`),n=this.shadowRoot?.querySelector(`slot[name='${e}']`);if(i===null||n===null)return;const s=n.assignedNodes({flatten:!0}).some(a=>a.nodeType===Node.TEXT_NODE?a.textContent?.trim().length!==0:a.nodeType===Node.ELEMENT_NODE);i.toggleAttribute("hidden",s===!1),i.dataset.filled=String(s),i.removeAttribute("data-divider"),s===!0&&t.push(i)}),t.slice(0,-1).forEach(e=>{e.dataset.divider="true"})}}const YA=new CSSStyleSheet;YA.replaceSync(Xc);class je extends WA{_headline=Ae;_text=Ae;_value=void 0;static textAttribute="text";static headlineAttribute="headline";static valueAttribute="value";constructor(){super(),this.shadowRoot?.adoptedStyleSheets.push(YA)}static get observedAttributes(){return[...WA.observedAttributes,je.textAttribute,je.headlineAttribute,je.valueAttribute]}get headline(){return this._headline}set headline(t){this._headline=t,this.setAttribute(je.headlineAttribute,t)}get text(){return this._text}set text(t){this._text=t,this.setAttribute(je.textAttribute,t)}get value(){return this._value}set value(t){this._value=t}connectedCallback(){this._render(),this._addEventListeners(),this.closedBy=xa.NONE}_render(){this.shadowRoot!==null&&(this.shadowRoot.innerHTML=Yc,this._syncAttributes())}_syncAttribute(t){if(je.observedAttributes.includes(t))switch(t){case je.headlineAttribute:{this._headline=this.getAttribute(t)??Ae;const e=this.shadowRoot?.querySelector("h2");e!=null&&(e.textContent=this._headline);break}case je.textAttribute:{this._text=this.getAttribute(t)??Ae;const e=this.shadowRoot?.querySelector("p");e!=null&&(e.textContent=this._text);break}case je.valueAttribute:{this._value=this.getAttribute(t);break}default:super._syncAttribute(t)}else super._syncAttribute(t)}_syncAttributes(){super._syncAttributes(),je.observedAttributes.forEach(t=>{this._syncAttribute(t)})}_addEventListeners(){super._addEventListeners(),this.shadowRoot?.querySelector(kA)?.addEventListener(Wi.CLICK,this._handleConfirm),this.shadowRoot?.querySelector(GA)?.addEventListener(Wi.CLICK,this._handleUndo)}_removeEventListeners(){super._removeEventListeners(),this.shadowRoot?.querySelector(kA)?.removeEventListener(Wi.CLICK,this._handleConfirm),this.shadowRoot?.querySelector(GA)?.removeEventListener(Wi.CLICK,this._handleUndo)}_handleConfirm=()=>{const t=new CustomEvent(gr.CONFIRMATION_DIALOG_CONFIRM,{bubbles:!0,composed:!0,detail:{value:this._value}});this.dispatchEvent(t)};_handleUndo=()=>{const t=new CustomEvent(gr.CONFIRMATION_DIALOG_UNDO,{bubbles:!0,composed:!0,detail:{value:this._value}});this.dispatchEvent(t),this._value=void 0}}const jc="confirmation-dialog",Qc={CONFIRMATION_DIALOG_CONFIRM:gr.CONFIRMATION_DIALOG_CONFIRM,CONFIRMATION_DIALOG_UNDO:gr.CONFIRMATION_DIALOG_UNDO},Yi=Object.freeze(Object.defineProperty({__proto__:null,COMPONENT_CUSTOM_MESSAGES:Qc,ConfirmationDialogComponent:je,selector:jc},Symbol.toStringTag,{value:"Module"})),qc=`<div class="bar-menu-container">
46
+ `,Jc='*{box-sizing:border-box}dialog[open]{max-width:100%;max-height:100%;display:flex;flex-direction:column;gap:var(--spacing-4)}dialog>[part]{position:relative}dialog>[part][hidden]{display:none}dialog>[part][data-divider=true]:after{content:"";position:absolute;left:0;right:0;bottom:0;border-bottom:var(--border-width-1) solid var(--color-neutral-600)}dialog>[part][data-divider=true]{padding-bottom:var(--spacing-4)}dialog div[part=body]{flex:1;min-height:0;overflow-y:auto}',VA=new CSSStyleSheet;VA.replaceSync(Jc);class WA extends cn{_sectionNames=["header","body","footer"];_handleSlotChange=()=>{this._updateSectionState()};constructor(){super(),this.shadowRoot?.adoptedStyleSheets.push(VA)}static get observedAttributes(){return cn.observedAttributes}_render(){this.shadowRoot!==null&&(this.shadowRoot.innerHTML=Zc,this._syncAttributes())}_addEventListeners(){super._addEventListeners(),this.shadowRoot!==null&&(this.shadowRoot.querySelectorAll("slot").forEach(t=>{t.addEventListener("slotchange",this._handleSlotChange)}),this._updateSectionState())}_removeEventListeners(){super._removeEventListeners(),this.shadowRoot!==null&&this.shadowRoot.querySelectorAll("slot").forEach(t=>{t.removeEventListener("slotchange",this._handleSlotChange)})}_updateSectionState(){if(this.shadowRoot===null)return;const t=[];this._sectionNames.forEach(e=>{const i=this.shadowRoot?.querySelector(`[part='${e}']`),n=this.shadowRoot?.querySelector(`slot[name='${e}']`);if(i===null||n===null)return;const s=n.assignedNodes({flatten:!0}).some(a=>a.nodeType===Node.TEXT_NODE?a.textContent?.trim().length!==0:a.nodeType===Node.ELEMENT_NODE);i.toggleAttribute("hidden",s===!1),i.dataset.filled=String(s),i.removeAttribute("data-divider"),s===!0&&t.push(i)}),t.slice(0,-1).forEach(e=>{e.dataset.divider="true"})}}const YA=new CSSStyleSheet;YA.replaceSync(Xc);class je extends WA{_headline=Ae;_text=Ae;_value=void 0;static textAttribute="text";static headlineAttribute="headline";static valueAttribute="value";constructor(){super(),this.shadowRoot?.adoptedStyleSheets.push(YA)}static get observedAttributes(){return[...WA.observedAttributes,je.textAttribute,je.headlineAttribute,je.valueAttribute]}get headline(){return this._headline}set headline(t){this._headline=t,this.setAttribute(je.headlineAttribute,t)}get text(){return this._text}set text(t){this._text=t,this.setAttribute(je.textAttribute,t)}get value(){return this._value}set value(t){this._value=t}connectedCallback(){this._render(),this._addEventListeners(),this.closedBy=xa.NONE}_render(){this.shadowRoot!==null&&(this.shadowRoot.innerHTML=Yc,this._syncAttributes())}_syncAttribute(t){if(je.observedAttributes.includes(t))switch(t){case je.headlineAttribute:{this._headline=this.getAttribute(t)??Ae;const e=this.shadowRoot?.querySelector("h2");e!=null&&(e.textContent=this._headline);break}case je.textAttribute:{this._text=this.getAttribute(t)??Ae;const e=this.shadowRoot?.querySelector("p");e!=null&&(e.textContent=this._text);break}case je.valueAttribute:{this._value=this.getAttribute(t);break}default:super._syncAttribute(t)}else super._syncAttribute(t)}_syncAttributes(){super._syncAttributes(),je.observedAttributes.forEach(t=>{this._syncAttribute(t)})}_addEventListeners(){super._addEventListeners(),this.shadowRoot?.querySelector(kA)?.addEventListener(Wi.CLICK,this._handleConfirm),this.shadowRoot?.querySelector(GA)?.addEventListener(Wi.CLICK,this._handleUndo)}_removeEventListeners(){super._removeEventListeners(),this.shadowRoot?.querySelector(kA)?.removeEventListener(Wi.CLICK,this._handleConfirm),this.shadowRoot?.querySelector(GA)?.removeEventListener(Wi.CLICK,this._handleUndo)}_handleConfirm=()=>{const t=new CustomEvent(gr.CONFIRMATION_DIALOG_CONFIRM,{bubbles:!0,composed:!0,detail:{value:this._value}});this.dispatchEvent(t)};_handleUndo=()=>{const t=new CustomEvent(gr.CONFIRMATION_DIALOG_UNDO,{bubbles:!0,composed:!0,detail:{value:this._value}});this.dispatchEvent(t),this._value=void 0}}const jc="confirmation-dialog",Qc={CONFIRMATION_DIALOG_CONFIRM:gr.CONFIRMATION_DIALOG_CONFIRM,CONFIRMATION_DIALOG_UNDO:gr.CONFIRMATION_DIALOG_UNDO},Yi=Object.freeze(Object.defineProperty({__proto__:null,COMPONENT_CUSTOM_MESSAGES:Qc,ConfirmationDialogComponent:je,selector:jc},Symbol.toStringTag,{value:"Module"})),qc=`<div class="bar-menu-container">
47
47
  <previous-button class="nav-prev" part="nav-prev-button"></previous-button>
48
48
 
49
49
  <div class="buttons-wrapper" part="buttons-wrapper">
@@ -3962,7 +3962,7 @@ void main() {
3962
3962
  headline="Switch language?"
3963
3963
  ></confirmation-dialog>
3964
3964
  </section>
3965
- `,YI="*{box-sizing:border-box}: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)}}",uc=new CSSStyleSheet;uc.replaceSync(YI);class _A extends HTMLElement{static textureLoader=new bh;shadowRoot;static get observedAttributes(){return Object.values(fa)}options=RA.options;flags=[];selected=RA.selected;selectedTmp=RA.selected;_renderer;_scene;_camera;_root;_canvas;_resizeObserver;_clock=new Lh;_lastTime=0;_spotlight;_flagsGroup;_wind=null;_circleRadius=5;_cameraLookAtY=2;_targetGroupRotation=0;_currentGroupRotation=0;_unwrappedGroupRotation=0;_animationFrameId=0;_introCameraStartPosition=new F(0,5,10);_introCameraEndPosition=new F(0,5,10);_introCameraElapsed=0;_introCameraMoveDuration=2.2;_introCameraHoldDuration=.4;_isIntroCameraAnimating=!1;_isIntroCameraHolding=!1;_menuContainer;_menuIntroStartScale=.72;_barMenu;_confirmationDialog;_isInitialized=!1;_isInitializing=!1;_barMenuVisibleIndex=-1;_floorGeometry;_floorMaterial;_programmaticScrollTimer=null;constructor(){super(),this.shadowRoot=this.attachShadow({mode:"open"}),this.shadowRoot.adoptedStyleSheets.push(uc)}attributeChangedCallback(t,e,i){if(!(e===i||i==null))switch(t){case fa.OPTIONS:{const n=JSON.parse(i);this.init(new Set(n))}break;case fa.SELECTED:{const n=i;this.select(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.flags=[],this._floorGeometry.dispose(),this._floorMaterial.dispose(),this._scene.clear(),this._renderer.dispose(),this._resizeObserver.disconnect(),this._confirmationDialog?.removeEventListener(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_CONFIRM,this._handleConfirmation)}init(t){if(!(this._isInitialized||this._isInitializing)){if(this.options=t,this.options.size===0){console.warn(`${this.constructor.name}: 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=WI,this._root=this.shadowRoot.querySelector(".root")??(()=>{throw new Error(`${this.constructor.name}: root element not found`)})(),this._canvas=this.shadowRoot.querySelector(NA.CANVAS)??(()=>{throw new Error(`${this.constructor.name}: canvas element not found`)})(),this._confirmationDialog=this.shadowRoot.querySelector(Yi.selector)??(()=>{throw new Error(`${this.constructor.name}: confirmation-dialog element not found`)})()}setupScene(){this._scene=new Sh,this._scene.background=new Vt(1710618),this._scene.fog=new fA(1710618,8,50),this._camera=new ze(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 hc({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;const t=new zf(16777215,.3);this._scene.add(t);const e=new Ph(14674943,3);e.position.set(10,20,10),this._scene.add(e);const i=new Ph(11329439,.15);i.position.set(0,-1,0),this._scene.add(i),this._spotlight=new Of(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);const n=100;this._floorGeometry=new cr(n,n),this._floorMaterial=new _f({color:1710618,roughness:.8,metalness:.2});const s=new mi(this._floorGeometry,this._floorMaterial);s.rotation.x=-Math.PI/2,s.receiveShadow=!0,this._scene.add(s),this.resizeHandler(),this.shadowRoot.appendChild(this._root)}setupUI(){this._menuContainer=this.shadowRoot.querySelector(".menu-container")??(()=>{throw new Error(`${this.constructor.name}: menu-container not found`)})(),this._barMenu=this.shadowRoot.querySelector(tu.selector)??(()=>{throw new Error(`${this.constructor.name}: bar menu element not found`)})()}setupFlags(){this._flagsGroup=new hr,this._scene.add(this._flagsGroup),this._wind=new Li.Wind({speed:8,direction:new F(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,s)=>{const a=-(s/t*Math.PI*2),o=-Math.sin(a)*this._circleRadius,l=Math.cos(a)*this._circleRadius,A=Li.buildFlag(),h=Li.buildFlagpole({flagpoleType:Li.FLAG_POLE_TYPE.VERTICAL},A),c=new Li.FlagGroup({flagpole:h,flag:A});c.object.position.set(o,0,l);const u=va.get(n)?.isoCode,d=u!=null?zn[u]:void 0;d!=null&&_A.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,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._camera.lookAt(0,this._cameraLookAtY,0),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._canvas.parentElement;if(e===null)return;const i=e.clientWidth,n=e.clientHeight;i===0||n===0||(this._camera.aspect=i/n,this._camera.updateProjectionMatrix(),this._renderer.setSize(i,n,!1))};this._resizeObserver=new ResizeObserver(t),this._resizeObserver.observe(this._canvas.parentElement),t()};listenToBarMenuNavigation(){new MutationObserver(()=>{if(this._programmaticScrollTimer!==null)return;const e=this._barMenu.querySelectorAll(zA.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"]})}_computeIntroCameraEndPosition(){const t=new hs().setFromObject(this._flagsGroup),e=new F,i=new F;t.getSize(e),t.getCenter(i);const n=t.min.y,s=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,l=2*Math.atan(Math.tan(a*.5)*o),A=Math.max(s/Math.tan(a*.5),s/Math.tan(l*.5))*1.05,h=n+e.y*.25;this._cameraLookAtY=h+e.y*.06;const c=h+Math.max(e.y*.8,this._circleRadius*.28),u=i.z+A+this._circleRadius*.01;return new F(0,c,u)}select(t){if(this._isInitialized===!1){this.selected=t,this.selectedTmp=t;return}if(this.options.has(t)===!1){console.warn(`${this.constructor.name}: Language '${t}' not found`);return}t!==this.selected&&(this.selected=t,this.selectedTmp=t,this._rotateToId(this.selected),this._syncBarMenuToId(this.selected))}_rotateToId(t){const e=this.flags.find(s=>s.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}_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(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_CONFIRM,this._handleConfirmation),this.options.forEach(t=>{const e=document.createElement(zA.selector);e.textContent=va.get(t)?.autonyms??t,e.addEventListener(fr.CLICK,()=>{this.barMenuButtonClickHandler()}),this._barMenu.appendChild(e)}),this._barMenu.visibleButtons=1,this._barMenu.cyclicalNavigation=!0,requestAnimationFrame(()=>{this._syncBarMenuToId(this.selected),this.listenToBarMenuNavigation()})}barMenuButtonClickHandler=()=>{const t=va.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(cc.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!=null&&this._wind.update(),this.flags.forEach((i,n)=>{if(i.flagGroup==null)return;i.windPhase+=e*(.5+i.randomSeed*1.5),Li.applyGravityToCloth(i.flagGroup.flag.cloth,i.flagGroup.flag.object),this._wind!=null&&Li.applyWindForceToCloth(i.flagGroup.flag.cloth,this._wind,i.flagGroup.flag.object,{randomizeAmount:.6,randomSeed:i.randomSeed});const s=new Li.Wind({speed:.3+Math.sin(i.windPhase)*.2,direction:new F(Math.sin(i.windPhase+n)*.5,Math.cos(i.windPhase*.7),Math.sin(i.windPhase*.5+n)).normalize()});Li.applyWindForceToCloth(i.flagGroup.flag.cloth,s,i.flagGroup.flag.object,{randomizeAmount:.5,randomSeed:i.randomSeed*2}),i.flagGroup.simulate(e),i.flagGroup.render()}),this._updateGroupRotation(),this._updateIntroCamera(e),this._camera.lookAt(0,this._cameraLookAtY,0),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}_updateIntroCamera(t){if(!this._isIntroCameraAnimating)return;if(this._isIntroCameraHolding){this._introCameraElapsed+=t,this._camera.position.copy(this._introCameraStartPosition),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._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})`}addLanguage(t){}addLocales(t){}removeLanguage(t){}removeLocales(t){}}const XI=Object.freeze(Object.defineProperty({__proto__:null,COMPONENT_CUSTOM_MESSAGES:cc,LanguagePickerComponent:_A,OBSERVED_ATTRIBUTES:fa,selector:"as-language-picker"},Symbol.toStringTag,{value:"Module"})),dc={THEME_CHANGE_CONFIRMED:Ca.THEME_CHANGE_CONFIRMED},ga={RIGHT:new F(1,0,0),LEFT:new F(-1,0,0),TOP:new F(0,1,0),BOTTOM:new F(0,-1,0),FRONT:new F(0,0,1),BACK:new F(0,0,-1)},ZI=new Set([me.DARK_PURPLE]),PA={selected:me.DARK_PURPLE,options:ZI},pa={OPTIONS:"themes",SELECTED:"selected"},JI=`<section class="root">
3965
+ `,YI="*{box-sizing:border-box}: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)}}",uc=new CSSStyleSheet;uc.replaceSync(YI);class _A extends HTMLElement{static textureLoader=new bh;shadowRoot;static get observedAttributes(){return Object.values(fa)}options=RA.options;flags=[];selected=RA.selected;selectedTmp=RA.selected;_renderer;_scene;_camera;_root;_canvas;_resizeObserver;_clock=new Lh;_lastTime=0;_spotlight;_flagsGroup;_wind=null;_circleRadius=5;_cameraLookAtY=2;_targetGroupRotation=0;_currentGroupRotation=0;_unwrappedGroupRotation=0;_animationFrameId=0;_introCameraStartPosition=new F(0,5,10);_introCameraEndPosition=new F(0,5,10);_introCameraElapsed=0;_introCameraMoveDuration=2.2;_introCameraHoldDuration=.4;_isIntroCameraAnimating=!1;_isIntroCameraHolding=!1;_menuContainer;_menuIntroStartScale=.72;_barMenu;_confirmationDialog;_isInitialized=!1;_isInitializing=!1;_barMenuVisibleIndex=-1;_floorGeometry;_floorMaterial;_programmaticScrollTimer=null;constructor(){super(),this.shadowRoot=this.attachShadow({mode:"open"}),this.shadowRoot.adoptedStyleSheets.push(uc)}attributeChangedCallback(t,e,i){if(!(e===i||i==null))switch(t){case fa.OPTIONS:{const n=JSON.parse(i);this.init(new Set(n))}break;case fa.SELECTED:{const n=i;this.select(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.flags=[],this._floorGeometry.dispose(),this._floorMaterial.dispose(),this._scene.clear(),this._renderer.dispose(),this._resizeObserver.disconnect(),this._confirmationDialog?.removeEventListener(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_CONFIRM,this._handleConfirmation)}init(t){if(!(this._isInitialized||this._isInitializing)){if(this.options=t,this.options.size===0){console.warn(`${this.constructor.name}: 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=WI,this._root=this.shadowRoot.querySelector(".root")??(()=>{throw new Error(`${this.constructor.name}: root element not found`)})(),this._canvas=this.shadowRoot.querySelector(NA.CANVAS)??(()=>{throw new Error(`${this.constructor.name}: canvas element not found`)})(),this._confirmationDialog=this.shadowRoot.querySelector(Yi.selector)??(()=>{throw new Error(`${this.constructor.name}: confirmation-dialog element not found`)})()}setupScene(){this._scene=new Sh,this._scene.background=new Vt(1710618),this._scene.fog=new fA(1710618,8,50),this._camera=new ze(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 hc({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;const t=new zf(16777215,.3);this._scene.add(t);const e=new Ph(14674943,3);e.position.set(10,20,10),this._scene.add(e);const i=new Ph(11329439,.15);i.position.set(0,-1,0),this._scene.add(i),this._spotlight=new Of(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);const n=100;this._floorGeometry=new cr(n,n),this._floorMaterial=new _f({color:1710618,roughness:.8,metalness:.2});const s=new mi(this._floorGeometry,this._floorMaterial);s.rotation.x=-Math.PI/2,s.receiveShadow=!0,this._scene.add(s),this.resizeHandler(),this.shadowRoot.appendChild(this._root)}setupUI(){this._menuContainer=this.shadowRoot.querySelector(".menu-container")??(()=>{throw new Error(`${this.constructor.name}: menu-container not found`)})(),this._barMenu=this.shadowRoot.querySelector(tu.selector)??(()=>{throw new Error(`${this.constructor.name}: bar menu element not found`)})()}setupFlags(){this._flagsGroup=new hr,this._scene.add(this._flagsGroup),this._wind=new Li.Wind({speed:8,direction:new F(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,s)=>{const a=-(s/t*Math.PI*2),o=-Math.sin(a)*this._circleRadius,l=Math.cos(a)*this._circleRadius,A=Li.buildFlag(),h=Li.buildFlagpole({flagpoleType:Li.FLAG_POLE_TYPE.VERTICAL},A),c=new Li.FlagGroup({flagpole:h,flag:A});c.object.position.set(o,0,l);const u=va.get(n)?.isoCode,d=u!=null?zn[u]:void 0;d!=null&&_A.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,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._camera.lookAt(0,this._cameraLookAtY,0),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(zA.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"]})}_computeIntroCameraEndPosition(){const t=new hs().setFromObject(this._flagsGroup),e=new F,i=new F;t.getSize(e),t.getCenter(i);const n=t.min.y,s=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,l=2*Math.atan(Math.tan(a*.5)*o),A=Math.max(s/Math.tan(a*.5),s/Math.tan(l*.5))*1.05,h=n+e.y*.25;this._cameraLookAtY=h+e.y*.06;const c=h+Math.max(e.y*.8,this._circleRadius*.28),u=i.z+A+this._circleRadius*.01;return new F(0,c,u)}select(t){if(this._isInitialized===!1){this.selected=t,this.selectedTmp=t;return}if(this.options.has(t)===!1){console.warn(`${this.constructor.name}: Language '${t}' not found`);return}t!==this.selected&&(this.selected=t,this.selectedTmp=t,this._rotateToId(this.selected),this._syncBarMenuToId(this.selected))}_rotateToId(t){const e=this.flags.find(s=>s.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}_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(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_CONFIRM,this._handleConfirmation),this.options.forEach(t=>{const e=document.createElement(zA.selector);e.textContent=va.get(t)?.autonyms??t,e.addEventListener(fr.CLICK,()=>{this.barMenuButtonClickHandler()}),this._barMenu.appendChild(e)}),this._barMenu.visibleButtons=1,this._barMenu.cyclicalNavigation=!0,requestAnimationFrame(()=>{this._syncBarMenuToId(this.selected),this.listenToBarMenuNavigation()})}barMenuButtonClickHandler=()=>{const t=va.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(cc.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!=null&&this._wind.update(),this.flags.forEach((i,n)=>{if(i.flagGroup==null)return;i.windPhase+=e*(.5+i.randomSeed*1.5),Li.applyGravityToCloth(i.flagGroup.flag.cloth,i.flagGroup.flag.object),this._wind!=null&&Li.applyWindForceToCloth(i.flagGroup.flag.cloth,this._wind,i.flagGroup.flag.object,{randomizeAmount:.6,randomSeed:i.randomSeed});const s=new Li.Wind({speed:.3+Math.sin(i.windPhase)*.2,direction:new F(Math.sin(i.windPhase+n)*.5,Math.cos(i.windPhase*.7),Math.sin(i.windPhase*.5+n)).normalize()});Li.applyWindForceToCloth(i.flagGroup.flag.cloth,s,i.flagGroup.flag.object,{randomizeAmount:.5,randomSeed:i.randomSeed*2}),i.flagGroup.simulate(e),i.flagGroup.render()}),this._updateGroupRotation(),this._updateIntroCamera(e),this._camera.lookAt(0,this._cameraLookAtY,0),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}_updateIntroCamera(t){if(!this._isIntroCameraAnimating)return;if(this._isIntroCameraHolding){this._introCameraElapsed+=t,this._camera.position.copy(this._introCameraStartPosition),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._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})`}addLanguage(t){}addLocales(t){}removeLanguage(t){}removeLocales(t){}}const XI=Object.freeze(Object.defineProperty({__proto__:null,COMPONENT_CUSTOM_MESSAGES:cc,LanguagePickerComponent:_A,OBSERVED_ATTRIBUTES:fa,selector:"as-language-picker"},Symbol.toStringTag,{value:"Module"})),dc={THEME_CHANGE_CONFIRMED:Ca.THEME_CHANGE_CONFIRMED},ga={RIGHT:new F(1,0,0),LEFT:new F(-1,0,0),TOP:new F(0,1,0),BOTTOM:new F(0,-1,0),FRONT:new F(0,0,1),BACK:new F(0,0,-1)},ZI=new Set([me.DARK_PURPLE]),PA={selected:me.DARK_PURPLE,options:ZI},pa={OPTIONS:"themes",SELECTED:"selected"},JI=`<section class="root">
3966
3966
  <canvas></canvas>
3967
3967
  <section class="preview-dialog-container">
3968
3968
  <header-body-footer-dialog class="preview-dialog">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@albi_scando/as-design-system-threejs-lib",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
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": [
@@ -89,7 +89,7 @@
89
89
  "@albi_scando/as-const-languages-lib": "^1.1.0",
90
90
  "@albi_scando/as-const-lib": "^1.9.0",
91
91
  "@albi_scando/as-const-themes-lib": "^1.0.0",
92
- "@albi_scando/as-design-system-lib": "^1.7.7",
92
+ "@albi_scando/as-design-system-lib": "^1.7.8",
93
93
  "@albi_scando/as-threejs-flags-lib": "^2.3.2",
94
94
  "@fontsource/material-symbols-outlined": "^5.0.0",
95
95
  "@types/three": "^0.179.0",