Add root login compatibility wrappers
This commit is contained in:
@@ -0,0 +1,129 @@
|
|||||||
|
(function initHelpIconOverlayModule() {
|
||||||
|
const CLOSE_HANDLERS = {
|
||||||
|
'.sg-pulldown-demo': (root) => {
|
||||||
|
root.querySelectorAll('.sg-pulldown-demo').forEach((demo) => {
|
||||||
|
const trigger = demo.querySelector('.sg-pulldown-demo__trigger');
|
||||||
|
demo.dataset.open = 'false';
|
||||||
|
if (trigger) {
|
||||||
|
trigger.setAttribute('aria-expanded', 'false');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
'.sg-sandwich-menu-wrap': (root) => {
|
||||||
|
root.querySelectorAll('.sg-sandwich-menu-wrap').forEach((wrap) => {
|
||||||
|
const button = wrap.querySelector('.sg-sandwich-button');
|
||||||
|
wrap.dataset.open = 'false';
|
||||||
|
if (button) {
|
||||||
|
button.setAttribute('aria-expanded', 'false');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const getViewportWidth = () => {
|
||||||
|
if (window.visualViewport && typeof window.visualViewport.width === 'number') {
|
||||||
|
return window.visualViewport.width;
|
||||||
|
}
|
||||||
|
return window.innerWidth;
|
||||||
|
};
|
||||||
|
|
||||||
|
const getSafeInsetPx = () => {
|
||||||
|
const rootStyles = getComputedStyle(document.documentElement);
|
||||||
|
const spacingSmallRaw = rootStyles.getPropertyValue('--spacing-small').trim();
|
||||||
|
const rootFontSize = parseFloat(rootStyles.fontSize) || 16;
|
||||||
|
const spacingSmallValue = parseFloat(spacingSmallRaw);
|
||||||
|
if (Number.isNaN(spacingSmallValue)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (spacingSmallRaw.endsWith('rem')) {
|
||||||
|
return spacingSmallValue * rootFontSize;
|
||||||
|
}
|
||||||
|
return spacingSmallValue;
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeAllHelpIcons = (root) => {
|
||||||
|
root.querySelectorAll('.sg-help-icon-wrap').forEach((wrap) => {
|
||||||
|
const button = wrap.querySelector('.sg-help-icon');
|
||||||
|
const panel = wrap.querySelector('.sg-help-icon-panel');
|
||||||
|
wrap.dataset.open = 'false';
|
||||||
|
if (panel) {
|
||||||
|
panel.style.removeProperty('transform');
|
||||||
|
}
|
||||||
|
if (button) {
|
||||||
|
button.setAttribute('aria-expanded', 'false');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
window.sgInitHelpIconOverlays = (options = {}) => {
|
||||||
|
const root = options.root || document;
|
||||||
|
const closeOnOpenSelectors = options.closeOnOpenSelectors || [];
|
||||||
|
const outsideClickIgnoreSelectors = options.outsideClickIgnoreSelectors || [];
|
||||||
|
|
||||||
|
root.querySelectorAll('.sg-help-icon-wrap').forEach((wrap) => {
|
||||||
|
if (wrap.dataset.helpIconInit === 'true') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wrap.dataset.helpIconInit = 'true';
|
||||||
|
|
||||||
|
const button = wrap.querySelector('.sg-help-icon');
|
||||||
|
const panel = wrap.querySelector('.sg-help-icon-panel');
|
||||||
|
if (!button || !panel) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
button.addEventListener('click', (event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
const nextState = wrap.dataset.open !== 'true';
|
||||||
|
|
||||||
|
closeAllHelpIcons(root);
|
||||||
|
closeOnOpenSelectors.forEach((selector) => {
|
||||||
|
const handler = CLOSE_HANDLERS[selector];
|
||||||
|
if (handler) {
|
||||||
|
handler(root);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!nextState) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wrap.dataset.align = 'left';
|
||||||
|
wrap.dataset.open = 'true';
|
||||||
|
button.setAttribute('aria-expanded', 'true');
|
||||||
|
|
||||||
|
const viewportWidth = getViewportWidth();
|
||||||
|
const panelRect = panel.getBoundingClientRect();
|
||||||
|
if (panelRect.right > viewportWidth) {
|
||||||
|
wrap.dataset.align = 'right';
|
||||||
|
}
|
||||||
|
const alignedPanelRect = panel.getBoundingClientRect();
|
||||||
|
if (alignedPanelRect.left < 0) {
|
||||||
|
wrap.dataset.align = 'left';
|
||||||
|
}
|
||||||
|
|
||||||
|
const clampedRect = panel.getBoundingClientRect();
|
||||||
|
const safeInset = getSafeInsetPx();
|
||||||
|
let shiftX = 0;
|
||||||
|
if (clampedRect.right > (viewportWidth - safeInset)) {
|
||||||
|
shiftX -= clampedRect.right - (viewportWidth - safeInset);
|
||||||
|
}
|
||||||
|
if ((clampedRect.left + shiftX) < safeInset) {
|
||||||
|
shiftX += safeInset - (clampedRect.left + shiftX);
|
||||||
|
}
|
||||||
|
if (shiftX !== 0) {
|
||||||
|
panel.style.transform = `translateX(${shiftX}px)`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener('click', (event) => {
|
||||||
|
const isInsideIgnoredZone = ['.sg-help-icon-wrap', ...outsideClickIgnoreSelectors]
|
||||||
|
.some((selector) => event.target.closest(selector));
|
||||||
|
if (isInsideIgnoredZone) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
closeAllHelpIcons(root);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})();
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
@import url("/public/assets/styles.css");
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Temporary Migration Artifacts
|
||||||
|
|
||||||
|
Stand: 2026-06-15
|
||||||
|
|
||||||
|
Diese Artefakte sind eine minimale Kompatibilitaetsschicht, damit die Applikation auch dann unter dem aktuellen Webroot laeuft, wenn der Server noch nicht sauber auf `public/` zeigt.
|
||||||
|
|
||||||
|
## Aktuell vorhanden
|
||||||
|
|
||||||
|
- Root-`index.php` als Delegation auf `public/index.php`
|
||||||
|
- Root-`logout.php` als Delegation auf `public/logout.php`
|
||||||
|
- Root-`assets/styles.css` als Import auf `public/assets/styles.css`
|
||||||
|
- Root-`assets/help-icon-overlays.js` als Kopie des vorhandenen Helferskripts
|
||||||
|
|
||||||
|
## Rueckbau
|
||||||
|
|
||||||
|
Sobald der Webroot sauber auf `public/` zeigt, koennen diese Wrapper wieder entfernt werden.
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
require_once __DIR__ . '/public/index.php';
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
require_once __DIR__ . '/public/logout.php';
|
||||||
Reference in New Issue
Block a user