messages implemented

This commit is contained in:
2026-02-26 21:12:32 +01:00
parent d0aefc5ddc
commit 15b7b77d20
168 changed files with 14728 additions and 6786 deletions

View File

@@ -57,7 +57,7 @@ import './lib/nav-context.js';
if (except && dropdown === except) return;
var menu = dropdown.querySelector('[data-dropdown-menu]');
var toggle = dropdown.querySelector('[data-dropdown-toggle]');
if (menu) menu.classList.add('hidden');
if (menu) menu.classList.remove('is-open');
setExpanded(toggle, false);
// Close any submenus
@@ -75,14 +75,14 @@ import './lib/nav-context.js';
var toggle = dropdown.querySelector('[data-dropdown-toggle]');
if (!menu || !toggle) return;
closeAllDropdowns(dropdown);
menu.classList.remove('hidden');
menu.classList.add('is-open');
setExpanded(toggle, true);
}
function closeDropdown(dropdown) {
var menu = dropdown.querySelector('[data-dropdown-menu]');
var toggle = dropdown.querySelector('[data-dropdown-toggle]');
if (menu) menu.classList.add('hidden');
if (menu) menu.classList.remove('is-open');
setExpanded(toggle, false);
}
@@ -91,14 +91,14 @@ import './lib/nav-context.js';
var toggle = dropdown.querySelector('[data-dropdown-toggle]');
if (!menu || !toggle) return;
var isOpen = !menu.classList.contains('hidden');
var isOpen = menu.classList.contains('is-open');
closeAllDropdowns(isOpen ? null : dropdown);
if (isOpen) {
menu.classList.add('hidden');
menu.classList.remove('is-open');
setExpanded(toggle, false);
} else {
menu.classList.remove('hidden');
menu.classList.add('is-open');
setExpanded(toggle, true);
}
}
@@ -158,15 +158,23 @@ import './lib/nav-context.js';
if (!menu) return;
// treat this pair (toggle + menu) similarly to our dropdown API
var isOpen = !menu.classList.contains('hidden');
var isOpen = menu.classList.contains('is-open');
// close other dropdowns
closeAllDropdowns();
// also close other legacy (data-dd) menus
document.querySelectorAll('[data-dd]').forEach(function (other) {
if (other === legacyToggle) return;
var otherId = other.getAttribute('data-dd');
var otherMenu = otherId ? document.getElementById('dd-' + otherId) : null;
if (otherMenu) otherMenu.classList.remove('is-open');
setExpanded(other, false);
});
if (isOpen) {
menu.classList.add('hidden');
menu.classList.remove('is-open');
setExpanded(legacyToggle, false);
} else {
menu.classList.remove('hidden');
menu.classList.add('is-open');
setExpanded(legacyToggle, true);
}
@@ -249,7 +257,7 @@ import './lib/nav-context.js';
if (el.hasAttribute && el.hasAttribute('data-dropdown')) {
var menu = el.querySelector('[data-dropdown-menu]');
var toggle = el.querySelector('[data-dropdown-toggle]');
if (menu) menu.classList.add('hidden');
if (menu) menu.classList.remove('is-open');
setExpanded(toggle, false);
// also close submenus inside
el.querySelectorAll('[data-submenu-menu]').forEach(function (sm) {
@@ -268,7 +276,7 @@ import './lib/nav-context.js';
}
// hide the element if possible
try { menuEl.classList.add('hidden'); } catch (e) {}
try { menuEl.classList.remove('is-open'); } catch (e) {}
// Try to map back to a toggle: id like dd-name -> data-dd="name"
if (menuEl.id && menuEl.id.indexOf('dd-') === 0) {
@@ -302,7 +310,15 @@ import './lib/nav-context.js';
// when pointer enters either toggle or menu, open
function enter() {
clearHoverTimer(menu);
menu.classList.remove('hidden');
// Instantly close any other open legacy dropdown to prevent overlap
document.querySelectorAll('[data-dd]').forEach(function (other) {
if (other === el) return;
var otherId = other.getAttribute('data-dd');
var otherMenu = otherId ? document.getElementById('dd-' + otherId) : null;
if (otherMenu) otherMenu.classList.remove('is-open');
setExpanded(other, false);
});
menu.classList.add('is-open');
setExpanded(el, true);
}