zova-suite-a-devui 5.0.9 → 5.0.13
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.
|
|
3
|
+
"version": "5.0.13",
|
|
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": "
|
|
34
|
+
"gitHead": "6ab950f2066f8feb2dfddb94575fcbb2cf07afe7"
|
|
35
35
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BeanBase, Local } from 'zova';
|
|
2
|
+
import { ScopeModule } from '../resource/this.js';
|
|
3
|
+
|
|
4
|
+
@Local()
|
|
5
|
+
export class LocalSSR extends BeanBase<ScopeModule> {
|
|
6
|
+
public async initialize() {
|
|
7
|
+
// ssr hydrated
|
|
8
|
+
if (process.env.CLIENT) {
|
|
9
|
+
this.ctx.meta.ssr.onHydrated(() => {
|
|
10
|
+
// do something
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
// ssr theme
|
|
14
|
+
if (process.env.SERVER) {
|
|
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', '');
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -14,9 +14,14 @@ export class ToolThemeHandler extends BeanBase<ScopeModule> implements ThemeHand
|
|
|
14
14
|
_names.push(dark ? 'dark' : 'light');
|
|
15
15
|
const themeName = _names.join('-');
|
|
16
16
|
// data-theme
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
body
|
|
17
|
+
if (process.env.CLIENT) {
|
|
18
|
+
const body = window?.document?.body;
|
|
19
|
+
if (body) {
|
|
20
|
+
body.setAttribute('data-theme', themeName);
|
|
21
|
+
}
|
|
22
|
+
} else {
|
|
23
|
+
// meta
|
|
24
|
+
this.$useMeta({ bodyAttr: { 'data-theme': themeName } });
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
27
|
}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { BeanBase, BeanContainer, BeanSimple, IMonkeySystem } from 'zova';
|
|
2
2
|
import { ScopeModuleAStyle } from 'zova-module-a-style';
|
|
3
|
+
import { LocalSSR } from './bean/local.ssr.js';
|
|
3
4
|
|
|
4
5
|
export class Monkey extends BeanSimple implements IMonkeySystem {
|
|
5
6
|
async appInitialize(bean: BeanContainer) {
|
|
6
7
|
// defaultThemeHandler
|
|
7
8
|
const scopeStyle: ScopeModuleAStyle = await bean.getScope('a-style');
|
|
8
9
|
scopeStyle.config.defaultThemeHandler = 'a-devui.tool.themeHandler';
|
|
10
|
+
// ssr
|
|
11
|
+
const localSSR = await bean._newBean(LocalSSR, false);
|
|
12
|
+
await localSSR.initialize();
|
|
9
13
|
}
|
|
10
14
|
async appInitialized(_bean: BeanContainer) {}
|
|
15
|
+
async appReady(_bean: BeanContainer) {}
|
|
11
16
|
async beanInit(_bean: BeanContainer, _beanInstance: BeanBase) {}
|
|
12
17
|
async beanInited(_bean: BeanContainer, _beanInstance: BeanBase) {}
|
|
13
18
|
beanDispose(_bean: BeanContainer, _beanInstance: BeanBase) {}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zova-suite-a-devui",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.13",
|
|
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.
|
|
9
|
+
"zova-module-a-devui": "^5.0.13"
|
|
10
10
|
},
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "6ab950f2066f8feb2dfddb94575fcbb2cf07afe7"
|
|
12
12
|
}
|