@rws-framework/client 2.20.1 → 2.20.3

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 (84) hide show
  1. package/.bin/emerge.sh +15 -15
  2. package/builder/vite/index.ts +4 -4
  3. package/builder/vite/rws.vite.config.ts +132 -132
  4. package/builder/vite/rws_scss_plugin.ts +61 -61
  5. package/builder/webpack/index.js +10 -10
  6. package/builder/webpack/rws.webpack.config.js +161 -161
  7. package/builder/webpack/rws_scss_plugin.js +90 -90
  8. package/builder/webpack/rws_webpack_plugin.js +137 -137
  9. package/cfg/_default.cfg.js +26 -26
  10. package/cfg/_storage.d.ts +22 -22
  11. package/cfg/_storage.js +42 -42
  12. package/cfg/tsconfigSetup.js +146 -146
  13. package/docs/assets/26e93147f10415a0ed4a.svg +6 -6
  14. package/docs/assets/75c9471662e97ee24f29.svg +7 -7
  15. package/docs/assets/db90e4df2373980c497d.svg +9 -9
  16. package/docs/assets/highlight.css +127 -127
  17. package/docs/assets/main.js +59 -59
  18. package/docs/assets/style.css +1414 -1414
  19. package/docs/classes/ApiServiceInstance.html +25 -25
  20. package/docs/classes/ConfigServiceInstance.html +21 -21
  21. package/docs/classes/DOMServiceInstance.html +17 -17
  22. package/docs/classes/NotifyServiceInstance.html +15 -15
  23. package/docs/classes/RWSClientInstance.html +45 -45
  24. package/docs/classes/RWSPlugin.html +13 -13
  25. package/docs/classes/RWSService.html +10 -10
  26. package/docs/classes/RWSViewComponent.html +1022 -1022
  27. package/docs/classes/ServiceWorkerServiceInstance.html +13 -13
  28. package/docs/classes/UtilsServiceInstance.html +13 -13
  29. package/docs/functions/attr.html +5 -5
  30. package/docs/functions/observable.html +3 -3
  31. package/docs/index.html +179 -179
  32. package/docs/interfaces/HTMLTag.html +3 -3
  33. package/docs/interfaces/IRWSConfig.html +20 -20
  34. package/docs/interfaces/IRWSDecoratorOptions.html +5 -5
  35. package/docs/interfaces/IRWSHttpRoute.html +2 -2
  36. package/docs/interfaces/IRWSPrefixedHTTProutes.html +2 -2
  37. package/docs/interfaces/IRWSUser.html +5 -5
  38. package/docs/modules.html +45 -45
  39. package/foundation/index.js +1 -1
  40. package/foundation/rws-foundation.d.ts +7 -7
  41. package/foundation/rws-foundation.js +7 -7
  42. package/package.json +1 -1
  43. package/service_worker/src/_service_worker.ts +83 -83
  44. package/service_worker/tsconfig.json +20 -20
  45. package/service_worker/webpack.config.js +66 -66
  46. package/src/client/components.ts +67 -67
  47. package/src/client/config.ts +175 -175
  48. package/src/client/hotReload.ts +22 -22
  49. package/src/client/services.ts +27 -27
  50. package/src/client.ts +208 -208
  51. package/src/components/_component.ts +247 -247
  52. package/src/components/_container.ts +15 -15
  53. package/src/components/_decorator.ts +122 -122
  54. package/src/components/_definitions.ts +64 -64
  55. package/src/components/_event_handling.ts +40 -40
  56. package/src/components/index.ts +25 -25
  57. package/src/index.ts +86 -86
  58. package/src/plugins/_builder.js +31 -31
  59. package/src/plugins/_plugin.ts +60 -60
  60. package/src/services/ApiService.ts +105 -105
  61. package/src/services/ConfigService.ts +125 -125
  62. package/src/services/DOMService.ts +93 -93
  63. package/src/services/NotifyService.ts +47 -47
  64. package/src/services/ServiceWorkerService.ts +60 -60
  65. package/src/services/UtilsService.ts +60 -60
  66. package/src/services/_service.ts +64 -64
  67. package/src/styles/README.md +157 -157
  68. package/src/styles/_darkreader.scss +30 -30
  69. package/src/styles/_grid.scss +75 -75
  70. package/src/styles/_grid_legacy.scss +49 -49
  71. package/src/styles/_misc.scss +8 -8
  72. package/src/styles/_scrollbars.scss +40 -40
  73. package/src/styles/includes.scss +6 -6
  74. package/src/types/IBackendCore.ts +11 -11
  75. package/src/types/IRWSConfig.ts +29 -29
  76. package/src/types/IRWSPlugin.ts +23 -23
  77. package/src/types/IRWSResource.ts +4 -4
  78. package/src/types/IRWSUser.ts +6 -6
  79. package/src/types/IRWSViewComponent.ts +36 -36
  80. package/src/types/IReFormerField.ts +4 -4
  81. package/src/types/RWSNotify.ts +6 -6
  82. package/src/types/RWSWindow.ts +41 -41
  83. package/types/declarations.d.ts +8 -8
  84. package/types/docs-typings.d.ts +15 -15
package/src/client.ts CHANGED
@@ -1,209 +1,209 @@
1
- import IRWSConfig from './types/IRWSConfig';
2
-
3
- import RWSNotify from './types/RWSNotify';
4
-
5
- import ConfigService, { ConfigServiceInstance } from './services/ConfigService';
6
- import UtilsService, { UtilsServiceInstance } from './services/UtilsService';
7
- import DOMService, { DOMServiceInstance } from './services/DOMService';
8
- import ApiService, { ApiServiceInstance } from './services/ApiService';
9
- import NotifyService, { NotifyServiceInstance } from './services/NotifyService';
10
-
11
- import ServiceWorkerService, { ServiceWorkerServiceInstance } from './services/ServiceWorkerService';
12
- import { IBackendRoute } from './services/ApiService';
13
- import IRWSUser from './types/IRWSUser';
14
- import RWSWindow, { RWSWindowComponentRegister, loadRWSRichWindow } from './types/RWSWindow';
15
-
16
- import { DI, Container, Registration } from './components/_container';
17
-
18
- import { declareRWSComponents } from './components/index';
19
- import RWSContainer from './components/_container';
20
- import TheRWSService from './services/_service';
21
-
22
- import ComponentHelper, { ComponentHelperStatic, RWSInfoType } from './client/components';
23
- import ServicesHelper from './client/services';
24
- import ConfigHelper from './client/config';
25
- import HotReloadHelper, { IHotReloadCfg, _DEFAULT_HR_PORT } from './client/hotReload';
26
- import { DefaultRWSPluginOptionsType, RWSPlugin } from './plugins/_plugin';
27
- import { IStaticRWSPlugin } from './types/IRWSPlugin'
28
-
29
-
30
- type RWSEventListener = (event: CustomEvent) => void;
31
-
32
- class RWSClient {
33
- protected _container: Container;
34
- protected user: IRWSUser = null;
35
-
36
- protected config: IRWSConfig = {};
37
- protected plugins: {[key: string]: RWSPlugin<DefaultRWSPluginOptionsType>} = {}
38
- protected isSetup = false;
39
- protected devStorage: { [key: string]: any } = {};
40
- protected customServices: { [serviceName: string]: TheRWSService} = {};
41
- protected defaultServices: { [serviceName: string]: TheRWSService} = {};
42
- protected hrSetup: IHotReloadCfg = { enabled: false, port: _DEFAULT_HR_PORT }
43
-
44
- private componentHelper = ComponentHelper.bind(this)();
45
- private servicesHelper = ServicesHelper.bind(this)();
46
- private configHelper = ConfigHelper.bind(this)();
47
- private hotReloadHelper = HotReloadHelper.bind(this)();
48
-
49
-
50
- protected initCallback: () => Promise<void> = async () => { };
51
-
52
- constructor(
53
- @ConfigService public appConfig: ConfigServiceInstance,
54
- @DOMService public domService: DOMServiceInstance,
55
- @UtilsService public utilsService: UtilsServiceInstance,
56
- @ApiService public apiService: ApiServiceInstance,
57
- @ServiceWorkerService public swService: ServiceWorkerServiceInstance,
58
- @NotifyService public notifyService: NotifyServiceInstance
59
- ) {
60
- this._container = RWSContainer();
61
- this.user = this.getUser();
62
-
63
- this.loadServices();
64
-
65
- this.config.plugins = [];
66
- this.pushDataToServiceWorker('SET_WS_URL', { url: this.appConfig.get('wsUrl') }, 'ws_url');
67
-
68
- if (this.user) {
69
- this.pushUserToServiceWorker({ ...this.user, instructor: false });
70
- }
71
- }
72
-
73
- addPlugin<T extends DefaultRWSPluginOptionsType>(pluginEntry: IStaticRWSPlugin<T>, options?: T)
74
- {
75
- this.config.plugins.push({pluginEntry, options});
76
- }
77
-
78
- async setup(config: IRWSConfig = {}): Promise<IRWSConfig> {
79
- return this.configHelper.setup(config);
80
- }
81
-
82
- async start(config: IRWSConfig = {}): Promise<RWSClient> {
83
- return this.configHelper.start(config);
84
- }
85
-
86
- private loadServices(){
87
- return this.servicesHelper.loadServices();
88
- }
89
-
90
- get(key: string): any | null
91
- {
92
- return this.configHelper.get(key);
93
- }
94
-
95
- setNotifier(notifier: RWSNotify): RWSClient {
96
- this.notifyService.setNotifier(notifier);
97
-
98
- return this;
99
- }
100
-
101
- setDefaultLayout(DefaultLayout: any): RWSClient {
102
- this.config.defaultLayout = DefaultLayout;
103
-
104
- return this;
105
- }
106
-
107
- setBackendRoutes(routes: IBackendRoute[]): RWSClient {
108
- this.config.backendRoutes = routes;
109
- this.appConfig.set('backendRoutes', routes);
110
- return this;
111
- }
112
-
113
- async onInit(callback: () => Promise<void>): Promise<RWSClient> {
114
- this.initCallback = callback;
115
-
116
- for (const plugin of RWSPlugin.getAllPlugins()){
117
- plugin.onComponentsDeclare();
118
- }
119
-
120
- return this;
121
- }
122
-
123
- pushDataToServiceWorker(type: string, data: any, asset_type: string = 'data_push'): void {
124
- this.configHelper.pushDataToServiceWorker(type, data, asset_type);
125
-
126
- }
127
-
128
- pushUserToServiceWorker(userData: any) {
129
- this.configHelper.pushUserToServiceWorker(userData);
130
- }
131
-
132
- getUser(): IRWSUser {
133
- return this.configHelper.getUser();
134
- }
135
-
136
- setUser(user: IRWSUser): RWSClient {
137
- return this.configHelper.setUser(user);
138
- }
139
-
140
- getConfig(): ConfigServiceInstance {
141
- return this.appConfig;
142
- }
143
-
144
- on<T>(eventName: string, listener: RWSEventListener): void {
145
- document.addEventListener(eventName, (event: Event) => {
146
- listener(event as CustomEvent<T>);
147
- });
148
- }
149
-
150
- setDevStorage(key: string, stuff: any): RWSClient {
151
- this.devStorage[key] = stuff;
152
- return this;
153
- }
154
-
155
- getDevStorage(key: string): any {
156
- return this.devStorage[key];
157
- }
158
-
159
- registerToDI(): void {
160
-
161
- }
162
-
163
- async loadPartedComponents(): Promise<RWSInfoType> {
164
- return this.componentHelper.loadPartedComponents();
165
- }
166
-
167
- async onDOMLoad(): Promise<void> {
168
- return this.domService.onDOMLoad()
169
- }
170
-
171
- assignClientToBrowser(): void {
172
- this.getBrowserObject().RWS.client = this;
173
- }
174
-
175
- enableRouting(): void {
176
- this.appConfig.mergeConfig({ routing_enabled: true });
177
- }
178
-
179
- disableRouting(): void {
180
- this.appConfig.mergeConfig({ routing_enabled: false });
181
- }
182
-
183
- private getBrowserObject(): RWSWindow {
184
- loadRWSRichWindow();
185
- return window;
186
- }
187
-
188
- static getDI(): typeof DI {
189
- return DI;
190
- }
191
-
192
- static defineAllComponents() {
193
- ComponentHelperStatic.defineAllComponents();
194
- }
195
-
196
-
197
- defineComponents(){
198
- ComponentHelperStatic.defineAllComponents();
199
- }
200
-
201
-
202
- logout(){
203
- this.user = null;
204
- localStorage.removeItem('the_rws_user');
205
- }
206
- }
207
-
208
- export default DI.createInterface<RWSClient>(x => x.singleton(RWSClient));
1
+ import IRWSConfig from './types/IRWSConfig';
2
+
3
+ import RWSNotify from './types/RWSNotify';
4
+
5
+ import ConfigService, { ConfigServiceInstance } from './services/ConfigService';
6
+ import UtilsService, { UtilsServiceInstance } from './services/UtilsService';
7
+ import DOMService, { DOMServiceInstance } from './services/DOMService';
8
+ import ApiService, { ApiServiceInstance } from './services/ApiService';
9
+ import NotifyService, { NotifyServiceInstance } from './services/NotifyService';
10
+
11
+ import ServiceWorkerService, { ServiceWorkerServiceInstance } from './services/ServiceWorkerService';
12
+ import { IBackendRoute } from './services/ApiService';
13
+ import IRWSUser from './types/IRWSUser';
14
+ import RWSWindow, { RWSWindowComponentRegister, loadRWSRichWindow } from './types/RWSWindow';
15
+
16
+ import { DI, Container, Registration } from './components/_container';
17
+
18
+ import { declareRWSComponents } from './components/index';
19
+ import RWSContainer from './components/_container';
20
+ import TheRWSService from './services/_service';
21
+
22
+ import ComponentHelper, { ComponentHelperStatic, RWSInfoType } from './client/components';
23
+ import ServicesHelper from './client/services';
24
+ import ConfigHelper from './client/config';
25
+ import HotReloadHelper, { IHotReloadCfg, _DEFAULT_HR_PORT } from './client/hotReload';
26
+ import { DefaultRWSPluginOptionsType, RWSPlugin } from './plugins/_plugin';
27
+ import { IStaticRWSPlugin } from './types/IRWSPlugin'
28
+
29
+
30
+ type RWSEventListener = (event: CustomEvent) => void;
31
+
32
+ class RWSClient {
33
+ protected _container: Container;
34
+ protected user: IRWSUser = null;
35
+
36
+ protected config: IRWSConfig = {};
37
+ protected plugins: {[key: string]: RWSPlugin<DefaultRWSPluginOptionsType>} = {}
38
+ protected isSetup = false;
39
+ protected devStorage: { [key: string]: any } = {};
40
+ protected customServices: { [serviceName: string]: TheRWSService} = {};
41
+ protected defaultServices: { [serviceName: string]: TheRWSService} = {};
42
+ protected hrSetup: IHotReloadCfg = { enabled: false, port: _DEFAULT_HR_PORT }
43
+
44
+ private componentHelper = ComponentHelper.bind(this)();
45
+ private servicesHelper = ServicesHelper.bind(this)();
46
+ private configHelper = ConfigHelper.bind(this)();
47
+ private hotReloadHelper = HotReloadHelper.bind(this)();
48
+
49
+
50
+ protected initCallback: () => Promise<void> = async () => { };
51
+
52
+ constructor(
53
+ @ConfigService public appConfig: ConfigServiceInstance,
54
+ @DOMService public domService: DOMServiceInstance,
55
+ @UtilsService public utilsService: UtilsServiceInstance,
56
+ @ApiService public apiService: ApiServiceInstance,
57
+ @ServiceWorkerService public swService: ServiceWorkerServiceInstance,
58
+ @NotifyService public notifyService: NotifyServiceInstance
59
+ ) {
60
+ this._container = RWSContainer();
61
+ this.user = this.getUser();
62
+
63
+ this.loadServices();
64
+
65
+ this.config.plugins = [];
66
+ this.pushDataToServiceWorker('SET_WS_URL', { url: this.appConfig.get('wsUrl') }, 'ws_url');
67
+
68
+ if (this.user) {
69
+ this.pushUserToServiceWorker({ ...this.user, instructor: false });
70
+ }
71
+ }
72
+
73
+ addPlugin<T extends DefaultRWSPluginOptionsType>(pluginEntry: IStaticRWSPlugin<T>, options?: T)
74
+ {
75
+ this.config.plugins.push({pluginEntry, options});
76
+ }
77
+
78
+ async setup(config: IRWSConfig = {}): Promise<IRWSConfig> {
79
+ return this.configHelper.setup(config);
80
+ }
81
+
82
+ async start(config: IRWSConfig = {}): Promise<RWSClient> {
83
+ return this.configHelper.start(config);
84
+ }
85
+
86
+ private loadServices(){
87
+ return this.servicesHelper.loadServices();
88
+ }
89
+
90
+ get(key: string): any | null
91
+ {
92
+ return this.configHelper.get(key);
93
+ }
94
+
95
+ setNotifier(notifier: RWSNotify): RWSClient {
96
+ this.notifyService.setNotifier(notifier);
97
+
98
+ return this;
99
+ }
100
+
101
+ setDefaultLayout(DefaultLayout: any): RWSClient {
102
+ this.config.defaultLayout = DefaultLayout;
103
+
104
+ return this;
105
+ }
106
+
107
+ setBackendRoutes(routes: IBackendRoute[]): RWSClient {
108
+ this.config.backendRoutes = routes;
109
+ this.appConfig.set('backendRoutes', routes);
110
+ return this;
111
+ }
112
+
113
+ async onInit(callback: () => Promise<void>): Promise<RWSClient> {
114
+ this.initCallback = callback;
115
+
116
+ for (const plugin of RWSPlugin.getAllPlugins()){
117
+ plugin.onComponentsDeclare();
118
+ }
119
+
120
+ return this;
121
+ }
122
+
123
+ pushDataToServiceWorker(type: string, data: any, asset_type: string = 'data_push'): void {
124
+ this.configHelper.pushDataToServiceWorker(type, data, asset_type);
125
+
126
+ }
127
+
128
+ pushUserToServiceWorker(userData: any) {
129
+ this.configHelper.pushUserToServiceWorker(userData);
130
+ }
131
+
132
+ getUser(): IRWSUser {
133
+ return this.configHelper.getUser();
134
+ }
135
+
136
+ setUser(user: IRWSUser): RWSClient {
137
+ return this.configHelper.setUser(user);
138
+ }
139
+
140
+ getConfig(): ConfigServiceInstance {
141
+ return this.appConfig;
142
+ }
143
+
144
+ on<T>(eventName: string, listener: RWSEventListener): void {
145
+ document.addEventListener(eventName, (event: Event) => {
146
+ listener(event as CustomEvent<T>);
147
+ });
148
+ }
149
+
150
+ setDevStorage(key: string, stuff: any): RWSClient {
151
+ this.devStorage[key] = stuff;
152
+ return this;
153
+ }
154
+
155
+ getDevStorage(key: string): any {
156
+ return this.devStorage[key];
157
+ }
158
+
159
+ registerToDI(): void {
160
+
161
+ }
162
+
163
+ async loadPartedComponents(): Promise<RWSInfoType> {
164
+ return this.componentHelper.loadPartedComponents();
165
+ }
166
+
167
+ async onDOMLoad(): Promise<void> {
168
+ return this.domService.onDOMLoad()
169
+ }
170
+
171
+ assignClientToBrowser(): void {
172
+ this.getBrowserObject().RWS.client = this;
173
+ }
174
+
175
+ enableRouting(): void {
176
+ this.appConfig.mergeConfig({ routing_enabled: true });
177
+ }
178
+
179
+ disableRouting(): void {
180
+ this.appConfig.mergeConfig({ routing_enabled: false });
181
+ }
182
+
183
+ private getBrowserObject(): RWSWindow {
184
+ loadRWSRichWindow();
185
+ return window;
186
+ }
187
+
188
+ static getDI(): typeof DI {
189
+ return DI;
190
+ }
191
+
192
+ static defineAllComponents() {
193
+ ComponentHelperStatic.defineAllComponents();
194
+ }
195
+
196
+
197
+ defineComponents(){
198
+ ComponentHelperStatic.defineAllComponents();
199
+ }
200
+
201
+
202
+ logout(){
203
+ this.user = null;
204
+ localStorage.removeItem('the_rws_user');
205
+ }
206
+ }
207
+
208
+ export default DI.createInterface<RWSClient>(x => x.singleton(RWSClient));
209
209
  export { RWSClient as RWSClientInstance, declareRWSComponents };