@albi_scando/as-design-system-threejs-lib 1.1.10 → 1.1.12
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);
|
|
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"];
|
|
@@ -30638,7 +30638,7 @@ const zC = "as-language-picker", jC = /* @__PURE__ */ Object.freeze(/* @__PURE__
|
|
|
30638
30638
|
</section>
|
|
30639
30639
|
<confirmation-dialog id="confirmation-dialog"></confirmation-dialog>
|
|
30640
30640
|
</section>
|
|
30641
|
-
`, VC = "*{box-sizing:border-box}:host{display:block;width:100%;height:100%}.root{position:relative;width:100%;height:100%;overflow:hidden}canvas{
|
|
30641
|
+
`, VC = "*{box-sizing:border-box}:host{display:block;width:100%;height:100%}.root{position:relative;width:100%;height:100%;overflow:hidden}canvas{width:100%;height:100%;display:block;touch-action:none;cursor:grab}canvas.dragging{cursor:grabbing}.preview-dialog-container{position:absolute;bottom:5%;left:50%;width:30%;transform:translate(-50%)}.preview-dialog-container .preview-dialog::part(dialog){position:relative}.preview-dialog-container .preview-dialog .title{font-size:16px;font-weight:700;letter-spacing:.01em}.preview-dialog-container .preview-dialog .subtitle{font-size:12px;opacity:.75}.preview-dialog-container .preview-dialog .footer{display:flex;justify-content:flex-end}@media(max-width:768px){.preview-dialog-container{width:90%}}", Ic = new CSSStyleSheet();
|
|
30642
30642
|
Ic.replaceSync(VC);
|
|
30643
30643
|
const WC = 3;
|
|
30644
30644
|
class us extends HTMLElement {
|
|
@@ -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);
|
|
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">
|
|
@@ -3985,4 +3985,4 @@ void main() {
|
|
|
3985
3985
|
</section>
|
|
3986
3986
|
<confirmation-dialog id="confirmation-dialog"></confirmation-dialog>
|
|
3987
3987
|
</section>
|
|
3988
|
-
`,jI="*{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;cursor:grab}canvas.dragging{cursor:grabbing}.preview-dialog-container{position:absolute;bottom:clamp(0rem,40vh,35%);left:50%;transform:translate(-50%);width:30%}.preview-dialog-container .preview-dialog{display:block;width:100%}.preview-dialog-container .preview-dialog::part(dialog){translate:0 0}.preview-dialog-container .preview-dialog .title{font-size:16px;font-weight:700;letter-spacing:.01em}.preview-dialog-container .preview-dialog .subtitle{font-size:12px;opacity:.75}@media(max-width:768px){.preview-dialog-container{bottom:clamp(0rem,40vh,40%);width:90%}}",fc=new CSSStyleSheet;fc.replaceSync(jI);const QI=3;class ws extends HTMLElement{static textureLoader=new bh;shadowRoot;static get observedAttributes(){return Object.values(pa)}static CUBE_SIDE_LENGTH=2;options=PA.options;selected=PA.selected;selectedTmp=PA.selected;_renderer;_scene;_camera;_root;_canvas;_resizeObserver;_clock=new Lh;_lastTime=0;_cube;_cubeGeometry;_cubeMaterials=[];_animationFrameId=0;previewDialog=null;_previewTitle;_previewSub;_applyBtn;_confirmationDialog;_isConfirmationDialogOpen=!1;_themeTextures={};_currentFaceThemeId;_isDragging=!1;_lastPointerX=0;_lastPointerY=0;_dragPointerId=null;_rotX=.24;_rotY=.45;_rotZ=0;_idleSeconds=0;_autoSpinEnabled=!1;_autoVelX=0;_autoVelY=0;_isInitialized=!1;_isInitializing=!1;_tmpCamDir=new F;_tmpWorldNormal=new F;constructor(){super(),this.shadowRoot=this.attachShadow({mode:"open"}),this.shadowRoot.adoptedStyleSheets.push(fc)}attributeChangedCallback(t,e,i){if(!(e===i||i==null))switch(t){case pa.OPTIONS:{const n=JSON.parse(i);this.init(new Set(n))}break;case pa.SELECTED:{const n=i;this.select(n)}break}}connectedCallback(){this._isInitialized&&this._animationFrameId===0&&(this._clock.start(),this._animationFrameId=requestAnimationFrame(this._animate))}disconnectedCallback(){cancelAnimationFrame(this._animationFrameId),this._animationFrameId=0,this._unbindEvents(),this._cubeMaterials.forEach(t=>{t.map?.dispose(),t.dispose()}),this._cubeMaterials=[],this._cubeGeometry!=null&&this._cubeGeometry.dispose(),this._scene!=null&&this._scene.clear(),this._renderer!=null&&this._renderer.dispose(),this._resizeObserver!=null&&this._resizeObserver.disconnect(),this._confirmationDialog?.removeEventListener(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_CONFIRM,this._handleConfirmation),this._confirmationDialog?.removeEventListener(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_UNDO,this._handleConfirmationCancel),this.selected!==this.selectedTmp&&FA(this.selected)}init(t){if(!(this._isInitialized||this._isInitializing)){if(this.options=t,this.options.size===0){console.warn(`${this.constructor.name}: No themes provided`);return}this._isInitializing=!0,this.setupHtmlElements(),this.setupScene(),this.setupUI(),this.setupCube(),this.setupConfirmationDialog(),this.setupApplyButton(),this._bindEvents(),this._isInitialized=!0,this._isInitializing=!1,this._updatePreviewDialog(this.selected),this._syncRotationToSelected(),this._updatePanelPosition(),this.isConnected&&this._animationFrameId===0&&(this._clock.start(),this._animationFrameId=requestAnimationFrame(this._animate))}}setupHtmlElements(){this.shadowRoot.innerHTML=JI,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(){const t=this._root.clientWidth!==0?this._root.clientWidth:800,e=this._root.clientHeight!==0?this._root.clientHeight:600;this._renderer=new hc({canvas:this._canvas,antialias:!0,alpha:!0}),this._renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this._renderer.setSize(t,e,!1),this._renderer.setClearColor(0,0),this._scene=new Sh,this._scene.background=new Vt(1710618),this._camera=new ze(44,t/e,.1,100),this._updateCameraForLayout(),this._camera.lookAt(0,0,0),this.resizeHandler()}setupUI(){this.previewDialog=this.shadowRoot.querySelector(".preview-dialog"),this.previewDialog!=null&&setTimeout(()=>{this.previewDialog?.show()}),this._previewTitle=this.shadowRoot.querySelector(".preview-title")??(()=>{throw new Error(`${this.constructor.name}: .preview-title not found`)})(),this._previewSub=this.shadowRoot.querySelector(".preview-sub")??(()=>{throw new Error(`${this.constructor.name}: .preview-sub not found`)})(),this._applyBtn=this.shadowRoot.querySelector(".apply-btn")??(()=>{throw new Error(`${this.constructor.name}: .apply-btn not found`)})()}setupCube(){const t=Object.keys(ga).length;this._cubeMaterials=Array.from({length:t},(e,i)=>{const n=this._getThemeIdForFace(i),s=this._resolveThemeFaceVisual(n),a=new hA({color:"#ece9e4"});return this._setMaterialTexture(a,n,s),a}),this._cubeGeometry=new vs(ws.CUBE_SIDE_LENGTH,ws.CUBE_SIDE_LENGTH,ws.CUBE_SIDE_LENGTH),this._cube=new mi(this._cubeGeometry,this._cubeMaterials),this._cube.rotation.x=this._rotX,this._cube.rotation.y=this._rotY,this._cube.translateY(1.25),this._scene.add(this._cube)}resizeHandler=()=>{const t=()=>{const e=this._root.clientWidth,i=this._root.clientHeight;e===0||i===0||(this._renderer.setSize(e,i,!1),this._camera.aspect=e/i,this._camera.updateProjectionMatrix(),this._updateCameraForLayout(),this._updatePanelPosition())};this._resizeObserver=new ResizeObserver(t),this._resizeObserver.observe(this._root),t()};setupApplyButton(){this._applyBtn.addEventListener(fr.CLICK,this._handleApplyClick)}setupConfirmationDialog(){this._confirmationDialog.addEventListener(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_CONFIRM,this._handleConfirmation),this._confirmationDialog.addEventListener(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_UNDO,this._handleConfirmationCancel)}select(t){if(this._isInitialized===!1){this.selected=t,this.selectedTmp=t;return}if(this.options.has(t)===!1){console.warn(`${this.constructor.name}: Theme '${t}' not found`);return}t!==this.selected&&(this.selected=t,this.selectedTmp=t,this._syncRotationToSelected(),this._updatePreviewDialog(t),this._stopAutoSpinFromInteraction())}_syncRotationToSelected(){const e=[...this.options].indexOf(this.selected);if(e<0)return;const i=Object.values(ga)[e%Object.keys(ga).length],n=new F(0,0,1),s=new as;s.setFromUnitVectors(i,n);const a=new fi;a.setFromQuaternion(s),this._rotX=a.x,this._rotY=a.y,this._rotZ=a.z,this._currentFaceThemeId=this.selected}_handleApplyClick=()=>{this._applyTheme()};_applyTheme(){if(this._currentFaceThemeId==null)return;const t=this._resolveThemeFaceVisual(this._currentFaceThemeId);this._confirmationDialog.value=this._currentFaceThemeId,this._confirmationDialog.headline="Apply theme?",this._confirmationDialog.text=`Are you sure you want to apply the theme ${t.name}?`,this._confirmationDialog.showModal(),this._isConfirmationDialogOpen=!0,this._stopAutoSpinFromInteraction()}_updatePreviewDialog(t){const e=this._resolveThemeFaceVisual(t),i=t===this.selected;this._previewTitle.textContent=`${e.icon} ${e.name}`,this._previewSub.textContent=e.description,this._applyBtn.disabled=i,this._applyBtn.textContent=i?"Already active":"Apply",this._applyBtn.title=i?"Already the active theme":"Apply this theme"}_animate=()=>{this._animationFrameId=requestAnimationFrame(this._animate);try{if(!this._isInitialized)return;const t=this._clock.getElapsedTime(),e=t-this._lastTime;this._lastTime=t;const i=Math.min(Math.max(e,0),1/24);!this._isDragging&&!this._isConfirmationDialogOpen&&this._updateIdleAutoSpin(i),this._cube.rotation.x=this._rotX,this._cube.rotation.y=this._rotY,this._cube.rotation.z=this._rotZ;const n=this._getFrontFaceIndex(),s=this._getThemeIdForFace(n);s!==this._currentFaceThemeId&&(this._currentFaceThemeId=s,this._updatePreviewDialog(s),this.selectedTmp=s,FA(s)),this._renderer.render(this._scene,this._camera)}catch(t){console.error("Animation loop error:",t),cancelAnimationFrame(this._animationFrameId),this._animationFrameId=0}};_updateIdleAutoSpin(t){this._idleSeconds+=t,!this._autoSpinEnabled&&this._idleSeconds>=QI&&(this._autoSpinEnabled=!0,this._autoVelX=.0015,this._autoVelY=.0015*(1+Math.sqrt(5))/2),this._autoSpinEnabled&&(this._rotX+=this._autoVelX,this._rotY+=this._autoVelY,this._rotX>Math.PI/2.2&&(this._autoVelX=-Math.abs(this._autoVelX)),this._rotX<-Math.PI/2.2&&(this._autoVelX=Math.abs(this._autoVelX)))}_getFrontFaceIndex(){this._camera.getWorldDirection(this._tmpCamDir),this._tmpCamDir.negate();const t=Object.values(ga);let e=-1,i=-1/0;for(let n=0;n<t.length;n+=1){this._tmpWorldNormal.copy(t[n]).applyQuaternion(this._cube.quaternion);const s=this._tmpWorldNormal.dot(this._tmpCamDir);s>i&&(i=s,e=n)}return e}_updateCameraForLayout(){this._camera.position.set(0,.9,8),this._camera.lookAt(0,0,0)}_updatePanelPosition(){}_setMaterialTexture(t,e,i){const n=this._themeTextures[e];if(n==null||n.length===0){t.map?.dispose(),t.map=this._createFallbackFaceTexture(i),t.needsUpdate=!0;return}ws.textureLoader.load(n,s=>{s.colorSpace=_e,s.needsUpdate=!0,t.map?.dispose(),t.map=s,t.needsUpdate=!0},void 0,()=>{t.map?.dispose(),t.map=this._createFallbackFaceTexture(i),t.needsUpdate=!0})}_createFallbackFaceTexture(t){const i=document.createElement("canvas");i.width=768,i.height=768;const n=i.getContext("2d");if(n==null){const o=new Mh(i);return o.colorSpace=_e,o}const s=n.createLinearGradient(0,0,768,768);s.addColorStop(0,"#ece9e4"),s.addColorStop(1,"#ddd9d2"),n.fillStyle=s,n.fillRect(0,0,768,768),n.fillStyle="rgba(0, 0, 0, 0.04)",n.beginPath(),n.roundRect(48,48,672,672,28),n.fill(),n.strokeStyle="#f3f3f3",n.lineWidth=6,n.beginPath(),n.roundRect(48,48,672,672,28),n.stroke(),n.fillStyle="#6366f1",n.fillRect(48,48,672,6),n.fillStyle="#141414",n.font="140px serif",n.textAlign="center",n.textBaseline="middle",n.fillText(t.icon,768/2,768/2-70),n.font="bold 72px sans-serif",n.fillText(t.name,768/2,768/2+80,648);const a=new Mh(i);return a.colorSpace=_e,a.needsUpdate=!0,a}_getThemeIdForFace(t){const e=[...this.options];return e.length===0?me.DARK:e[t%e.length]??me.DARK}_stopAutoSpinFromInteraction(){this._idleSeconds=0,this._autoSpinEnabled=!1,this._autoVelX=0,this._autoVelY=0}_onPointerDown=t=>{this._isDragging=!0,this._dragPointerId=t.pointerId,this._lastPointerX=t.clientX,this._lastPointerY=t.clientY,this._canvas.classList.add("dragging"),this._stopAutoSpinFromInteraction(),this._canvas.setPointerCapture(t.pointerId)};_onPointerMove=t=>{if(!this._isDragging||this._dragPointerId!==t.pointerId)return;const e=t.clientX-this._lastPointerX,i=t.clientY-this._lastPointerY;this._rotY+=e*.008,this._rotX+=i*.008,this._lastPointerX=t.clientX,this._lastPointerY=t.clientY,this._stopAutoSpinFromInteraction()};_onPointerUp=t=>{this._dragPointerId===t.pointerId&&(this._isDragging=!1,this._dragPointerId=null,this._canvas.classList.remove("dragging"),this._idleSeconds=0)};_bindEvents(){this._canvas.addEventListener(Vi.POINTER_DOWN,this._onPointerDown),this._canvas.addEventListener(Vi.POINTER_MOVE,this._onPointerMove),this._applyBtn.addEventListener(fr.CLICK,this._handleApplyClick),window.addEventListener(Vi.POINTER_UP,this._onPointerUp),window.addEventListener(Vi.POINTER_CANCEL,this._onPointerUp)}_unbindEvents(){this._canvas?.removeEventListener(Vi.POINTER_DOWN,this._onPointerDown),this._canvas?.removeEventListener(Vi.POINTER_MOVE,this._onPointerMove),this._applyBtn?.removeEventListener(fr.CLICK,this._handleApplyClick),window.removeEventListener(Vi.POINTER_UP,this._onPointerUp),window.removeEventListener(Vi.POINTER_CANCEL,this._onPointerUp)}_handleConfirmation=()=>{this.selectedTmp!==this.selected&&(this.dispatchEvent(new CustomEvent(dc.THEME_CHANGE_CONFIRMED,{detail:{value:this.selectedTmp},bubbles:!0,composed:!0})),this._isConfirmationDialogOpen=!1,this._idleSeconds=0)};_handleConfirmationCancel=()=>{this._isConfirmationDialogOpen=!1};_resolveThemeFaceVisual(t){return Ec.get(t)}}const qI=Object.freeze(Object.defineProperty({__proto__:null,COMPONENT_CUSTOM_MESSAGES:dc,OBSERVED_ATTRIBUTES:pa,ThemePickerComponent:ws,selector:"theme-picker"},Symbol.toStringTag,{value:"Module"}));ei.APPLICATION_NAME=_s,ei.CUSTOM_MESSAGES=Ca,ei.LanguagePicker=XI,ei.THEME_TEXTURES_MAPPER=Oc,ei.ThemePicker=qI,ei.WebComponentsRegistry=xc,Object.defineProperty(ei,Symbol.toStringTag,{value:"Module"})}));
|
|
3988
|
+
`,jI="*{box-sizing:border-box}:host{display:block;width:100%;height:100%}.root{position:relative;width:100%;height:100%;overflow:hidden}canvas{width:100%;height:100%;display:block;touch-action:none;cursor:grab}canvas.dragging{cursor:grabbing}.preview-dialog-container{position:absolute;bottom:5%;left:50%;width:30%;transform:translate(-50%)}.preview-dialog-container .preview-dialog::part(dialog){position:relative}.preview-dialog-container .preview-dialog .title{font-size:16px;font-weight:700;letter-spacing:.01em}.preview-dialog-container .preview-dialog .subtitle{font-size:12px;opacity:.75}.preview-dialog-container .preview-dialog .footer{display:flex;justify-content:flex-end}@media(max-width:768px){.preview-dialog-container{width:90%}}",fc=new CSSStyleSheet;fc.replaceSync(jI);const QI=3;class ws extends HTMLElement{static textureLoader=new bh;shadowRoot;static get observedAttributes(){return Object.values(pa)}static CUBE_SIDE_LENGTH=2;options=PA.options;selected=PA.selected;selectedTmp=PA.selected;_renderer;_scene;_camera;_root;_canvas;_resizeObserver;_clock=new Lh;_lastTime=0;_cube;_cubeGeometry;_cubeMaterials=[];_animationFrameId=0;previewDialog=null;_previewTitle;_previewSub;_applyBtn;_confirmationDialog;_isConfirmationDialogOpen=!1;_themeTextures={};_currentFaceThemeId;_isDragging=!1;_lastPointerX=0;_lastPointerY=0;_dragPointerId=null;_rotX=.24;_rotY=.45;_rotZ=0;_idleSeconds=0;_autoSpinEnabled=!1;_autoVelX=0;_autoVelY=0;_isInitialized=!1;_isInitializing=!1;_tmpCamDir=new F;_tmpWorldNormal=new F;constructor(){super(),this.shadowRoot=this.attachShadow({mode:"open"}),this.shadowRoot.adoptedStyleSheets.push(fc)}attributeChangedCallback(t,e,i){if(!(e===i||i==null))switch(t){case pa.OPTIONS:{const n=JSON.parse(i);this.init(new Set(n))}break;case pa.SELECTED:{const n=i;this.select(n)}break}}connectedCallback(){this._isInitialized&&this._animationFrameId===0&&(this._clock.start(),this._animationFrameId=requestAnimationFrame(this._animate))}disconnectedCallback(){cancelAnimationFrame(this._animationFrameId),this._animationFrameId=0,this._unbindEvents(),this._cubeMaterials.forEach(t=>{t.map?.dispose(),t.dispose()}),this._cubeMaterials=[],this._cubeGeometry!=null&&this._cubeGeometry.dispose(),this._scene!=null&&this._scene.clear(),this._renderer!=null&&this._renderer.dispose(),this._resizeObserver!=null&&this._resizeObserver.disconnect(),this._confirmationDialog?.removeEventListener(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_CONFIRM,this._handleConfirmation),this._confirmationDialog?.removeEventListener(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_UNDO,this._handleConfirmationCancel),this.selected!==this.selectedTmp&&FA(this.selected)}init(t){if(!(this._isInitialized||this._isInitializing)){if(this.options=t,this.options.size===0){console.warn(`${this.constructor.name}: No themes provided`);return}this._isInitializing=!0,this.setupHtmlElements(),this.setupScene(),this.setupUI(),this.setupCube(),this.setupConfirmationDialog(),this.setupApplyButton(),this._bindEvents(),this._isInitialized=!0,this._isInitializing=!1,this._updatePreviewDialog(this.selected),this._syncRotationToSelected(),this._updatePanelPosition(),this.isConnected&&this._animationFrameId===0&&(this._clock.start(),this._animationFrameId=requestAnimationFrame(this._animate))}}setupHtmlElements(){this.shadowRoot.innerHTML=JI,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(){const t=this._root.clientWidth!==0?this._root.clientWidth:800,e=this._root.clientHeight!==0?this._root.clientHeight:600;this._renderer=new hc({canvas:this._canvas,antialias:!0,alpha:!0}),this._renderer.setPixelRatio(Math.min(window.devicePixelRatio,2)),this._renderer.setSize(t,e,!1),this._renderer.setClearColor(0,0),this._scene=new Sh,this._scene.background=new Vt(1710618),this._camera=new ze(44,t/e,.1,100),this._updateCameraForLayout(),this._camera.lookAt(0,0,0),this.resizeHandler()}setupUI(){this.previewDialog=this.shadowRoot.querySelector(".preview-dialog"),this.previewDialog!=null&&setTimeout(()=>{this.previewDialog?.show()}),this._previewTitle=this.shadowRoot.querySelector(".preview-title")??(()=>{throw new Error(`${this.constructor.name}: .preview-title not found`)})(),this._previewSub=this.shadowRoot.querySelector(".preview-sub")??(()=>{throw new Error(`${this.constructor.name}: .preview-sub not found`)})(),this._applyBtn=this.shadowRoot.querySelector(".apply-btn")??(()=>{throw new Error(`${this.constructor.name}: .apply-btn not found`)})()}setupCube(){const t=Object.keys(ga).length;this._cubeMaterials=Array.from({length:t},(e,i)=>{const n=this._getThemeIdForFace(i),s=this._resolveThemeFaceVisual(n),a=new hA({color:"#ece9e4"});return this._setMaterialTexture(a,n,s),a}),this._cubeGeometry=new vs(ws.CUBE_SIDE_LENGTH,ws.CUBE_SIDE_LENGTH,ws.CUBE_SIDE_LENGTH),this._cube=new mi(this._cubeGeometry,this._cubeMaterials),this._cube.rotation.x=this._rotX,this._cube.rotation.y=this._rotY,this._cube.translateY(1.25),this._scene.add(this._cube)}resizeHandler=()=>{const t=()=>{const e=this._root.clientWidth,i=this._root.clientHeight;e===0||i===0||(this._renderer.setSize(e,i,!1),this._camera.aspect=e/i,this._camera.updateProjectionMatrix(),this._updateCameraForLayout(),this._updatePanelPosition())};this._resizeObserver=new ResizeObserver(t),this._resizeObserver.observe(this._root),t()};setupApplyButton(){this._applyBtn.addEventListener(fr.CLICK,this._handleApplyClick)}setupConfirmationDialog(){this._confirmationDialog.addEventListener(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_CONFIRM,this._handleConfirmation),this._confirmationDialog.addEventListener(Yi.COMPONENT_CUSTOM_MESSAGES.CONFIRMATION_DIALOG_UNDO,this._handleConfirmationCancel)}select(t){if(this._isInitialized===!1){this.selected=t,this.selectedTmp=t;return}if(this.options.has(t)===!1){console.warn(`${this.constructor.name}: Theme '${t}' not found`);return}t!==this.selected&&(this.selected=t,this.selectedTmp=t,this._syncRotationToSelected(),this._updatePreviewDialog(t),this._stopAutoSpinFromInteraction())}_syncRotationToSelected(){const e=[...this.options].indexOf(this.selected);if(e<0)return;const i=Object.values(ga)[e%Object.keys(ga).length],n=new F(0,0,1),s=new as;s.setFromUnitVectors(i,n);const a=new fi;a.setFromQuaternion(s),this._rotX=a.x,this._rotY=a.y,this._rotZ=a.z,this._currentFaceThemeId=this.selected}_handleApplyClick=()=>{this._applyTheme()};_applyTheme(){if(this._currentFaceThemeId==null)return;const t=this._resolveThemeFaceVisual(this._currentFaceThemeId);this._confirmationDialog.value=this._currentFaceThemeId,this._confirmationDialog.headline="Apply theme?",this._confirmationDialog.text=`Are you sure you want to apply the theme ${t.name}?`,this._confirmationDialog.showModal(),this._isConfirmationDialogOpen=!0,this._stopAutoSpinFromInteraction()}_updatePreviewDialog(t){const e=this._resolveThemeFaceVisual(t),i=t===this.selected;this._previewTitle.textContent=`${e.icon} ${e.name}`,this._previewSub.textContent=e.description,this._applyBtn.disabled=i,this._applyBtn.textContent=i?"Already active":"Apply",this._applyBtn.title=i?"Already the active theme":"Apply this theme"}_animate=()=>{this._animationFrameId=requestAnimationFrame(this._animate);try{if(!this._isInitialized)return;const t=this._clock.getElapsedTime(),e=t-this._lastTime;this._lastTime=t;const i=Math.min(Math.max(e,0),1/24);!this._isDragging&&!this._isConfirmationDialogOpen&&this._updateIdleAutoSpin(i),this._cube.rotation.x=this._rotX,this._cube.rotation.y=this._rotY,this._cube.rotation.z=this._rotZ;const n=this._getFrontFaceIndex(),s=this._getThemeIdForFace(n);s!==this._currentFaceThemeId&&(this._currentFaceThemeId=s,this._updatePreviewDialog(s),this.selectedTmp=s,FA(s)),this._renderer.render(this._scene,this._camera)}catch(t){console.error("Animation loop error:",t),cancelAnimationFrame(this._animationFrameId),this._animationFrameId=0}};_updateIdleAutoSpin(t){this._idleSeconds+=t,!this._autoSpinEnabled&&this._idleSeconds>=QI&&(this._autoSpinEnabled=!0,this._autoVelX=.0015,this._autoVelY=.0015*(1+Math.sqrt(5))/2),this._autoSpinEnabled&&(this._rotX+=this._autoVelX,this._rotY+=this._autoVelY,this._rotX>Math.PI/2.2&&(this._autoVelX=-Math.abs(this._autoVelX)),this._rotX<-Math.PI/2.2&&(this._autoVelX=Math.abs(this._autoVelX)))}_getFrontFaceIndex(){this._camera.getWorldDirection(this._tmpCamDir),this._tmpCamDir.negate();const t=Object.values(ga);let e=-1,i=-1/0;for(let n=0;n<t.length;n+=1){this._tmpWorldNormal.copy(t[n]).applyQuaternion(this._cube.quaternion);const s=this._tmpWorldNormal.dot(this._tmpCamDir);s>i&&(i=s,e=n)}return e}_updateCameraForLayout(){this._camera.position.set(0,.9,8),this._camera.lookAt(0,0,0)}_updatePanelPosition(){}_setMaterialTexture(t,e,i){const n=this._themeTextures[e];if(n==null||n.length===0){t.map?.dispose(),t.map=this._createFallbackFaceTexture(i),t.needsUpdate=!0;return}ws.textureLoader.load(n,s=>{s.colorSpace=_e,s.needsUpdate=!0,t.map?.dispose(),t.map=s,t.needsUpdate=!0},void 0,()=>{t.map?.dispose(),t.map=this._createFallbackFaceTexture(i),t.needsUpdate=!0})}_createFallbackFaceTexture(t){const i=document.createElement("canvas");i.width=768,i.height=768;const n=i.getContext("2d");if(n==null){const o=new Mh(i);return o.colorSpace=_e,o}const s=n.createLinearGradient(0,0,768,768);s.addColorStop(0,"#ece9e4"),s.addColorStop(1,"#ddd9d2"),n.fillStyle=s,n.fillRect(0,0,768,768),n.fillStyle="rgba(0, 0, 0, 0.04)",n.beginPath(),n.roundRect(48,48,672,672,28),n.fill(),n.strokeStyle="#f3f3f3",n.lineWidth=6,n.beginPath(),n.roundRect(48,48,672,672,28),n.stroke(),n.fillStyle="#6366f1",n.fillRect(48,48,672,6),n.fillStyle="#141414",n.font="140px serif",n.textAlign="center",n.textBaseline="middle",n.fillText(t.icon,768/2,768/2-70),n.font="bold 72px sans-serif",n.fillText(t.name,768/2,768/2+80,648);const a=new Mh(i);return a.colorSpace=_e,a.needsUpdate=!0,a}_getThemeIdForFace(t){const e=[...this.options];return e.length===0?me.DARK:e[t%e.length]??me.DARK}_stopAutoSpinFromInteraction(){this._idleSeconds=0,this._autoSpinEnabled=!1,this._autoVelX=0,this._autoVelY=0}_onPointerDown=t=>{this._isDragging=!0,this._dragPointerId=t.pointerId,this._lastPointerX=t.clientX,this._lastPointerY=t.clientY,this._canvas.classList.add("dragging"),this._stopAutoSpinFromInteraction(),this._canvas.setPointerCapture(t.pointerId)};_onPointerMove=t=>{if(!this._isDragging||this._dragPointerId!==t.pointerId)return;const e=t.clientX-this._lastPointerX,i=t.clientY-this._lastPointerY;this._rotY+=e*.008,this._rotX+=i*.008,this._lastPointerX=t.clientX,this._lastPointerY=t.clientY,this._stopAutoSpinFromInteraction()};_onPointerUp=t=>{this._dragPointerId===t.pointerId&&(this._isDragging=!1,this._dragPointerId=null,this._canvas.classList.remove("dragging"),this._idleSeconds=0)};_bindEvents(){this._canvas.addEventListener(Vi.POINTER_DOWN,this._onPointerDown),this._canvas.addEventListener(Vi.POINTER_MOVE,this._onPointerMove),this._applyBtn.addEventListener(fr.CLICK,this._handleApplyClick),window.addEventListener(Vi.POINTER_UP,this._onPointerUp),window.addEventListener(Vi.POINTER_CANCEL,this._onPointerUp)}_unbindEvents(){this._canvas?.removeEventListener(Vi.POINTER_DOWN,this._onPointerDown),this._canvas?.removeEventListener(Vi.POINTER_MOVE,this._onPointerMove),this._applyBtn?.removeEventListener(fr.CLICK,this._handleApplyClick),window.removeEventListener(Vi.POINTER_UP,this._onPointerUp),window.removeEventListener(Vi.POINTER_CANCEL,this._onPointerUp)}_handleConfirmation=()=>{this.selectedTmp!==this.selected&&(this.dispatchEvent(new CustomEvent(dc.THEME_CHANGE_CONFIRMED,{detail:{value:this.selectedTmp},bubbles:!0,composed:!0})),this._isConfirmationDialogOpen=!1,this._idleSeconds=0)};_handleConfirmationCancel=()=>{this._isConfirmationDialogOpen=!1};_resolveThemeFaceVisual(t){return Ec.get(t)}}const qI=Object.freeze(Object.defineProperty({__proto__:null,COMPONENT_CUSTOM_MESSAGES:dc,OBSERVED_ATTRIBUTES:pa,ThemePickerComponent:ws,selector:"theme-picker"},Symbol.toStringTag,{value:"Module"}));ei.APPLICATION_NAME=_s,ei.CUSTOM_MESSAGES=Ca,ei.LanguagePicker=XI,ei.THEME_TEXTURES_MAPPER=Oc,ei.ThemePicker=qI,ei.WebComponentsRegistry=xc,Object.defineProperty(ei,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@albi_scando/as-design-system-threejs-lib",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.12",
|
|
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.
|
|
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",
|