zova-suite-a-devui 5.0.7 → 5.0.9
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.9",
|
|
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": "ebc215730b3219594ca41a190826dce4f3d20f7d"
|
|
35
35
|
}
|
|
@@ -2,9 +2,21 @@ import { BeanBase, Tool } from 'zova';
|
|
|
2
2
|
import { ScopeModule } from '../resource/this.js';
|
|
3
3
|
import { ThemeHandler, ThemeHandlerApplyParams } from 'zova-module-a-style';
|
|
4
4
|
|
|
5
|
+
const __Themes = { 'a-demo.theme.orange': 'orange', 'home-theme.theme.default': '' };
|
|
6
|
+
|
|
5
7
|
@Tool()
|
|
6
8
|
export class ToolThemeHandler extends BeanBase<ScopeModule> implements ThemeHandler {
|
|
7
|
-
async apply({ token: _token }: ThemeHandlerApplyParams): Promise<void> {
|
|
8
|
-
//
|
|
9
|
+
async apply({ name, dark, token: _token }: ThemeHandlerApplyParams): Promise<void> {
|
|
10
|
+
// themeName
|
|
11
|
+
const _names: string[] = [];
|
|
12
|
+
const _name = __Themes[name];
|
|
13
|
+
if (_name) _names.push(_name);
|
|
14
|
+
_names.push(dark ? 'dark' : 'light');
|
|
15
|
+
const themeName = _names.join('-');
|
|
16
|
+
// data-theme
|
|
17
|
+
const body = window?.document?.documentElement;
|
|
18
|
+
if (body) {
|
|
19
|
+
body.setAttribute('data-theme', themeName);
|
|
20
|
+
}
|
|
9
21
|
}
|
|
10
22
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { BeanBase, BeanContainer, BeanSimple, IMonkeySystem } from 'zova';
|
|
2
|
+
import { ScopeModuleAStyle } from 'zova-module-a-style';
|
|
2
3
|
|
|
3
4
|
export class Monkey extends BeanSimple implements IMonkeySystem {
|
|
4
|
-
async appInitialize(
|
|
5
|
+
async appInitialize(bean: BeanContainer) {
|
|
6
|
+
// defaultThemeHandler
|
|
7
|
+
const scopeStyle: ScopeModuleAStyle = await bean.getScope('a-style');
|
|
8
|
+
scopeStyle.config.defaultThemeHandler = 'a-devui.tool.themeHandler';
|
|
9
|
+
}
|
|
5
10
|
async appInitialized(_bean: BeanContainer) {}
|
|
6
11
|
async beanInit(_bean: BeanContainer, _beanInstance: BeanBase) {}
|
|
7
12
|
async beanInited(_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.9",
|
|
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.9"
|
|
10
10
|
},
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "ebc215730b3219594ca41a190826dce4f3d20f7d"
|
|
12
12
|
}
|