ui/theme-toggle
- ui/theme-toggle
- static
- inner
ui/theme-toggle.initializer
Theme Toggle Component Initializer
Kind: static constant of ui/theme-toggle
ui/theme-toggle.defaults
Default Options
- Can be overridden using data-attributes
Kind: static constant of ui/theme-toggle
ui/theme-toggle.setDefaults(options)
Kind: static method of ui/theme-toggle
Param | Type | Description |
---|---|---|
options | Object |
Change options used as default for dialogs, can then be overridden by data attribute settings on element |
ui/theme-toggle.init()
Initialize everything in document
- This will only initialize elements once, it is safe to call on page changes
Kind: static method of ui/theme-toggle
ui/theme-toggle.setupToggle(toggle)
Sets up a single toggle
Kind: static method of ui/theme-toggle
Param | Type | Description |
---|---|---|
toggle | HTMLElement |
A toggle to be setup |
setupToggle~toggleState()
Instance function to get the next theme in cycle
Kind: inner method of setupToggle
setupToggle~onToggleClick()
Handler for click for both toggle and remote toggles
Kind: inner method of setupToggle
setupToggle~attachRemotes()
Utility to attach remote handlers
- Used initially and when page is modified
Kind: inner method of setupToggle
setupToggle~cleanupRemotes()
This only cleans up remotes that are still in DOM
- For ones that have been removed we don't store any references to them
Kind: inner method of setupToggle
setupToggle~destroy()
Function to cleanup listeners and remove init attributes
Kind: inner method of setupToggle
ui/theme-toggle~setState()
Change the state of target/toggle
Kind: inner method of ui/theme-toggle
ui/theme-toggle~resolveInitial() ⇒ String
Function determines what the initial state is
- Check OS preference, saved preference, or initialState depending on options
Kind: inner method of ui/theme-toggle
Returns: String
- The resolved initial theme's key
ui/theme-toggle~getMatchingThemeQuery() ⇒ String
Check each theme for a matching media query
Kind: inner method of ui/theme-toggle
Returns: String
- Matching theme key
ui/theme-toggle~getNextThemeKey()
Get the next key in the themes based on the currentKey
Kind: inner method of ui/theme-toggle
ui/theme-toggle~getOtherThemes()
Get all other theme object except the current
Kind: inner method of ui/theme-toggle
ui/theme-toggle~concatThemeClasses()
Concatenates multiple class properties into one array
Kind: inner method of ui/theme-toggle
ui/theme-toggle~getStorageKey()
Creates the storage key (either prefix or prefix with group name)
Kind: inner method of ui/theme-toggle