PrivateconstructorPrivate constructor (singleton pattern)
Private StaticinstancePrivatethemesMap of registered themes by ID
PrivatecurrentCurrently active theme
PrivateobserversTheme change observers
PrivateglassCleanup function for the glass refraction observer
PrivatependingHandle for the requestAnimationFrame call that defers
injectGlassRefractionLayers() until the next frame. Tracked so that a
dispose() racing the deferred injection can cancel it — otherwise the
rAF fires after teardown and re-injects DOM that nothing will clean up.
StaticgetGet ThemeManager singleton instance
StaticdisposeDispose the current instance and clear the singleton slot.
Call this on app shutdown (so the next getInstance() builds a fresh
manager) or between tests (to isolate state). The instance reference is
cleared; the next getInstance() will lazily construct a new one.
Dispose the theme manager and clean up all resources
This method:
After calling dispose(), the ThemeManager instance cannot be reused.
Get a theme by ID
Theme ID
Theme or undefined if not found
Subscribe to theme changes
Callback function called when theme changes
Unsubscribe function
PrivateinitializeInitialize theme system (load saved or default theme)
PrivateapplyApply a theme to the DOM by injecting CSS variables
Theme to apply
PrivateclearClear all existing theme CSS variables
PrivatethemeBuild the flat --luxar-* -> CSS-value map for a theme.
Numbers (font weights, line heights, opacity, z-index) are stringified here. Optional theme fields that resolve to undefined are kept in the map and skipped at write time, so variables only land in the DOM when the theme actually defines them.
PrivatesetSet CSS custom properties from theme.
Iterates the flat variable map from themeToCSSVariables; entries
with undefined values are skipped, preserving the existing behavior of
not setting properties for unset optional theme fields.
Document root element
Theme to inject
PrivatenotifyPrivatesaveSave current theme to localStorage
Theme ID to save
PrivateloadLoad saved theme from localStorage
Saved theme ID or null
ThemeManager singleton class
Manages all themes and handles runtime theme switching by injecting CSS custom properties into the document root.