@rws-framework/client 2.7.2 → 2.8.1

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.
Files changed (180) hide show
  1. package/.emerge-vis-output/fast-element/emerge-file_result_dependency_graph.graphml +126 -127
  2. package/.emerge-vis-output/fast-element/emerge-filesystem_graph.graphml +122 -123
  3. package/.emerge-vis-output/fast-element/emerge-statistics-and-metrics.json +1 -1
  4. package/.emerge-vis-output/fast-element/emerge-statistics-metrics.txt +43 -44
  5. package/.emerge-vis-output/fast-element/html/resources/js/emerge_data.js +9 -9
  6. package/.emerge-vis-output/fast-foundation/emerge-file_result_dependency_graph.graphml +1351 -1339
  7. package/.emerge-vis-output/fast-foundation/emerge-filesystem_graph.graphml +1314 -1299
  8. package/.emerge-vis-output/fast-foundation/emerge-statistics-and-metrics.json +1 -1
  9. package/.emerge-vis-output/fast-foundation/emerge-statistics-metrics.txt +1024 -1016
  10. package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_data.js +9 -9
  11. package/.emerge-vis-output/rws-client/emerge-file_result_dependency_graph.graphml +61 -61
  12. package/.emerge-vis-output/rws-client/emerge-filesystem_graph.graphml +34 -34
  13. package/.emerge-vis-output/rws-client/emerge-statistics-and-metrics.json +1 -1
  14. package/.emerge-vis-output/rws-client/emerge-statistics-metrics.txt +623 -623
  15. package/.emerge-vis-output/rws-client/html/emerge.html +0 -0
  16. package/.emerge-vis-output/rws-client/html/jsconfig.json +0 -0
  17. package/.emerge-vis-output/rws-client/html/resources/css/custom.css +0 -0
  18. package/.emerge-vis-output/rws-client/html/resources/js/emerge_common.js +0 -0
  19. package/.emerge-vis-output/rws-client/html/resources/js/emerge_data.js +9 -9
  20. package/.emerge-vis-output/rws-client/html/resources/js/emerge_git.js +0 -0
  21. package/.emerge-vis-output/rws-client/html/resources/js/emerge_graph.js +0 -0
  22. package/.emerge-vis-output/rws-client/html/resources/js/emerge_heatmap.js +0 -0
  23. package/.emerge-vis-output/rws-client/html/resources/js/emerge_hull.js +0 -0
  24. package/.emerge-vis-output/rws-client/html/resources/js/emerge_main.js +0 -0
  25. package/.emerge-vis-output/rws-client/html/resources/js/emerge_search.js +0 -0
  26. package/.emerge-vis-output/rws-client/html/resources/js/emerge_ui.js +0 -0
  27. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.css +0 -0
  28. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.css.map +0 -0
  29. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.min.css +0 -0
  30. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.min.css.map +0 -0
  31. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.rtl.css +0 -0
  32. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.rtl.css.map +0 -0
  33. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css +0 -0
  34. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css.map +0 -0
  35. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.css +0 -0
  36. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.css.map +0 -0
  37. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.min.css +0 -0
  38. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.min.css.map +0 -0
  39. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css +0 -0
  40. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css.map +0 -0
  41. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css +0 -0
  42. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css.map +0 -0
  43. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.css +0 -0
  44. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.css.map +0 -0
  45. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.min.css +0 -0
  46. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.min.css.map +0 -0
  47. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css +0 -0
  48. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css.map +0 -0
  49. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css +0 -0
  50. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css.map +0 -0
  51. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.css +0 -0
  52. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.css.map +0 -0
  53. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.min.css +0 -0
  54. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.min.css.map +0 -0
  55. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.rtl.css +0 -0
  56. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.rtl.css.map +0 -0
  57. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.rtl.min.css +0 -0
  58. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/css/bootstrap.rtl.min.css.map +0 -0
  59. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.bundle.js +0 -0
  60. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.bundle.js.map +0 -0
  61. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.bundle.min.js +0 -0
  62. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.bundle.min.js.map +0 -0
  63. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.esm.js +0 -0
  64. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.esm.js.map +0 -0
  65. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.esm.min.js +0 -0
  66. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.esm.min.js.map +0 -0
  67. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.js +0 -0
  68. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.js.map +0 -0
  69. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.min.js +0 -0
  70. package/.emerge-vis-output/rws-client/html/vendors/bootstrap/js/bootstrap.min.js.map +0 -0
  71. package/.emerge-vis-output/rws-client/html/vendors/d3/d3.v7.8.4.min.js +0 -0
  72. package/.emerge-vis-output/rws-client/html/vendors/d3/d3.v7.min.js +0 -0
  73. package/.emerge-vis-output/rws-client/html/vendors/dark-mode-switch/css/dark-mode.css +0 -0
  74. package/.emerge-vis-output/rws-client/html/vendors/dark-mode-switch/js/dark-mode-switch.min.js +0 -0
  75. package/.emerge-vis-output/rws-client/html/vendors/daterangepicker/daterangepicker.css +0 -0
  76. package/.emerge-vis-output/rws-client/html/vendors/daterangepicker/daterangepicker.min.js +0 -0
  77. package/.emerge-vis-output/rws-client/html/vendors/daterangepicker/moment.min.js +0 -0
  78. package/.emerge-vis-output/rws-client/html/vendors/jquery/jquery-3.6.0.min.js +0 -0
  79. package/.emerge-vis-output/rws-client/html/vendors/popper/popper.min.js +0 -0
  80. package/.emerge-vis-output/rws-client/html/vendors/simpleheat/simpleheat.js +0 -0
  81. package/PLUGINS.MD +188 -0
  82. package/README.md +6 -1
  83. package/_tools.js +30 -24
  84. package/cfg/tsconfigSetup.js +9 -1
  85. package/docs/assets/main.js +4 -4
  86. package/docs/assets/navigation.js +1 -1
  87. package/docs/assets/search.js +1 -1
  88. package/docs/assets/style.css +7 -5
  89. package/docs/classes/ApiServiceInstance.html +26 -26
  90. package/docs/classes/ConfigServiceInstance.html +22 -21
  91. package/docs/classes/DOMServiceInstance.html +18 -18
  92. package/docs/classes/NotifyServiceInstance.html +16 -16
  93. package/docs/classes/RWSClientInstance.html +46 -0
  94. package/docs/classes/RWSPlugin.html +14 -0
  95. package/docs/classes/RWSService.html +11 -11
  96. package/docs/classes/RWSViewComponent.html +893 -705
  97. package/docs/classes/ServiceWorkerServiceInstance.html +14 -14
  98. package/docs/classes/UtilsServiceInstance.html +14 -14
  99. package/docs/functions/ApiService.html +1 -1
  100. package/docs/functions/ConfigService.html +1 -1
  101. package/docs/functions/DOMService.html +1 -1
  102. package/docs/functions/NotifyService.html +1 -1
  103. package/docs/functions/RWSClient.html +1 -0
  104. package/docs/functions/RWSContainer.html +1 -1
  105. package/docs/functions/RWSIgnore.html +1 -1
  106. package/docs/functions/RWSInject.html +1 -1
  107. package/docs/functions/RWSView.html +1 -1
  108. package/docs/functions/ServiceWorkerService.html +1 -1
  109. package/docs/functions/UtilsService.html +1 -1
  110. package/docs/functions/attr.html +6 -6
  111. package/docs/functions/declareRWSComponents.html +1 -1
  112. package/docs/functions/ngAttr.html +1 -1
  113. package/docs/functions/observable.html +4 -4
  114. package/docs/functions/provideRWSDesignSystem.html +1 -1
  115. package/docs/functions/sanitizedAttr.html +1 -1
  116. package/docs/hierarchy.html +1 -1
  117. package/docs/index.html +3 -2
  118. package/docs/interfaces/HTMLAttributes.html +1 -1
  119. package/docs/interfaces/HTMLTag.html +4 -4
  120. package/docs/interfaces/IRWSConfig.html +21 -20
  121. package/docs/interfaces/IRWSDecoratorOptions.html +6 -6
  122. package/docs/interfaces/IRWSHttpRoute.html +3 -3
  123. package/docs/interfaces/IRWSPrefixedHTTProutes.html +3 -3
  124. package/docs/interfaces/IRWSUser.html +6 -6
  125. package/docs/modules.html +46 -53
  126. package/docs/types/DOMOutputType.html +1 -1
  127. package/docs/types/DefaultRWSPluginOptionsType.html +1 -0
  128. package/docs/types/HTMLTagTransformerType.html +1 -1
  129. package/docs/types/IRWSAssetShowOptions.html +1 -1
  130. package/docs/types/IRWSBackendRoute.html +1 -1
  131. package/docs/types/NotifyLogType.html +1 -1
  132. package/docs/types/NotifyUiType.html +1 -1
  133. package/docs/types/RWSNotify.html +1 -1
  134. package/docs/types/RWSPluginEntry.html +1 -0
  135. package/docs/types/TagsProcessorType.html +1 -1
  136. package/package.json +1 -1
  137. package/rws.webpack.config.js +25 -21
  138. package/src/client/components.ts +16 -4
  139. package/src/client/config.ts +38 -7
  140. package/src/client.ts +12 -17
  141. package/src/components/_component.ts +1 -3
  142. package/src/components/_decorator.ts +21 -3
  143. package/src/components/index.ts +1 -3
  144. package/src/components/loader/component.ts +1 -1
  145. package/src/index.ts +12 -26
  146. package/src/interfaces/IRWSConfig.ts +6 -1
  147. package/src/interfaces/RWSWindow.ts +5 -2
  148. package/src/plugins/_builder.js +32 -0
  149. package/src/plugins/_plugin.ts +63 -0
  150. package/src/services/ConfigService.ts +9 -1
  151. package/src/services/ServiceWorkerService.ts +1 -1
  152. package/tsconfig.json +3 -0
  153. package/webpack/loaders/rws_fast_ts_loader.js +80 -53
  154. package/docs/assets/icons.js +0 -15
  155. package/docs/assets/icons.svg +0 -1
  156. package/docs/classes/RWSRouter.html +0 -10
  157. package/docs/classes/RoutingServiceInstance.html +0 -18
  158. package/docs/classes/WSServiceInstance.html +0 -38
  159. package/docs/functions/RoutingService.html +0 -1
  160. package/docs/functions/WSService.html +0 -1
  161. package/docs/functions/realtimeWebSuiteClientPackage.html +0 -1
  162. package/docs/functions/renderRouteComponent.html +0 -1
  163. package/docs/interfaces/IRoutingEvent.html +0 -3
  164. package/docs/types/IRWSFrontRoutes.html +0 -1
  165. package/docs/types/IRWSRouteResult.html +0 -1
  166. package/docs/types/IRWSWebsocketStatus.html +0 -1
  167. package/docs/types/RouteReturn.html +0 -1
  168. package/docs/variables/_ROUTING_EVENT_NAME.html +0 -1
  169. package/package.webpack.config.js +0 -17
  170. package/src/components/router/component.ts +0 -79
  171. package/src/components/router/template.html +0 -1
  172. package/src/routing/_router.ts +0 -61
  173. package/src/routing/index.ts +0 -7
  174. package/src/run.ts +0 -33
  175. package/src/services/RoutingService.ts +0 -47
  176. package/src/services/WSService.ts +0 -226
  177. package/src/services/_ws_handlers/ConnectionHandler.ts +0 -52
  178. package/src/services/_ws_handlers/EventHandler.ts +0 -28
  179. package/src/services/_ws_handlers/MessageHandler.ts +0 -49
  180. package/tsdoc.json +0 -0
@@ -1,6 +1,8 @@
1
1
  import { IRWSConfig, IRWSUser } from "../index";
2
2
  import { RWSClientInstance } from "../client";
3
- import startClient from '../run';
3
+
4
+ import { RWSPlugin, DefaultRWSPluginOptionsType } from "../plugins/_plugin";
5
+ import RWSWindow, {loadRWSRichWindow } from '../interfaces/RWSWindow';
4
6
 
5
7
  type RWSInfoType = { components: string[] };
6
8
 
@@ -24,10 +26,13 @@ function setUser(this: RWSClientInstance, user: IRWSUser): RWSClientInstance {
24
26
  this.user = user;
25
27
 
26
28
  this.apiService.setToken(this.user.jwt_token);
27
- this.wsService.setUser(this.user);
28
29
 
29
30
  localStorage.setItem('the_rws_user', JSON.stringify(this.user));
30
31
 
32
+ for(const plugin of RWSPlugin.getAllPlugins()){
33
+ plugin.onSetUser(user);
34
+ }
35
+
31
36
  return this;
32
37
  }
33
38
 
@@ -66,18 +71,42 @@ function get(this: RWSClientInstance, key: string): any | null
66
71
  return null;
67
72
  }
68
73
 
74
+ type PluginConstructor<T extends DefaultRWSPluginOptionsType> = new (options: T) => RWSPlugin<T>;
75
+ type RWSPluginEntry<T extends DefaultRWSPluginOptionsType> = PluginConstructor<T> | [PluginConstructor<T>, T];
76
+
77
+ function addPlugin<T extends DefaultRWSPluginOptionsType>(this: RWSClientInstance, pluginEntry: RWSPluginEntry<T>){
78
+ const rwsWindow: RWSWindow = loadRWSRichWindow();
79
+ const pluginClass: PluginConstructor<T> = (Array.isArray(pluginEntry) ? pluginEntry[0] : pluginEntry) as PluginConstructor<T>;
80
+ const pluginOptions: T = (Array.isArray(pluginEntry) ? pluginEntry[1] : { enabled: true }) as T;
81
+
82
+ if(!Object.keys(rwsWindow.RWS.plugins).includes(pluginClass.name)){
83
+ const pluginInstance: RWSPlugin<T> = new pluginClass(pluginOptions);
84
+ this.plugins[pluginClass.name] = pluginInstance;
85
+ rwsWindow.RWS.plugins[pluginClass.name] = pluginInstance;
86
+ }
87
+ }
88
+
69
89
  async function setup(this: RWSClientInstance, config: IRWSConfig = {}): Promise<IRWSConfig> {
70
90
  if (this.isSetup) {
71
91
  return this.config;
72
92
  }
73
93
 
74
94
  this.config = { ...this.config, ...config };
75
- this.appConfig.mergeConfig(this.config);
95
+ this.appConfig.mergeConfig(this.config);
96
+
97
+ if(this.config.plugins){
98
+ for (const pluginEntry of this.config.plugins){
99
+ addPlugin.bind(this)(pluginEntry);
100
+ }
101
+ }
76
102
 
77
103
  if (this.appConfig.get('parted')) {
78
- await this.loadPartedComponents();
79
- }
104
+ const componentParts = await this.loadPartedComponents();
80
105
 
106
+ for (const plugin of RWSPlugin.getAllPlugins()){
107
+ plugin.onPartedComponentsLoad(componentParts);
108
+ }
109
+ }
81
110
 
82
111
  this.isSetup = true;
83
112
  return this.config;
@@ -98,10 +127,12 @@ async function start(this: RWSClientInstance, config: IRWSConfig = {}): Promise<
98
127
  this.pushUserToServiceWorker(this.user);
99
128
  }
100
129
 
101
- await startClient(this.appConfig, this.wsService, this.notifyService, this.routingService);
102
-
103
130
  await this.initCallback();
104
131
 
132
+ for (const plugin of RWSPlugin.getAllPlugins()){
133
+ plugin.onClientStart();
134
+ }
135
+
105
136
  return this;
106
137
  }
107
138
 
package/src/client.ts CHANGED
@@ -7,8 +7,7 @@ import UtilsService, { UtilsServiceInstance } from './services/UtilsService';
7
7
  import DOMService, { DOMServiceInstance } from './services/DOMService';
8
8
  import ApiService, { ApiServiceInstance } from './services/ApiService';
9
9
  import NotifyService, { NotifyServiceInstance } from './services/NotifyService';
10
- import RoutingService, { RoutingServiceInstance } from './services/RoutingService';
11
- import WSService, { WSServiceInstance } from './services/WSService';
10
+
12
11
  import ServiceWorkerService, { ServiceWorkerServiceInstance } from './services/ServiceWorkerService';
13
12
  import { IBackendRoute } from './services/ApiService';
14
13
  import IRWSUser from './interfaces/IRWSUser';
@@ -16,17 +15,14 @@ import RWSWindow, { RWSWindowComponentRegister, loadRWSRichWindow } from './inte
16
15
 
17
16
  import { DI, Container, Registration } from '@microsoft/fast-foundation';
18
17
 
19
- import {
20
- IFrontRoutes
21
- } from './services/RoutingService';
22
-
23
18
  import RWSViewComponent, { IWithCompose } from './components/_component';
24
19
  import RWSContainer from './components/_container';
25
20
  import TheRWSService from './services/_service';
26
21
 
27
- import ComponentHelper, { ComponentHelperStatic } from './client/components';
22
+ import ComponentHelper, { ComponentHelperStatic, RWSInfoType } from './client/components';
28
23
  import ServicesHelper from './client/services';
29
24
  import ConfigHelper from './client/config';
25
+ import { DefaultRWSPluginOptionsType, RWSPlugin } from './plugins/_plugin';
30
26
 
31
27
  interface IHotModule extends NodeModule {
32
28
  hot?: {
@@ -37,7 +33,6 @@ interface IHotModule extends NodeModule {
37
33
  }
38
34
  }
39
35
 
40
- type RWSInfoType = { components: string[] };
41
36
  type RWSEventListener = (event: CustomEvent) => void;
42
37
 
43
38
  class RWSClient {
@@ -45,6 +40,7 @@ class RWSClient {
45
40
  protected user: IRWSUser = null;
46
41
 
47
42
  protected config: IRWSConfig = {};
43
+ protected plugins: {[key: string]: RWSPlugin<DefaultRWSPluginOptionsType>} = {}
48
44
  protected isSetup = false;
49
45
  protected devStorage: { [key: string]: any } = {};
50
46
  protected customServices: { [serviceName: string]: TheRWSService} = {};
@@ -57,12 +53,10 @@ class RWSClient {
57
53
  protected initCallback: () => Promise<void> = async () => { };
58
54
 
59
55
  constructor(
60
- @ConfigService public appConfig: ConfigServiceInstance,
61
- @RoutingService public routingService: RoutingServiceInstance,
56
+ @ConfigService public appConfig: ConfigServiceInstance,
62
57
  @DOMService public domService: DOMServiceInstance,
63
58
  @UtilsService public utilsService: UtilsServiceInstance,
64
59
  @ApiService public apiService: ApiServiceInstance,
65
- @WSService public wsService: WSServiceInstance,
66
60
  @ServiceWorkerService public swService: ServiceWorkerServiceInstance,
67
61
  @NotifyService public notifyService: NotifyServiceInstance
68
62
  ) {
@@ -93,11 +87,7 @@ class RWSClient {
93
87
  get(key: string): any | null
94
88
  {
95
89
  return this.configHelper.get(key);
96
- }
97
-
98
- addRoutes(routes: IFrontRoutes) {
99
- this.config.routes = routes;
100
- }
90
+ }
101
91
 
102
92
  setNotifier(notifier: RWSNotify): RWSClient {
103
93
  this.notifyService.setNotifier(notifier);
@@ -118,6 +108,11 @@ class RWSClient {
118
108
 
119
109
  async onInit(callback: () => Promise<void>): Promise<RWSClient> {
120
110
  this.initCallback = callback;
111
+
112
+ for (const plugin of RWSPlugin.getAllPlugins()){
113
+ plugin.onComponentsDeclare();
114
+ }
115
+
121
116
  return this;
122
117
  }
123
118
 
@@ -161,7 +156,7 @@ class RWSClient {
161
156
 
162
157
  }
163
158
 
164
- async loadPartedComponents(): Promise<void> {
159
+ async loadPartedComponents(): Promise<RWSInfoType> {
165
160
  return this.componentHelper.loadPartedComponents();
166
161
  }
167
162
 
@@ -5,7 +5,6 @@ import UtilsService, { UtilsServiceInstance } from '../services/UtilsService';
5
5
  import DOMService, { DOMServiceInstance, DOMOutputType } from '../services/DOMService';
6
6
  import ApiService, { ApiServiceInstance } from '../services/ApiService';
7
7
  import NotifyService, { NotifyServiceInstance } from '../services/NotifyService';
8
- import WSService, { WSServiceInstance } from '../services/WSService';
9
8
  import { IRWSViewComponent, IAssetShowOptions } from '../interfaces/IRWSViewComponent';
10
9
  import RWSWindow, { RWSWindowComponentInterface, loadRWSRichWindow } from '../interfaces/RWSWindow';
11
10
  import { applyConstructor, RWSInject } from './_decorator';
@@ -52,8 +51,7 @@ abstract class RWSViewComponent extends FoundationElement implements IRWSViewCom
52
51
  @RWSInject(ConfigService, true) protected config: ConfigServiceInstance;
53
52
  @RWSInject(DOMService, true) protected domService: DOMServiceInstance;
54
53
  @RWSInject(UtilsService, true) protected utilsService: UtilsServiceInstance;
55
- @RWSInject(ApiService, true) protected apiService: ApiServiceInstance;
56
- @RWSInject(WSService, true) protected wsService: WSServiceInstance;
54
+ @RWSInject(ApiService, true) protected apiService: ApiServiceInstance;
57
55
  @RWSInject(NotifyService, true) protected notifyService: NotifyServiceInstance;
58
56
 
59
57
  @observable trashIterator: number = 0;
@@ -1,6 +1,6 @@
1
1
  import RWSViewComponent, { IWithCompose } from './_component';
2
2
  import { RWSInject } from './_decorators/RWSInject';
3
-
3
+ import { ElementStyles, ViewTemplate } from '@microsoft/fast-element';
4
4
  import 'reflect-metadata';
5
5
 
6
6
  interface RWSDecoratorOptions {
@@ -8,16 +8,34 @@ interface RWSDecoratorOptions {
8
8
  styles?: string,
9
9
  fastElementOptions?: any,
10
10
  ignorePackaging?: boolean,
11
+ debugPackaging?: boolean
11
12
  oreoMode?: boolean
12
13
  }
13
14
 
14
15
  //const _PARAMTYPES_METADATA_KEY = 'design:paramtypes';
15
16
 
16
- function RWSView<T extends RWSViewComponent>(name: string, data?: RWSDecoratorOptions): (type: any) => void {
17
- return (constructor: T) => {
17
+ function RWSView<Component extends RWSViewComponent>(name: string, data?: RWSDecoratorOptions | null, override?: { styles?: ElementStyles, template?: ViewTemplate, options?: any }): (type: any, args?: any) => void {
18
+ return (theComponent: IWithCompose<Component>, args?: any) => {
19
+ theComponent.definition = { name, template: null }
20
+
21
+ if(override){
22
+ if(override.styles){
23
+ theComponent.definition.styles = override.styles;
24
+ }
25
+
26
+ if(override.template){
27
+ theComponent.definition.template = override.template;
28
+ }
29
+
30
+
31
+ if(override.options){
32
+ (theComponent.definition as any).options = override.options;
33
+ }
34
+ }
18
35
  };
19
36
  }
20
37
 
38
+
21
39
  function RWSIgnore(params: { mergeToApp?: boolean } | null = null): () => void {
22
40
  return () => { };
23
41
  }
@@ -1,5 +1,4 @@
1
1
  import { RWSUploader } from './uploader/component';
2
- import { RouterComponent } from './router/component';
3
2
  import { RWSProgress } from './progress/component';
4
3
  import { RWSLoader } from './loader/component';
5
4
 
@@ -7,8 +6,7 @@ import { RWSLoader } from './loader/component';
7
6
  function declareRWSComponents(parted: boolean = false): void
8
7
  {
9
8
  if(!parted){
10
- RWSUploader;
11
- RouterComponent;
9
+ RWSUploader;
12
10
  RWSProgress;
13
11
  RWSLoader;
14
12
  }
@@ -1,4 +1,4 @@
1
- import { RWSView, RWSViewComponent } from '@rws-framework/client';
1
+ import { RWSView, RWSViewComponent } from '../../index';
2
2
 
3
3
  @RWSView('the-loader')
4
4
  class RWSLoader extends RWSViewComponent {
package/src/index.ts CHANGED
@@ -5,27 +5,21 @@ import RWSNotify, { NotifyUiType, NotifyLogType } from './types/RWSNotify';
5
5
  import { provideRWSDesignSystem } from './components/_design_system';
6
6
  import RWSService from './services/_service';
7
7
  import ConfigService, { ConfigServiceInstance } from './services/ConfigService';
8
- import RoutingService, { RoutingServiceInstance } from './services/RoutingService';
9
8
  import NotifyService, {NotifyServiceInstance} from './services/NotifyService';
10
9
  import DOMService, { DOMServiceInstance, DOMOutputType, TagsProcessorType } from './services/DOMService';
11
10
  import ApiService, { IBackendRoute, ApiServiceInstance, IHTTProute, IPrefixedHTTProutes } from './services/ApiService';
12
11
  import UtilsService, {UtilsServiceInstance} from './services/UtilsService';
13
12
  import ServiceWorkerService, { ServiceWorkerServiceInstance } from './services/ServiceWorkerService';
14
- import { sanitizedAttr } from './components/_attrs/sanitize-html';import WSService, {WSServiceInstance, WSStatus} from './services/WSService';
13
+ import { sanitizedAttr } from './components/_attrs/sanitize-html';
15
14
  import { ngAttr } from './components/_attrs/angular-attr';
16
- import RWSClient from './client';
17
-
15
+ import { RWSPlugin, DefaultRWSPluginOptionsType } from './plugins/_plugin';
16
+ import RWSClient, { RWSClientInstance } from './client';
17
+ import { RWSPluginEntry } from './interfaces/IRWSConfig';
18
18
  import IRWSUser from './interfaces/IRWSUser';
19
19
  import RWSViewComponent, { IAssetShowOptions } from './components/_component';
20
20
 
21
21
  import RWSContainer from './components/_container';
22
22
 
23
- import {
24
- IFrontRoutes, renderRouteComponent, RouteReturn,
25
- _ROUTING_EVENT_NAME, IRoutingEvent,
26
- RWSRouter, IRWSRouteResult
27
- } from './services/RoutingService';
28
-
29
23
 
30
24
  import { RWSDecoratorOptions, RWSIgnore, RWSInject, RWSView } from './components/_decorator';
31
25
 
@@ -33,19 +27,18 @@ import { declareRWSComponents } from './components';
33
27
 
34
28
  export default RWSClient;
35
29
  export {
30
+ RWSClient,
31
+ RWSClientInstance,
32
+
33
+ RWSPlugin,
34
+ RWSPluginEntry,
35
+ DefaultRWSPluginOptionsType,
36
+
36
37
  NotifyUiType,
37
38
  NotifyLogType,
38
39
 
39
- RouteReturn,
40
- _ROUTING_EVENT_NAME,
41
- IRoutingEvent,
42
-
43
- RoutingServiceInstance,
44
- RoutingService,
45
40
  ApiServiceInstance,
46
41
  ApiService,
47
- WSServiceInstance,
48
- WSService,
49
42
  UtilsServiceInstance,
50
43
  UtilsService,
51
44
  DOMServiceInstance,
@@ -59,14 +52,10 @@ export {
59
52
  ServiceWorkerService,
60
53
 
61
54
  RWSNotify,
62
- RWSRouter,
63
- IFrontRoutes as IRWSFrontRoutes,
64
55
  IBackendRoute as IRWSBackendRoute,
65
56
  RWSDecoratorOptions as IRWSDecoratorOptions,
66
- IRWSRouteResult,
67
57
  IHTTProute as IRWSHttpRoute,
68
- IPrefixedHTTProutes as IRWSPrefixedHTTProutes,
69
- WSStatus as IRWSWebsocketStatus,
58
+ IPrefixedHTTProutes as IRWSPrefixedHTTProutes,
70
59
  IAssetShowOptions as IRWSAssetShowOptions,
71
60
  IRWSConfig,
72
61
  IRWSUser,
@@ -80,9 +69,6 @@ export {
80
69
  RWSIgnore,
81
70
  RWSInject,
82
71
  ngAttr,
83
-
84
- renderRouteComponent,
85
-
86
72
  observable,
87
73
  attr,
88
74
 
@@ -1,5 +1,9 @@
1
- import { IFrontRoutes } from '../services/RoutingService';
2
1
  import RWSViewComponent from '../components/_component';
2
+ import { RWSPlugin, DefaultRWSPluginOptionsType } from '../plugins/_plugin';
3
+
4
+ export type IFrontRoutes = Record<string, unknown>;
5
+ export type PluginConstructor<T extends DefaultRWSPluginOptionsType> = new (options: T) => RWSPlugin<T>;
6
+ export type RWSPluginEntry<T extends DefaultRWSPluginOptionsType> = PluginConstructor<T> | [PluginConstructor<T>, T];
3
7
 
4
8
  export default interface IRWSConfig {
5
9
  dev?: boolean
@@ -19,6 +23,7 @@ export default interface IRWSConfig {
19
23
  parted?: boolean
20
24
  partedFileDir?: string
21
25
  partedPrefix?: string
26
+ plugins?: RWSPluginEntry<DefaultRWSPluginOptionsType>[]
22
27
  routing_enabled?: boolean
23
28
  _noLoad?: boolean
24
29
  }
@@ -1,5 +1,6 @@
1
1
  import { RWSClientInstance } from '../client';
2
2
  import { Container, InterfaceSymbol } from '@microsoft/fast-foundation';
3
+ import { RWSPlugin, DefaultRWSPluginOptionsType } from '../plugins/_plugin';
3
4
  import { v1 as uuid} from 'uuid';
4
5
  export type RWSWindowComponentInterface = (params?: any) => void;
5
6
  export type RWSWindowComponentEntry = { interface: RWSWindowComponentInterface, component: any };
@@ -12,12 +13,13 @@ export function loadRWSRichWindow(): RWSWindow
12
13
  if(!richWindow.RWS){
13
14
  const newNode = document.createElement('main');
14
15
  newNode.id = 'rws-cntr-id-' + uuid();
15
-
16
- console.log('Created container on node: ', newNode.id);
16
+
17
+ console.log('\x1b[1m[RWS]\x1b[0m Created new container node: ', newNode.id);
17
18
 
18
19
  richWindow.RWS = {
19
20
  client: null,
20
21
  components: {},
22
+ plugins: {},
21
23
  container: null,
22
24
  container_node: newNode,
23
25
  _registered: {}
@@ -31,6 +33,7 @@ export default interface RWSWindow extends Window {
31
33
  RWS?: {
32
34
  client?: RWSClientInstance
33
35
  components: RWSWindowComponentRegister
36
+ plugins: {[key: string]: RWSPlugin<DefaultRWSPluginOptionsType>}
34
37
  container: Container | null
35
38
  container_node: Element | null
36
39
  _registered: {[key: string]: InterfaceSymbol<any>};
@@ -0,0 +1,32 @@
1
+ const fs = require('fs');
2
+ const chalk = require('chalk');
3
+
4
+ class RWSPluginBuilder {
5
+ pluginInfo = {name: null};
6
+
7
+ constructor(pluginPath, buildConfigurator, baseBuildConfig){
8
+ this.pluginPath = pluginPath;
9
+ this.buildConfigurator = buildConfigurator;
10
+ this.baseBuildConfig = baseBuildConfig;
11
+
12
+ this.pluginInfo = JSON.parse(fs.readFileSync(this.pluginPath + '/plugin-info.json', 'utf-8'));
13
+ }
14
+
15
+ async onComponentsLocated(partedComponentsLocations = []){
16
+ return partedComponentsLocations;
17
+ }
18
+
19
+ async onServicesLocated(servicesLocations){
20
+ return servicesLocations;
21
+ }
22
+
23
+ async onBuild(webpackOptions){
24
+ return webpackOptions;
25
+ }
26
+
27
+ log(msg){
28
+ console.log(chalk.blue('RWS Plugin'), chalk.green(this.pluginInfo.name) + ':', msg);
29
+ }
30
+ }
31
+
32
+ module.exports = { RWSPluginBuilder };
@@ -0,0 +1,63 @@
1
+ import RWSContainer from "../components/_container";
2
+ import { Container } from "@microsoft/fast-foundation";
3
+ import RWSWindow, {loadRWSRichWindow } from '../interfaces/RWSWindow';
4
+ import IRWSUser from "../interfaces/IRWSUser";
5
+ import { RWSInfoType } from "../client/components";
6
+
7
+ type DefaultRWSPluginOptionsType = { enabled: boolean };
8
+ type PluginInfoType = { name: string }
9
+ type PluginConstructor<T extends DefaultRWSPluginOptionsType> = new (options: T) => RWSPlugin<T>;
10
+ abstract class RWSPlugin<PluginOptions extends DefaultRWSPluginOptionsType> {
11
+ protected isLoaded: boolean = false;
12
+ protected options: PluginOptions;
13
+ protected container: Container;
14
+ protected window: RWSWindow;
15
+
16
+ static container: Container;
17
+ static window: RWSWindow;
18
+
19
+ constructor(options: PluginOptions = { enabled: false } as PluginOptions){
20
+ this.isLoaded = true;
21
+ this.container = RWSPlugin.container;
22
+ this.window = RWSPlugin.window;
23
+ this.options = options;
24
+ }
25
+
26
+ async onClientStart(): Promise<void>
27
+ {
28
+
29
+ }
30
+
31
+ async onPartedComponentsLoad(componentParts: RWSInfoType): Promise<void>
32
+ {
33
+
34
+ }
35
+
36
+ async onComponentsDeclare(): Promise<void>
37
+ {
38
+
39
+ }
40
+
41
+ async onSetUser(user: IRWSUser): Promise<void>{
42
+
43
+ }
44
+
45
+
46
+
47
+ static getPlugin<Plugin extends RWSPlugin<T>, T extends DefaultRWSPluginOptionsType = DefaultRWSPluginOptionsType>(pluginClass: PluginConstructor<T>): Plugin | null
48
+ {
49
+ const plugin = this.window.RWS.plugins[pluginClass.name];
50
+ return plugin ? plugin as Plugin : null;
51
+ }
52
+
53
+
54
+ static getAllPlugins(): RWSPlugin<DefaultRWSPluginOptionsType>[]
55
+ {
56
+ return Object.keys(this.window.RWS.plugins).map((key) => this.window.RWS.plugins[key]);
57
+ }
58
+ }
59
+
60
+ RWSPlugin.window = loadRWSRichWindow();
61
+ RWSPlugin.container = RWSContainer();
62
+
63
+ export { RWSPlugin, DefaultRWSPluginOptionsType }
@@ -63,6 +63,10 @@ class ConfigService extends TheService {
63
63
 
64
64
  return this.data[key as keyof IRWSConfig];
65
65
  }
66
+
67
+ public set<V extends keyof IRWSConfig>(key: V, value: IRWSConfig[V]){
68
+ this.data[key] = value;
69
+ }
66
70
 
67
71
  public async reloadConfig(cfgString: string): Promise<ConfigService>
68
72
  {
@@ -111,8 +115,12 @@ class ConfigService extends TheService {
111
115
  }
112
116
 
113
117
  mergeConfig(config: IRWSConfig) {
114
- const unloaded = ConfigService.isLoaded;
118
+ const unloaded = ConfigService.isLoaded;
115
119
 
120
+ if(!Object.keys(this.data).includes('plugins')){
121
+ this.data.plugins = [];
122
+ }
123
+
116
124
  this.data = Object.assign(this.data, config);
117
125
 
118
126
  if(unloaded){
@@ -1,4 +1,4 @@
1
- import RWSService from '@rws-framework/client/src/services/_service';
1
+ import RWSService from './_service';
2
2
 
3
3
 
4
4
  class ServiceWorkerService extends RWSService {
package/tsconfig.json CHANGED
@@ -17,6 +17,9 @@
17
17
  "declaration": true,
18
18
  "lib": ["DOM", "ESNext"],
19
19
  },
20
+ "paths": {
21
+ "@rws-framework/client": ["src"]
22
+ },
20
23
  "include": [
21
24
  "src",
22
25
  "types/docs-typings.d.ts"