zova-module-a-style 5.0.32 → 5.0.35

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-module-a-style",
3
- "version": "5.0.32",
3
+ "version": "5.0.35",
4
4
  "title": "a-style",
5
5
  "zovaModule": {
6
6
  "capabilities": {
@@ -37,5 +37,5 @@
37
37
  "tsc:publish": "npm run clean && tsc -b",
38
38
  "prepublishOnly": "npm run tsc:publish"
39
39
  },
40
- "gitHead": "5fd1484d04f43c3f32e49c989fc55373087a1957"
40
+ "gitHead": "993e48dbb586cd060106cabdeaffcc5df265509f"
41
41
  }
@@ -58,9 +58,12 @@ export class BeanTheme extends BeanModelBase<ScopeModule> {
58
58
  },
59
59
  );
60
60
 
61
- watch([() => this.name, () => this._dark], () => {
62
- this._applyTheme();
63
- });
61
+ if (process.env.CLIENT) {
62
+ watch([() => this.name, () => this._dark], () => {
63
+ this._applyTheme();
64
+ });
65
+ }
66
+
64
67
  // not use watch.immediate for await done
65
68
  await this._applyThemeWrapper();
66
69
  }
@@ -85,6 +88,11 @@ export class BeanTheme extends BeanModelBase<ScopeModule> {
85
88
  const name = this.name;
86
89
  const dark = this._dark;
87
90
  const theme = (await this.bean._getBean(name as any, true)) as ThemeBase;
91
+ if (!theme) {
92
+ this.name = this.scope.config.defaultTheme;
93
+ await this._applyTheme();
94
+ return;
95
+ }
88
96
  const res = await theme.apply({ name, dark });
89
97
  this.token = Cast(res).token;
90
98
  const handler = res.handler ?? this.scope.config.defaultThemeHandler;
@@ -96,6 +104,7 @@ export class BeanTheme extends BeanModelBase<ScopeModule> {
96
104
 
97
105
  toggleDark() {
98
106
  this.darkMode = !this._dark;
107
+ this._updateDark(); // immediate
99
108
  }
100
109
 
101
110
  _getDarkFromDarkMode(mode?: ThemeDarkMode) {