@3mo/theme
Advanced tools
Comparing version 0.0.13 to 0.0.14
import { LocalStorage } from '@a11d/local-storage'; | ||
export declare const enum Background { | ||
export declare enum Background { | ||
System = "system", | ||
@@ -4,0 +4,0 @@ Light = "light", |
import { LocalStorage } from '@a11d/local-storage'; | ||
export var Background; | ||
(function (Background) { | ||
Background["System"] = "system"; | ||
Background["Light"] = "light"; | ||
Background["Dark"] = "dark"; | ||
})(Background = Background || (Background = {})); | ||
export class BackgroundStorage extends LocalStorage { | ||
constructor() { | ||
super('Theme.Background', "system" /* Background.System */); | ||
super('Theme.Background', Background.System); | ||
window.matchMedia('(prefers-color-scheme: dark)').onchange = () => this.updateAttributeValue(); | ||
@@ -11,7 +17,7 @@ window.matchMedia('(prefers-color-scheme: light)').onchange = () => this.updateAttributeValue(); | ||
get calculatedValue() { | ||
return this.value !== "system" /* Background.System */ | ||
return this.value !== Background.System | ||
? this.value | ||
: window.matchMedia('(prefers-color-scheme: dark)').matches | ||
? "dark" /* Background.Dark */ | ||
: "light" /* Background.Light */; | ||
? Background.Dark | ||
: Background.Light; | ||
} | ||
@@ -18,0 +24,0 @@ updateAttributeValue() { |
{ | ||
"name": "@3mo/theme", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "Tools & tokens for theming 3MO components & applications.", | ||
@@ -5,0 +5,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
77150
259