- Add icanhazstring/composer-unused as dev dependency for dependency hygiene checks - Add German documentation (docs/) covering architecture, conventions, workflows, and developer checklists - Add API layer (ApiAuth, ApiBootstrap, ApiResponse), audit, scheduler, custom fields, and SSO services - Add Microsoft OIDC SSO, API token management, and user lifecycle features - Add swagger-ui vendor integration and OpenAPI spec - Add production Docker setup and bin/ scripts - Update composer dependencies, config, templates, and frontend assets throughout Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
72 lines
2.0 KiB
JavaScript
72 lines
2.0 KiB
JavaScript
import { optionalEl, warnOnce } from '../core/app-dom.js';
|
|
|
|
export function initDetailsAsideToggle(options = {}) {
|
|
const {
|
|
buttonSelector = '#toggle-main-content-aside',
|
|
asideSelector = '#app-details-aside-section',
|
|
containerSelector = '.app-details-container',
|
|
storageKey = 'app-details-aside-collapsed'
|
|
} = options;
|
|
|
|
const button = optionalEl(buttonSelector);
|
|
const aside = optionalEl(asideSelector);
|
|
if (!button || !aside) {return;}
|
|
|
|
const container = aside.closest(containerSelector) || document.querySelector(containerSelector);
|
|
if (!container) {
|
|
warnOnce('UI_EL_MISSING', `Missing details container: ${containerSelector}`, { module: 'details-aside' });
|
|
return;
|
|
}
|
|
|
|
if (!button.getAttribute('aria-controls')) {
|
|
button.setAttribute('aria-controls', aside.id || 'app-details-aside-section');
|
|
}
|
|
|
|
const readStored = () => {
|
|
try {
|
|
return window.localStorage.getItem(storageKey);
|
|
} catch (error) {
|
|
return null;
|
|
}
|
|
};
|
|
|
|
const writeStored = (collapsed) => {
|
|
try {
|
|
window.localStorage.setItem(storageKey, collapsed ? '1' : '0');
|
|
} catch (error) {
|
|
// ignore storage errors
|
|
}
|
|
};
|
|
|
|
const applyState = (collapsed, persist = false) => {
|
|
container.classList.toggle('is-aside-collapsed', collapsed);
|
|
aside.hidden = collapsed;
|
|
button.setAttribute('aria-expanded', collapsed ? 'false' : 'true');
|
|
if (persist) {
|
|
writeStored(collapsed);
|
|
}
|
|
};
|
|
|
|
const getInitialState = () => {
|
|
const stored = readStored();
|
|
if (stored === '1' || stored === '0') {
|
|
return stored === '1';
|
|
}
|
|
return false;
|
|
};
|
|
|
|
applyState(getInitialState(), false);
|
|
|
|
button.addEventListener('click', (event) => {
|
|
event.preventDefault();
|
|
const collapsed = !container.classList.contains('is-aside-collapsed');
|
|
applyState(collapsed, true);
|
|
});
|
|
}
|
|
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', () => initDetailsAsideToggle());
|
|
} else {
|
|
initDetailsAsideToggle();
|
|
}
|