38 lines
1.6 KiB
JavaScript
38 lines
1.6 KiB
JavaScript
/**
|
|
* signFLOW Theme Helper
|
|
* Called from ThemeService (Blazor WASM) to apply theme changes.
|
|
*/
|
|
window.signflowTheme = {
|
|
|
|
apply: function (href, bsTheme, themeName) {
|
|
console.debug('[signflowTheme] apply', themeName, bsTheme);
|
|
|
|
// ── Bootstrap dark mode ─────────────────────────────────────────
|
|
document.documentElement.setAttribute('data-bs-theme', bsTheme);
|
|
|
|
// ── Theme name attribute for CSS overrides ──────────────────────
|
|
// Applied to <html> so any nested selector can use it:
|
|
// [data-sf-theme="blazing-dark"] .sender-dashboard-layout { ... }
|
|
document.documentElement.setAttribute('data-sf-theme', themeName);
|
|
|
|
// ── DevExpress theme CSS link ────────────────────────────────────
|
|
document.querySelectorAll('link[href*="DevExpress.Blazor.Themes"]').forEach(function(el) {
|
|
if (el.id !== 'dx-theme-link') el.parentNode.removeChild(el);
|
|
});
|
|
|
|
let link = document.getElementById('dx-theme-link');
|
|
if (!link) {
|
|
link = document.createElement('link');
|
|
link.id = 'dx-theme-link';
|
|
link.rel = 'stylesheet';
|
|
document.head.appendChild(link);
|
|
}
|
|
|
|
const currentRelative = link.getAttribute('href') || '';
|
|
if (currentRelative !== href) {
|
|
link.setAttribute('href', href);
|
|
}
|
|
}
|
|
};
|
|
|