zova-suite-a-devui 5.0.13 → 5.0.14

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zova-module-a-devui",
3
- "version": "5.0.13",
3
+ "version": "5.0.14",
4
4
  "title": "a-devui",
5
5
  "zovaModule": {
6
6
  "capabilities": {
@@ -31,5 +31,5 @@
31
31
  "dist"
32
32
  ],
33
33
  "scripts": {},
34
- "gitHead": "6ab950f2066f8feb2dfddb94575fcbb2cf07afe7"
34
+ "gitHead": "4cc43868ab30db75353d626c7f80f44085503288"
35
35
  }
@@ -13,16 +13,12 @@ export class LocalSSR extends BeanBase<ScopeModule> {
13
13
  // ssr theme
14
14
  if (process.env.SERVER) {
15
15
  this.ctx.meta.ssr.context.onRendered(() => {
16
- this.ctx.meta.ssr.context._meta.bodyTags += `<script id="__prefersColorSchemeDarkJS">
17
- const __Themes = { 'a-demo.theme.orange': 'orange', 'home-theme.theme.default': '' };
18
- const __names = [];
19
- const __name = __Themes[window.ssr_local_themename];
20
- if (__name) __names.push(__name);
21
- __names.push(window.ssr_local_themedark ? 'dark' : 'light');
22
- const themeName = __names.join('-');
23
- document.body.setAttribute('data-theme', themeName);
24
- document.querySelector('#__prefersColorSchemeDarkJS').remove();
25
- </script>`.replaceAll('\n', '');
16
+ if (!this.app.config.ssr.cookieThemeDark) {
17
+ this.ctx.meta.ssr.context._meta.bodyTags += `<script id="__prefersColorSchemeDarkJS">
18
+ document.body.setAttribute('data-theme', window.ssr_local_themedark_data);
19
+ document.querySelector('#__prefersColorSchemeDarkJS').remove();
20
+ </script>`.replaceAll('\n', '');
21
+ }
26
22
  });
27
23
  }
28
24
  }
@@ -15,13 +15,18 @@ export class ToolThemeHandler extends BeanBase<ScopeModule> implements ThemeHand
15
15
  const themeName = _names.join('-');
16
16
  // data-theme
17
17
  if (process.env.CLIENT) {
18
+ // client
18
19
  const body = window?.document?.body;
19
20
  if (body) {
20
21
  body.setAttribute('data-theme', themeName);
21
22
  }
22
23
  } else {
23
- // meta
24
- this.$useMeta({ bodyAttr: { 'data-theme': themeName } });
24
+ // server
25
+ if (!this.app.config.ssr.cookieThemeDark) {
26
+ this.$useMeta({ bodyAttr: { [`data-ssr-theme-dark-${dark}`]: themeName } });
27
+ } else {
28
+ this.$useMeta({ bodyAttr: { 'data-theme': themeName } });
29
+ }
25
30
  }
26
31
  }
27
32
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "zova-suite-a-devui",
3
- "version": "5.0.13",
3
+ "version": "5.0.14",
4
4
  "title": "a-devui",
5
5
  "type": "module",
6
6
  "description": "devui",
7
7
  "author": "zhennann",
8
8
  "dependencies": {
9
- "zova-module-a-devui": "^5.0.13"
9
+ "zova-module-a-devui": "^5.0.14"
10
10
  },
11
- "gitHead": "6ab950f2066f8feb2dfddb94575fcbb2cf07afe7"
11
+ "gitHead": "4cc43868ab30db75353d626c7f80f44085503288"
12
12
  }