2591710f09
Extracts setBodyThemeClass into DeepDrftShared.Client/Interop/theme/theme.ts; MainLayout lazy-imports the compiled module and calls it, matching the established knob/parallax IJSObjectReference pattern. DisposeAsync added.
16 lines
677 B
TypeScript
16 lines
677 B
TypeScript
/**
|
|
* theme - body-class helpers for dark-mode theme toggling.
|
|
*
|
|
* Single Responsibility: apply or remove the deepdrft-theme-dark class on
|
|
* document.body so that portaled MudBlazor elements (popovers, menus, selects)
|
|
* inherit --deepdrft-popover-surface from body.deepdrft-theme-dark rather than
|
|
* from :root only. Popovers portal outside the ThemeWrapperClass div, so only
|
|
* a body-level class can reach them.
|
|
*/
|
|
|
|
/** Toggle the deepdrft-theme-dark class on document.body.
|
|
* @param isDark true to add the class, false to remove it. */
|
|
export function setBodyThemeClass(isDark: boolean): void {
|
|
document.body.classList.toggle('deepdrft-theme-dark', isDark);
|
|
}
|