@ts-core/angular 19.0.11 → 19.0.12

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,5 +1,5 @@
1
1
  import { Destroyable } from '@ts-core/common';
2
- import { LanguageService, SettingsServiceBase } from '@ts-core/frontend';
2
+ import { LanguageService, SettingsServiceBase, ThemeService } from '@ts-core/frontend';
3
3
  import { ILanguageLoader, ILanguageProjectSettings, LanguageLoadFunction } from '@ts-core/language';
4
4
  import { RouterServiceBase } from '../service/RouterServiceBase';
5
5
  import { PlatformService } from '../service/PlatformService';
@@ -8,13 +8,16 @@ export declare abstract class ApplicationInitializerBase<S extends SettingsServi
8
8
  protected options?: O;
9
9
  constructor(options?: O);
10
10
  initialize(): Promise<void>;
11
- protected initializeAssets(): Promise<void>;
11
+ protected initializeAsset(): Promise<void>;
12
+ protected initializeTheme(): Promise<void>;
12
13
  protected initializeLanguage(): Promise<void>;
13
14
  protected getLanguageLoader<T = any>(): Promise<ILanguageLoader<T>>;
14
15
  protected abstract getLanguageLoadSettings<T = any>(): ILanguageLoadSettings<T>;
15
16
  protected getConfig(): Promise<any>;
16
17
  protected getConfigLocal<T = any>(): Promise<T>;
18
+ protected loadConfig<T = any>(url: string): Promise<T>;
17
19
  protected abstract getConfigRemote<T = any>(local: any): Promise<T>;
20
+ protected abstract get theme(): ThemeService;
18
21
  protected abstract get windows(): WindowService;
19
22
  protected abstract get platform(): PlatformService;
20
23
  protected abstract get language(): LanguageService;
@@ -46,17 +46,26 @@ class ApplicationInitializerBase extends Destroyable {
46
46
  this.windows.info(error.message, null, null, { isDisableClose: true, isModal: true });
47
47
  return;
48
48
  }
49
- this.initializeAssets();
49
+ this.initializeAsset();
50
+ this.initializeTheme();
50
51
  this.initializeLanguage();
51
52
  }
52
53
  //--------------------------------------------------------------------------
53
54
  //
54
- // Language Methods
55
+ // Protected Methods
55
56
  //
56
57
  //--------------------------------------------------------------------------
57
- async initializeAssets() {
58
+ async initializeAsset() {
58
59
  Assets.provider = new AssetsCdnProvider(this.settings.assetsUrl, this.settings.assetsCdnUrl);
59
60
  }
61
+ async initializeTheme() {
62
+ this.theme.initialize(this.settings.themes);
63
+ }
64
+ //--------------------------------------------------------------------------
65
+ //
66
+ // Language Methods
67
+ //
68
+ //--------------------------------------------------------------------------
60
69
  async initializeLanguage() {
61
70
  this.language.loader = await this.getLanguageLoader();
62
71
  }
@@ -77,12 +86,19 @@ class ApplicationInitializerBase extends Destroyable {
77
86
  return this.options.config;
78
87
  }
79
88
  let local = await this.getConfigLocal();
80
- let remote = await this.getConfigRemote(local);
81
- return Object.assign(local, remote);
89
+ return Object.assign(local, await this.getConfigRemote(local));
82
90
  }
83
91
  async getConfigLocal() {
84
- let { data } = await axios.get('config.json');
85
- return data;
92
+ return this.loadConfig('config.json');
93
+ }
94
+ async loadConfig(url) {
95
+ try {
96
+ let { data } = await axios.get(url);
97
+ return data;
98
+ }
99
+ catch (error) {
100
+ throw new ExtendedError(`Unable to load config from "${url}": ${error.message}`);
101
+ }
86
102
  }
87
103
  }
88
104
  class ServerInitializeOptions {