| 
									
										
										
										
											2024-01-15 19:42:15 +01:00
										 |  |  | import * as plugins from './00plugins.js'; | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  | import { zIndexRegistry } from './00zindex.js'; | 
					
						
							|  |  |  | import { cssGeistFontFamily } from './00fonts.js'; | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  | import { | 
					
						
							|  |  |  |   cssManager, | 
					
						
							|  |  |  |   css, | 
					
						
							| 
									
										
										
										
											2023-08-07 20:02:18 +02:00
										 |  |  |   type CSSResult, | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |   customElement, | 
					
						
							|  |  |  |   DeesElement, | 
					
						
							|  |  |  |   domtools, | 
					
						
							|  |  |  |   html, | 
					
						
							|  |  |  |   property, | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |   state, | 
					
						
							| 
									
										
										
										
											2023-08-07 19:13:29 +02:00
										 |  |  | } from '@design.estate/dees-element'; | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  | import { DeesWindowLayer } from './dees-windowlayer.js'; | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  | import './dees-icon.js'; | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-17 19:28:11 +02:00
										 |  |  | @customElement('dees-mobilenavigation') | 
					
						
							|  |  |  | export class DeesMobilenavigation extends DeesElement { | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  |   // STATIC
 | 
					
						
							|  |  |  |   public static demo = () => html`
 | 
					
						
							| 
									
										
										
										
											2023-09-04 19:28:50 +02:00
										 |  |  |     <dees-button @click=${() => { | 
					
						
							| 
									
										
										
										
											2023-09-13 13:41:56 +02:00
										 |  |  |       DeesMobilenavigation.createAndShow([ | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  |         { | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |           name: 'Dashboard', | 
					
						
							|  |  |  |           iconName: 'lucide:layout-dashboard', | 
					
						
							| 
									
										
										
										
											2023-09-13 13:41:56 +02:00
										 |  |  |           action: async (deesMobileNav) => { | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |             console.log('Navigate to dashboard'); | 
					
						
							|  |  |  |             return null; | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           name: 'Profile', | 
					
						
							|  |  |  |           iconName: 'lucide:user', | 
					
						
							|  |  |  |           action: async (deesMobileNav) => { | 
					
						
							|  |  |  |             console.log('Navigate to profile'); | 
					
						
							|  |  |  |             return null; | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           name: 'Settings', | 
					
						
							|  |  |  |           iconName: 'lucide:settings', | 
					
						
							|  |  |  |           action: async (deesMobileNav) => { | 
					
						
							|  |  |  |             console.log('Navigate to settings'); | 
					
						
							|  |  |  |             return null; | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { divider: true } as any, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           name: 'Help', | 
					
						
							|  |  |  |           iconName: 'lucide:help-circle', | 
					
						
							|  |  |  |           action: async (deesMobileNav) => { | 
					
						
							|  |  |  |             console.log('Show help'); | 
					
						
							|  |  |  |             return null; | 
					
						
							|  |  |  |           }, | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           name: 'Sign Out', | 
					
						
							|  |  |  |           iconName: 'lucide:log-out', | 
					
						
							|  |  |  |           action: async (deesMobileNav) => { | 
					
						
							|  |  |  |             console.log('Sign out'); | 
					
						
							| 
									
										
										
										
											2023-09-13 13:41:56 +02:00
										 |  |  |             return null; | 
					
						
							| 
									
										
										
										
											2023-09-04 19:28:50 +02:00
										 |  |  |           }, | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  |         }, | 
					
						
							| 
									
										
										
										
											2023-09-04 19:28:50 +02:00
										 |  |  |       ]); | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |     }}>Open Mobile Navigation</dees-button> | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  |   `;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-17 19:28:11 +02:00
										 |  |  |   private static singletonRef: DeesMobilenavigation; | 
					
						
							| 
									
										
										
										
											2023-09-13 13:41:56 +02:00
										 |  |  |   public static async createAndShow(menuItemsArg: plugins.tsclass.website.IMenuItem<DeesMobilenavigation>[]) { | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |     if (!this.singletonRef) { | 
					
						
							| 
									
										
										
										
											2022-08-17 19:28:11 +02:00
										 |  |  |       this.singletonRef = new DeesMobilenavigation(); | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |       document.body.append(this.singletonRef); | 
					
						
							|  |  |  |       await this.singletonRef.init(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     this.singletonRef.menuItems = menuItemsArg; | 
					
						
							|  |  |  |     await this.singletonRef.readyDeferred.promise; | 
					
						
							|  |  |  |     this.singletonRef.show(); | 
					
						
							|  |  |  |     return this.singletonRef; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // INSTANCE
 | 
					
						
							|  |  |  |   @property({ | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |     type: String, | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  |   }) | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |   public heading: string = `Menu`; | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   @property({ | 
					
						
							|  |  |  |     type: Array, | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |   }) | 
					
						
							|  |  |  |   public menuItems: plugins.tsclass.website.IMenuItem[] = []; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |   @state() | 
					
						
							|  |  |  |   private mobileNavZIndex: number = 1000; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 20:02:18 +02:00
										 |  |  |   readyDeferred: plugins.smartpromise.Deferred<any> = domtools.plugins.smartpromise.defer(); | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  |   constructor() { | 
					
						
							|  |  |  |     super(); | 
					
						
							| 
									
										
										
										
											2022-08-18 02:15:41 +02:00
										 |  |  |     /* this.init().then(() => { | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  |       this.show(); | 
					
						
							| 
									
										
										
										
											2022-08-18 02:15:41 +02:00
										 |  |  |     }); */ | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |   /** | 
					
						
							|  |  |  |    * inits the mobile navigation | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   public async init() { | 
					
						
							|  |  |  |     await this.updateComplete; | 
					
						
							|  |  |  |     this.readyDeferred.resolve(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   public static styles = [ | 
					
						
							|  |  |  |     cssManager.defaultStyles, | 
					
						
							|  |  |  |     css`
 | 
					
						
							|  |  |  |       :host { | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |         font-family: ${cssGeistFontFamily}; | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .main { | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |         transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |         will-change: transform; | 
					
						
							|  |  |  |         position: fixed; | 
					
						
							|  |  |  |         height: 100vh; | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |         width: 100%; | 
					
						
							|  |  |  |         max-width: 320px; | 
					
						
							|  |  |  |         transform: translateX(100%); | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('#09090b', '#fafafa')}; | 
					
						
							|  |  |  |         z-index: var(--z-index); | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |         opacity: 0; | 
					
						
							|  |  |  |         right: 0px; | 
					
						
							| 
									
										
										
										
											2022-08-17 19:56:22 +02:00
										 |  |  |         top: 0px; | 
					
						
							|  |  |  |         bottom: 0px; | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |         background: ${cssManager.bdTheme('#ffffff', '#09090b')}; | 
					
						
							|  |  |  |         border-left: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')}; | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |         pointer-events: none; | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |         box-shadow: ${cssManager.bdTheme( | 
					
						
							|  |  |  |           '-20px 0 25px -5px rgba(0, 0, 0, 0.1), -10px 0 10px -5px rgba(0, 0, 0, 0.04)', | 
					
						
							|  |  |  |           '-20px 0 25px -5px rgba(0, 0, 0, 0.3), -10px 0 10px -5px rgba(0, 0, 0, 0.2)' | 
					
						
							|  |  |  |         )}; | 
					
						
							|  |  |  |         display: flex; | 
					
						
							|  |  |  |         flex-direction: column; | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .main.show { | 
					
						
							|  |  |  |         pointer-events: all; | 
					
						
							|  |  |  |         transform: translateX(0px); | 
					
						
							|  |  |  |         opacity: 1; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |       .header { | 
					
						
							|  |  |  |         padding: 24px; | 
					
						
							|  |  |  |         border-bottom: 1px solid ${cssManager.bdTheme('#e5e7eb', '#27272a')}; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .heading { | 
					
						
							|  |  |  |         font-size: 18px; | 
					
						
							|  |  |  |         font-weight: 600; | 
					
						
							|  |  |  |         letter-spacing: -0.02em; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('#09090b', '#fafafa')}; | 
					
						
							|  |  |  |         margin: 0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .menu-container { | 
					
						
							|  |  |  |         flex: 1; | 
					
						
							|  |  |  |         overflow-y: auto; | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |         padding: 8px; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |       .menuItem { | 
					
						
							|  |  |  |         display: flex; | 
					
						
							|  |  |  |         align-items: center; | 
					
						
							|  |  |  |         gap: 12px; | 
					
						
							|  |  |  |         padding: 12px 16px; | 
					
						
							|  |  |  |         margin-bottom: 2px; | 
					
						
							|  |  |  |         border-radius: 6px; | 
					
						
							|  |  |  |         font-size: 14px; | 
					
						
							|  |  |  |         font-weight: 500; | 
					
						
							|  |  |  |         cursor: pointer; | 
					
						
							|  |  |  |         transition: all 0.15s ease; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('#71717a', '#a1a1aa')}; | 
					
						
							|  |  |  |         position: relative; | 
					
						
							|  |  |  |         user-select: none; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |       .menuItem:hover { | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |         background: ${cssManager.bdTheme('#f4f4f5', '#27272a')}; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('#09090b', '#fafafa')}; | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |       .menuItem:active { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('#e5e7eb', '#3f3f46')}; | 
					
						
							|  |  |  |         transform: scale(0.98); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .menuItem dees-icon { | 
					
						
							|  |  |  |         flex-shrink: 0; | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('#71717a', '#71717a')}; | 
					
						
							|  |  |  |         transition: color 0.15s ease; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .menuItem:hover dees-icon { | 
					
						
							|  |  |  |         color: ${cssManager.bdTheme('#09090b', '#fafafa')}; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .menuItem-text { | 
					
						
							|  |  |  |         flex: 1; | 
					
						
							|  |  |  |         letter-spacing: -0.01em; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .menuItem-divider { | 
					
						
							|  |  |  |         height: 1px; | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('#e5e7eb', '#27272a')}; | 
					
						
							|  |  |  |         margin: 8px 16px; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Mobile responsiveness */ | 
					
						
							|  |  |  |       @media (max-width: 400px) { | 
					
						
							|  |  |  |         .main { | 
					
						
							|  |  |  |           max-width: 100vw; | 
					
						
							|  |  |  |           width: 85vw; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Animation for menu items */ | 
					
						
							|  |  |  |       @keyframes slideInRight { | 
					
						
							|  |  |  |         from { | 
					
						
							|  |  |  |           opacity: 0; | 
					
						
							|  |  |  |           transform: translateX(20px); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |         to { | 
					
						
							|  |  |  |           opacity: 1; | 
					
						
							|  |  |  |           transform: translateX(0); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .main.show .menuItem { | 
					
						
							|  |  |  |         animation: slideInRight 0.3s ease-out forwards; | 
					
						
							|  |  |  |         animation-delay: calc(var(--item-index, 0) * 0.05s); | 
					
						
							|  |  |  |         opacity: 0; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       /* Scrollbar styling */ | 
					
						
							|  |  |  |       .menu-container::-webkit-scrollbar { | 
					
						
							|  |  |  |         width: 6px; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .menu-container::-webkit-scrollbar-track { | 
					
						
							|  |  |  |         background: transparent; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .menu-container::-webkit-scrollbar-thumb { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('#e5e7eb', '#3f3f46')}; | 
					
						
							|  |  |  |         border-radius: 3px; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       .menu-container::-webkit-scrollbar-thumb:hover { | 
					
						
							|  |  |  |         background: ${cssManager.bdTheme('#d1d5db', '#52525b')}; | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |     `,
 | 
					
						
							|  |  |  |   ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   public render() { | 
					
						
							|  |  |  |     return html`
 | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |       <style> | 
					
						
							|  |  |  |         .main { | 
					
						
							|  |  |  |           --z-index: ${this.mobileNavZIndex}; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       </style> | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |       <div class="main"> | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |         <div class="header"> | 
					
						
							|  |  |  |           <h2 class="heading">${this.heading}</h2> | 
					
						
							|  |  |  |         </div> | 
					
						
							|  |  |  |         <div class="menu-container"> | 
					
						
							|  |  |  |           ${this.menuItems.map((menuItem, index) => { | 
					
						
							|  |  |  |             if ('divider' in menuItem && menuItem.divider) { | 
					
						
							|  |  |  |               return html`<div class="menuItem-divider"></div>`; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |             return html`
 | 
					
						
							|  |  |  |               <div | 
					
						
							|  |  |  |                 class="menuItem" | 
					
						
							|  |  |  |                 style="--item-index: ${index}" | 
					
						
							|  |  |  |                 @click="${() => { | 
					
						
							|  |  |  |                   this.hide(); | 
					
						
							|  |  |  |                   menuItem.action(this); | 
					
						
							|  |  |  |                 }}" | 
					
						
							|  |  |  |               > | 
					
						
							|  |  |  |                 ${menuItem.iconName ? html`
 | 
					
						
							|  |  |  |                   <dees-icon .icon=${menuItem.iconName} size="20"></dees-icon> | 
					
						
							|  |  |  |                 ` : ''}
 | 
					
						
							|  |  |  |                 <span class="menuItem-text">${menuItem.name}</span> | 
					
						
							|  |  |  |               </div> | 
					
						
							|  |  |  |             `;
 | 
					
						
							|  |  |  |           })} | 
					
						
							|  |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |       </div> | 
					
						
							|  |  |  |     `;
 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   private windowLayer: DeesWindowLayer; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * inits the show | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   public async show() { | 
					
						
							|  |  |  |     const domtools = await this.domtoolsPromise; | 
					
						
							|  |  |  |     const main = this.shadowRoot.querySelector('.main'); | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |      | 
					
						
							|  |  |  |     // Create window layer first (it will get its own z-index)
 | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |     if (!this.windowLayer) { | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |       this.windowLayer = await DeesWindowLayer.createAndShow({ | 
					
						
							|  |  |  |         blur: true, | 
					
						
							|  |  |  |       }); | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |       this.windowLayer.addEventListener('click', () => { | 
					
						
							|  |  |  |         this.hide(); | 
					
						
							|  |  |  |       }); | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |     } else { | 
					
						
							|  |  |  |       document.body.append(this.windowLayer); | 
					
						
							|  |  |  |       await this.windowLayer.show(); | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |      | 
					
						
							|  |  |  |     // Get z-index for mobile nav (will be above window layer)
 | 
					
						
							|  |  |  |     this.mobileNavZIndex = zIndexRegistry.getNextZIndex(); | 
					
						
							|  |  |  |     zIndexRegistry.register(this, this.mobileNavZIndex); | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |     await domtools.convenience.smartdelay.delayFor(10); | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |     main.classList.add('show'); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   /** | 
					
						
							|  |  |  |    * inits the hide function | 
					
						
							|  |  |  |    */ | 
					
						
							|  |  |  |   public async hide() { | 
					
						
							|  |  |  |     const domtools = await this.domtoolsPromise; | 
					
						
							|  |  |  |     const main = this.shadowRoot.querySelector('.main'); | 
					
						
							|  |  |  |     main.classList.remove('show'); | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |      | 
					
						
							|  |  |  |     // Unregister from z-index registry
 | 
					
						
							|  |  |  |     zIndexRegistry.unregister(this); | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     if (this.windowLayer) { | 
					
						
							|  |  |  |       await this.windowLayer.destroy(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-18 02:11:35 +02:00
										 |  |  |   async disconnectedCallback() { | 
					
						
							| 
									
										
										
										
											2025-06-30 13:04:19 +00:00
										 |  |  |     super.disconnectedCallback(); | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     // Cleanup
 | 
					
						
							|  |  |  |     zIndexRegistry.unregister(this); | 
					
						
							|  |  |  |      | 
					
						
							|  |  |  |     if (this.windowLayer) { | 
					
						
							|  |  |  |       await this.windowLayer.destroy(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-08-17 19:27:14 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | } |