@ims360/svelte-ivory 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,7 +4,7 @@ declare class ThemeController {
|
|
|
4
4
|
private currentTheme;
|
|
5
5
|
constructor();
|
|
6
6
|
get theme(): ColorThemePreference;
|
|
7
|
-
get
|
|
7
|
+
get current(): "light" | "dark";
|
|
8
8
|
set theme(value: ColorThemePreference);
|
|
9
9
|
/** Add to hook sequence to enable correct prerendering ot the theme */
|
|
10
10
|
handle: Handle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colorTheme.svelte.d.ts","sourceRoot":"","sources":["../src/lib/colorTheme.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/D,cAAM,eAAe;IACjB,OAAO,CAAC,YAAY,CAA0C;;IAY9D,IAAI,KAAK,
|
|
1
|
+
{"version":3,"file":"colorTheme.svelte.d.ts","sourceRoot":"","sources":["../src/lib/colorTheme.svelte.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAE/D,cAAM,eAAe;IACjB,OAAO,CAAC,YAAY,CAA0C;;IAY9D,IAAI,KAAK,IAWQ,oBAAoB,CATpC;IAED,IAAI,OAAO,qBAKV;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,oBAAoB,EAepC;IAED,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAcZ;CACL;AAED,eAAO,MAAM,UAAU,iBAAwB,CAAC"}
|
|
@@ -17,8 +17,13 @@ class ThemeController {
|
|
|
17
17
|
get theme() {
|
|
18
18
|
return this.currentTheme;
|
|
19
19
|
}
|
|
20
|
-
get
|
|
21
|
-
|
|
20
|
+
get current() {
|
|
21
|
+
if (this.currentTheme === 'dark' || this.currentTheme === 'light')
|
|
22
|
+
return this.currentTheme;
|
|
23
|
+
if (!browser)
|
|
24
|
+
return 'light';
|
|
25
|
+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
26
|
+
return prefersDark ? 'dark' : 'light';
|
|
22
27
|
}
|
|
23
28
|
set theme(value) {
|
|
24
29
|
if (!browser)
|
package/package.json
CHANGED
|
@@ -23,8 +23,11 @@ class ThemeController {
|
|
|
23
23
|
return this.currentTheme;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
get
|
|
27
|
-
return this.currentTheme;
|
|
26
|
+
get current() {
|
|
27
|
+
if (this.currentTheme === 'dark' || this.currentTheme === 'light') return this.currentTheme;
|
|
28
|
+
if (!browser) return 'light';
|
|
29
|
+
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
30
|
+
return prefersDark ? 'dark' : 'light';
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
set theme(value: ColorThemePreference) {
|