zova-module-a-style 5.0.37 → 5.0.40

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.37",
3
+ "version": "5.0.40",
4
4
  "title": "a-style",
5
5
  "zovaModule": {
6
6
  "capabilities": {
@@ -37,5 +37,9 @@
37
37
  "tsc:publish": "npm run clean && tsc -b",
38
38
  "_prepublishOnly": "npm run tsc:publish"
39
39
  },
40
- "gitHead": "b87bdd8540395b181993a617d33cad57b3c4d446"
40
+ "dependencies": {
41
+ "csx": "^10.0.2",
42
+ "typestyle": "^2.4.0"
43
+ },
44
+ "gitHead": "200ff5791bd6362080428f5b6c6c8f2a82c7d9d0"
41
45
  }
@@ -87,7 +87,7 @@ export class BeanTheme extends BeanModelBase<ScopeModule> {
87
87
  async _applyTheme() {
88
88
  const name = this.name;
89
89
  const dark = this._dark;
90
- const theme = (await this.bean._getBean(name as any, true)) as ThemeBase;
90
+ const theme = await this._loadThemeBean(name);
91
91
  if (!theme) {
92
92
  this.name = this.scope.config.defaultTheme;
93
93
  await this._applyTheme();
@@ -102,6 +102,12 @@ export class BeanTheme extends BeanModelBase<ScopeModule> {
102
102
  }
103
103
  }
104
104
 
105
+ async _loadThemeBean(name: string): Promise<ThemeBase | undefined> {
106
+ const moduleName = name.split('.')[0];
107
+ if (!this.app.meta.module.exists(moduleName)) return;
108
+ return await this.bean._getBean(name as any, true);
109
+ }
110
+
105
111
  toggleDark() {
106
112
  this.darkMode = !this._dark;
107
113
  this._updateDark(); // immediate
@@ -2,8 +2,8 @@ import { IBeanRecord, ZovaApplication } from 'zova';
2
2
 
3
3
  export const config = (_app: ZovaApplication) => {
4
4
  return {
5
- defaultStyle: 'home-style.style.default' as keyof IBeanRecord,
6
- defaultTheme: 'home-theme.theme.default' as keyof IBeanRecord,
5
+ defaultStyle: 'home-base.style.default' as keyof IBeanRecord,
6
+ defaultTheme: 'home-base.theme.default' as keyof IBeanRecord,
7
7
  defaultThemeHandler: '' as keyof IBeanRecord,
8
8
  model: {
9
9
  themename: {
package/src/monkey.ts CHANGED
@@ -8,7 +8,7 @@ export class Monkey extends BeanSimple implements IMonkeySystem {
8
8
  private _beanStyleDefault: any;
9
9
  private _styleInstance: TypeStyle;
10
10
 
11
- async appInitialize(_bean: BeanContainer) {
11
+ async appInitialize() {
12
12
  if (process.env.SERVER) {
13
13
  this._styleInstance = createTypeStyle();
14
14
  this.ctx.meta.ssr.context.onRendered(() => {
@@ -23,14 +23,14 @@ export class Monkey extends BeanSimple implements IMonkeySystem {
23
23
  });
24
24
  }
25
25
  }
26
- async appInitialized(bean: BeanContainer) {
26
+ async appInitialized() {
27
27
  // theme
28
- this._beanTheme = await bean._getBean(BeanTheme, true);
28
+ this._beanTheme = await this.bean._getBean(BeanTheme, true);
29
29
  // style default
30
- const scope: ScopeModule = await bean.getScope(__ThisModule__);
31
- this._beanStyleDefault = await bean._getBean(scope.config.defaultStyle, true);
30
+ const scope: ScopeModule = await this.bean.getScope(__ThisModule__);
31
+ this._beanStyleDefault = await this.bean._getBean(scope.config.defaultStyle, true);
32
32
  }
33
- async appReady(_bean: BeanContainer) {}
33
+ async appReady() {}
34
34
  async beanInit(bean: BeanContainer, beanInstance: BeanBase) {
35
35
  const self = this;
36
36
  bean.defineProperty(beanInstance, '$style', {