zova-module-a-style 5.0.15 → 5.0.16

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.15",
3
+ "version": "5.0.16",
4
4
  "title": "a-style",
5
5
  "zovaModule": {
6
6
  "capabilities": {
@@ -34,5 +34,5 @@
34
34
  "tsc:publish": "npm run clean && tsc -b",
35
35
  "prepublishOnly": "npm run tsc:publish"
36
36
  },
37
- "gitHead": "4694913185e21d7ff9f241cb7fc949dde41cf6fd"
37
+ "gitHead": "e59fa627f7bdd1f308c4bd5ae36c45ec4a2648b2"
38
38
  }
@@ -42,8 +42,9 @@ export class BeanTheme extends BeanBase<ScopeModule> {
42
42
  const theme = (await this.bean._getBean(this.name as any, true)) as ThemeBase;
43
43
  const res = await theme.apply({ name: this.name, dark: this.dark });
44
44
  this.token = Cast(res).token;
45
- if (res.handler) {
46
- const themeHandler = (await this.bean._getBean(res.handler, true)) as unknown as ThemeHandler;
45
+ const handler = res.handler ?? this.scope.config.defaultThemeHandler;
46
+ if (handler) {
47
+ const themeHandler = (await this.bean._getBean(handler, true)) as unknown as ThemeHandler;
47
48
  await themeHandler.apply({ name: this.name, dark: this.dark, token: this.token } as any);
48
49
  }
49
50
  }
@@ -4,5 +4,6 @@ export const config = (_app: ZovaApplication) => {
4
4
  return {
5
5
  defaultStyle: 'home-style.style.default' as keyof IBeanRecord,
6
6
  defaultTheme: 'home-theme.theme.default' as keyof IBeanRecord,
7
+ defaultThemeHandler: '' as keyof IBeanRecord,
7
8
  };
8
9
  };
package/src/monkey.ts CHANGED
@@ -7,14 +7,14 @@ export class Monkey extends BeanSimple implements IMonkeySystem {
7
7
  private _beanTheme: BeanTheme;
8
8
  private _beanStyleDefault: any;
9
9
 
10
- async appInitialize(bean: BeanContainer) {
10
+ async appInitialize(_bean: BeanContainer) {}
11
+ async appInitialized(bean: BeanContainer) {
11
12
  // theme
12
13
  this._beanTheme = await bean._getBean(BeanTheme, true);
13
14
  // style default
14
15
  const scope: ScopeModule = await bean.getScope(__ThisModule__);
15
16
  this._beanStyleDefault = await bean._getBean(scope.config.defaultStyle, true);
16
17
  }
17
- async appInitialized(_bean: BeanContainer) {}
18
18
  async beanInit(bean: BeanContainer, beanInstance: BeanBase) {
19
19
  const self = this;
20
20
  bean.defineProperty(beanInstance, '$style', {