zova-module-a-style 5.0.29 → 5.0.32

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.29",
3
+ "version": "5.0.32",
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": "624a81d8b0a58c276dd081ab612e7dcf37bd7f71"
40
+ "gitHead": "5fd1484d04f43c3f32e49c989fc55373087a1957"
41
41
  }
@@ -42,9 +42,8 @@ export class BeanTheme extends BeanModelBase<ScopeModule> {
42
42
  persister: {
43
43
  maxAge: this.scope.config.model.themename.persister.maxAge,
44
44
  deserialize: (value, deserializeDefault) => {
45
- value = deserializeDefault(value);
46
- if (cookieThemeDark && value === 'auto') return cookieThemeDarkDefault;
47
- return value;
45
+ if (cookieThemeDark && value === 'auto') value = cookieThemeDarkDefault;
46
+ return deserializeDefault(value);
48
47
  },
49
48
  },
50
49
  defaultData: cookieThemeDark ? cookieThemeDarkDefault : 'auto',
@@ -63,7 +62,7 @@ export class BeanTheme extends BeanModelBase<ScopeModule> {
63
62
  this._applyTheme();
64
63
  });
65
64
  // not use watch.immediate for await done
66
- await this._applyTheme();
65
+ await this._applyThemeWrapper();
67
66
  }
68
67
 
69
68
  protected __dispose__() {
@@ -74,6 +73,14 @@ export class BeanTheme extends BeanModelBase<ScopeModule> {
74
73
  this._dark = this._getDarkFromDarkMode(this.darkMode);
75
74
  }
76
75
 
76
+ async _applyThemeWrapper() {
77
+ await this._applyTheme();
78
+ if (process.env.SERVER && !this.app.config.ssr.cookieThemeDark) {
79
+ this.toggleDark();
80
+ await this._applyTheme();
81
+ }
82
+ }
83
+
77
84
  async _applyTheme() {
78
85
  const name = this.name;
79
86
  const dark = this._dark;