@rws-framework/client 2.3.1 → 2.4.2

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 (99) hide show
  1. package/.gitmodules +3 -0
  2. package/README.md +247 -168
  3. package/cfg/_default.cfg.js +1 -1
  4. package/console.js +1 -1
  5. package/docs/assets/highlight.css +24 -17
  6. package/docs/assets/icons.js +15 -0
  7. package/docs/assets/icons.svg +1 -0
  8. package/docs/assets/main.js +4 -4
  9. package/docs/assets/navigation.js +1 -1
  10. package/docs/assets/search.js +1 -1
  11. package/docs/assets/style.css +5 -7
  12. package/docs/classes/ApiServiceInstance.html +22 -20
  13. package/docs/classes/ConfigServiceInstance.html +17 -0
  14. package/docs/classes/DOMServiceInstance.html +13 -10
  15. package/docs/classes/NotifyServiceInstance.html +12 -12
  16. package/docs/classes/RWSRouter.html +10 -9
  17. package/docs/classes/RWSService.html +7 -7
  18. package/docs/classes/RWSViewComponent.html +835 -24
  19. package/docs/classes/RoutingServiceInstance.html +14 -13
  20. package/docs/classes/ServiceWorkerServiceInstance.html +10 -0
  21. package/docs/classes/UtilsServiceInstance.html +12 -11
  22. package/docs/classes/WSServiceInstance.html +34 -32
  23. package/docs/functions/ApiService.html +1 -0
  24. package/docs/functions/ConfigService.html +1 -0
  25. package/docs/functions/DOMService.html +1 -0
  26. package/docs/functions/NotifyService.html +1 -0
  27. package/docs/functions/RWSContainer.html +1 -0
  28. package/docs/functions/RWSIgnore.html +1 -0
  29. package/docs/functions/RWSInject.html +1 -0
  30. package/docs/functions/RWSView.html +1 -1
  31. package/docs/functions/RoutingService.html +1 -0
  32. package/docs/functions/ServiceWorkerService.html +1 -0
  33. package/docs/functions/UtilsService.html +1 -0
  34. package/docs/functions/WSService.html +1 -0
  35. package/docs/functions/attr.html +6 -0
  36. package/docs/functions/declareRWSComponents.html +1 -0
  37. package/docs/functions/ngAttr.html +1 -1
  38. package/docs/functions/observable.html +4 -0
  39. package/docs/functions/provideRWSDesignSystem.html +1 -0
  40. package/docs/functions/realtimeWebSuiteClientPackage.html +1 -0
  41. package/docs/functions/renderRouteComponent.html +1 -1
  42. package/docs/functions/sanitizedAttr.html +1 -0
  43. package/docs/hierarchy.html +1 -1
  44. package/docs/index.html +141 -15
  45. package/docs/interfaces/HTMLAttributes.html +1 -0
  46. package/docs/interfaces/HTMLTag.html +4 -0
  47. package/docs/interfaces/IRWSConfig.html +19 -11
  48. package/docs/interfaces/IRWSDecoratorOptions.html +5 -4
  49. package/docs/interfaces/IRWSHttpRoute.html +3 -3
  50. package/docs/interfaces/IRWSPrefixedHTTProutes.html +3 -3
  51. package/docs/interfaces/IRWSUser.html +6 -0
  52. package/docs/interfaces/IRoutingEvent.html +3 -3
  53. package/docs/modules.html +53 -39
  54. package/docs/types/DOMOutputType.html +1 -1
  55. package/docs/types/HTMLTagTransformerType.html +1 -0
  56. package/docs/types/IRWSAssetShowOptions.html +1 -0
  57. package/docs/types/IRWSBackendRoute.html +1 -1
  58. package/docs/types/IRWSFrontRoutes.html +1 -1
  59. package/docs/types/IRWSRouteResult.html +1 -1
  60. package/docs/types/IRWSWebsocketStatus.html +1 -1
  61. package/docs/types/NotifyLogType.html +1 -1
  62. package/docs/types/NotifyUiType.html +1 -1
  63. package/docs/types/RWSNotify.html +1 -1
  64. package/docs/types/RouteReturn.html +1 -1
  65. package/docs/types/TagsProcessorType.html +1 -0
  66. package/docs/variables/_ROUTING_EVENT_NAME.html +1 -1
  67. package/docs-typings.d.ts +15 -0
  68. package/package.json +7 -3
  69. package/rws.webpack.config.js +4 -3
  70. package/{src/service_worker → service_worker}/src/_service_worker.ts +3 -3
  71. package/{src/service_worker → service_worker}/tsconfig.json +1 -1
  72. package/src/client.ts +0 -2
  73. package/src/components/_component.ts +14 -13
  74. package/src/components/_decorator.ts +20 -74
  75. package/src/components/_decorators/RWSFillBuild.ts +3 -3
  76. package/src/components/_decorators/RWSInject.ts +49 -0
  77. package/src/components/_decorators/RWSService.ts +12 -0
  78. package/src/components/_decorators/_di.ts +15 -0
  79. package/src/components/router/component.ts +14 -7
  80. package/src/components/router/template.html +0 -0
  81. package/src/index.ts +3 -6
  82. package/src/services/ConfigService.ts +2 -1
  83. package/tsconfig.json +7 -6
  84. package/tsdoc.json +0 -0
  85. package/typedoc.json +3 -3
  86. package/_rws_build_configurator.d.ts +0 -14
  87. package/_rws_build_configurator.js +0 -48
  88. package/docs/classes/RWSClient.html +0 -11
  89. package/docs/classes/RWSUploader.html +0 -35
  90. package/docs/classes/RouterComponent.html +0 -31
  91. package/docs/functions/registerRWSComponents.html +0 -1
  92. package/docs/interfaces/IRWSAssetShowOptions.html +0 -1
  93. package/docs/variables/ApiService.html +0 -1
  94. package/docs/variables/DOMService.html +0 -1
  95. package/docs/variables/NotifyService.html +0 -1
  96. package/docs/variables/RoutingService.html +0 -1
  97. package/docs/variables/UtilsService.html +0 -1
  98. package/docs/variables/WSService.html +0 -1
  99. /package/{src/service_worker → service_worker}/webpack.config.js +0 -0
package/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "MS-FAST"]
2
+ path = .fast
3
+ url = git@github.com:microsoft/fast.git
package/README.md CHANGED
@@ -15,7 +15,8 @@ Realtime Web Suit is a web-component powered, MS FAST powered fullstack-oriented
15
15
  9. [Notifier](#notifier)
16
16
  10. [Service Worker](#service-worker)
17
17
  11. [Example: WebChat Component](#example-webchat-component)
18
- 12. [Links](#links)
18
+ 12. [Other configs](#other-configs)
19
+ 13. [Links](#links)
19
20
 
20
21
  ## Overview
21
22
 
@@ -46,16 +47,21 @@ or to watch for dev
46
47
  ```bash
47
48
  yarn watch
48
49
  ```
50
+ or to just start server
51
+ ```bash
52
+ yarn server
53
+ ```
54
+
49
55
  then start engine in the site javascript (can be inline):
50
56
 
51
57
  ```javascript
52
- window.RWSClient.start(CFG).then();
58
+ window.RWS.client.start(CFG); // it is async function
53
59
  ```
54
60
 
55
61
  *or for initial setup then start on certain event (example)*
56
62
 
57
63
  ```javascript
58
- window.RWSClient.setup(CFG).then(() => {
64
+ window.RWS.client.setup(CFG).then(() => { // it is async function
59
65
  $.on('loaded', function(data){
60
66
  const optionalNewCfg = { backendRoutes: data.backendRoutes };
61
67
  window.RWSClient.start(optionalNewCfg).then();
@@ -63,38 +69,86 @@ window.RWSClient.setup(CFG).then(() => {
63
69
  });
64
70
  ```
65
71
 
66
- example config with interface:
72
+ ### default config for RWS:
67
73
 
68
74
  ```javascript
69
- const CFG = {
70
- backendUrl: 'http://localhost:1337',
71
- wsUrl: 'http://localhost:1338',
72
- transports: ['websocket'],
73
- user: rwsUser,
74
- parted: true,
75
- splitFileDir: '/lib/rws',
76
- splitPrefix: 'myapp'
75
+ const _DEFAULT_CONFIG_VARS = {
76
+ //Build configs
77
+ dev: false,
78
+ hot: false,
79
+ report: false,
80
+ publicDir: './public',
81
+ publicIndex: 'index.html',
82
+ outputFileName: 'client.rws.js',
83
+ outputDir: process.cwd() + '/build',
84
+ //Frontend RWS client configs
85
+ backendUrl: null,
86
+ wsUrl: null,
87
+ partedDirUrlPrefix: '/lib/rws',
88
+ partedPrefix: 'rws',
89
+ pubUrlFilePrefix: '/',
90
+ //Universal configs
91
+ transports: ['websocket'],
92
+ parted: false,
93
+ }
94
+
95
+ ```
96
+
97
+ *The options description:*
98
+
99
+ | **Option** | **Description** | **Default** |
100
+ |--------------|-----------------|---------------|
101
+ | backendUrl | Url for backend integration (API calls) | null |
102
+ | wsUrl | Url for backend integration (Websocket calls) | null |
103
+ | backendRoutes | Backend routes object imported from backend node for integration with API calls | null |
104
+ | apiPrefix | Prefix for API calls | / |
105
+ | routes | Routes for frontend routing | {} |
106
+ | transports | Websockets transports method | ['websockets'] |
107
+ | user | User object for backend auth / frontend data source | null |
108
+ | ignoreRWSComponents | Do not declare base RWS components (uploader, progress) | false |
109
+ | pubUrlFilePrefix | the url for accessing files from browser URL | / |
110
+ | pubUrl | the url for accessing public dir from browser URL | / |
111
+ | outputDir | build dir | ./build |
112
+ | outputFileName | output file name | rws.client.js |
113
+ | publicDir | public dir for HTML serving | ./public |
114
+ | tsConfigPath | tsconfig.json path | ./tsconfig.njson |
115
+ | entry | default TS entry for transpilation | ./src/index.ts |
116
+ | parted | "Parted" mode if enabled. "Monolith" if disabled. Parted mode outputs every component as separate js file and asynchronously adds them to browser. Monolith is single file js build. | false |
117
+ | partedPrefix | parted file prefix ([prefix].[cmp name].js) | rws |
118
+ | partedDirUrlPrefix | URL for generated js parted files directory | / |
119
+ | copyAssets | An option for defining structure that will be copied after build | {} |
120
+
121
+ *copyAssets example*
122
+
123
+ ```json
124
+ "copyAssets": {
125
+ "./public/js/": [ // target directory
126
+ "./build/", // copy this directory to target
127
+ "./src/styles/compiled/main.css" //copy this file to target
128
+ ]
77
129
  }
78
130
  ```
79
131
 
80
- ### The FRONT config interface:
132
+ ### The FRONT config TS interface:
81
133
 
82
134
  ```typescript
83
135
  interface IRWSConfig {
84
136
  defaultLayout?: typeof RWSViewComponent
85
- backendUrl?: string // url to backend request/response gateway
86
- wsUrl?: string // url to backend websockets gateway
87
- backendRoutes?: any[] // routes from backend
88
- apiPrefix?: string // f.e /api after host
89
- routes?: IFrontRoutes, //override front routes
90
- transports?: string[], //ws transports setup
91
- user?: any, //user data if logged
92
- ignoreRWSComponents?: boolean //do not register base RWS components
93
- pubUrl?: string //the url for accessing public dir from browser URL (default: /)
94
- pubPrefix?: string
95
- parted?: boolean //sets async partitioning mode for components. Those wil be parted and loaded in BG.
96
- splitFileDir?: string //the url for accessing split dir from browser URL (default: /)
97
- splitPrefix?: string // prefix for parted file (`${pubPrefix}.${cmpName}.ts`)
137
+ backendUrl?: string
138
+ wsUrl?: string
139
+ backendRoutes?: any[]
140
+ apiPrefix?: string
141
+ routes?: IFrontRoutes
142
+ transports?: string[]
143
+ user?: any
144
+ ignoreRWSComponents?: boolean
145
+ pubUrl?: string
146
+ pubUrlFilePrefix?: string
147
+ partedDirUrlPrefix?: string
148
+ dontPushToSW?: boolean
149
+ parted?: boolean
150
+ partedFileDir?: string
151
+ partedPrefix?: string
98
152
  routing_enabled?: boolean
99
153
  _noLoad?: boolean
100
154
  }
@@ -103,50 +157,18 @@ interface IRWSConfig {
103
157
 
104
158
  ```javascript
105
159
  const path = require('path');
106
- const fs = require('fs');
107
- const { spawn } = require('child_process');
108
- const CopyWebpackPlugin = require('copy-webpack-plugin');
109
- const RWSWebpackWrapper = require('rws-js-client/rws.webpack.config');
110
- const { RuntimeGlobals } = require('webpack');
111
-
112
160
 
113
- const executionDir = process.cwd();
161
+ const RWSWebpackWrapper = require('@rws-framework/client/rws.webpack.config');
114
162
 
115
- const libdir = path.resolve(executionDir, '..', '..', 'target', 'app', 'lib', 'rws');
116
- const pubdir = path.resolve(executionDir, '..', '..', 'target', 'app');
117
163
 
118
- if(!fs.existsSync(libdir)){
119
- fs.mkdirSync(libdir);
120
- }
121
-
122
- const copies = {
123
- [libdir]: [
124
- './build',
125
- './src/styles/compiled/main.rws.css',
126
- ],
127
- [pubdir]: [
128
- './public/service_worker.js',
129
- './public/service_worker.js.map'
130
- ]
131
- }
132
-
133
- const myappFrontPath = path.resolve(__dirname, '../myapp/frontend');
164
+ const executionDir = process.cwd();
134
165
 
135
- module.exports = RWSWebpackWrapper({
136
- dev: true,
137
- hot: false,
166
+ module.exports = RWSWebpackWrapper({
138
167
  tsConfigPath: executionDir + '/tsconfig.json',
139
- entry: `${executionDir}/src/index.ts`,
140
- executionDir: executionDir,
168
+ entry: `${executionDir}/src/index.ts`,
141
169
  publicDir: path.resolve(executionDir, 'public'),
142
170
  outputDir: path.resolve(executionDir, 'build'),
143
- outputFileName: 'junction.client.js',
144
- copyToDir: copies,
145
- serviceWorker: './src/service_worker/MyServiceWorker.ts',
146
- parted: true,
147
- partedPrefix: 'myapp',
148
- partedComponentsLocations: ['../myapp', './src'],
149
- customServiceLocations: ['${myappFrontPath}/src/services']
171
+ outputFileName: 'jtrainer.client.js'
150
172
  });
151
173
  ```
152
174
 
@@ -156,13 +178,28 @@ module.exports = RWSWebpackWrapper({
156
178
 
157
179
  ### RWSClient
158
180
  ##
159
- `RWSClient` is the heart of the framework, managing configuration and initialization. It sets up routes, backend connections, and other essential framework services.
181
+ `RWS.client` is the heart of the framework, managing configuration and initialization. It sets up routes, backend connections, and other essential framework services.
160
182
 
161
183
 
162
184
  ### RoutingService
163
- ##
185
+
164
186
  `RoutingService` handles the navigation and routing within your application. It ensures that URL changes reflect the correct component rendering.
165
187
 
188
+ **Depreciation Notice**
189
+
190
+ ***RoutingService will be moved to @rws-framework/browser-router near future***
191
+
192
+ ### WSService
193
+
194
+ `WSService` handles Websockets messenging to the backend.
195
+
196
+ **Depreciation Notice**
197
+ ***WSService will be moved to @rws-framework/nest-interconnectors in near future***
198
+
199
+ ### APIService
200
+
201
+ `APIService` handles API requests to the backend.
202
+
166
203
  Implementing the Framework
167
204
 
168
205
  **Main File:**
@@ -172,66 +209,85 @@ The main file (`index.ts`) is where you initialize the RWSClient. Here, you conf
172
209
  Following is example of full usage of the framework
173
210
 
174
211
  ```typescript
175
- import RWSClient, { NotifyUiType, NotifyLogType } from '@rws-framework/client';
176
- //@ts-ignore
177
- import alertify from 'alertifyjs';
212
+ async function initializeApp() {
213
+ const theClient = RWSContainer().get(RWSClient);
178
214
 
179
- import './styles/main.rws.scss';
180
- import { backendRoutes } from './backendImport';
181
- import { provideFASTDesignSystem, allComponents } from '@microsoft/fast-components';
182
-
183
- // For single file output (will inject itself to DI on import):
184
- //import initComponents from './application/_initComponents'
185
-
186
- async function initializeApp() {
187
- const theClient = RWSContainer().get(RWSClient);
188
-
215
+ theClient.addRoutes(frontendRoutes);
189
216
  theClient.setBackendRoutes(backendRoutes());
217
+
218
+ theClient.enableRouting();
190
219
 
191
220
  theClient.onInit(async () => {
192
221
 
193
222
  // For single file output:
194
- //initComponents();
195
-
196
- provideFASTDesignSystem().register(allComponents);
197
-
223
+ initComponents(theClient.appConfig.get('parted')); // start components for monolith mode
224
+ theClient.defineComponents(); // start RWS conponents
225
+
226
+ //custom outside components registering
227
+ provideFASTDesignSystem()
228
+ .register(fastButton())
229
+ .register(fastTab())
230
+ .register(fastSlider())
231
+ .register(fastSelect())
232
+ .register(fastDivider())
233
+ .register(fastMenu())
234
+ .register(fastMenuItem())
235
+ ;
236
+
237
+ // Service worker code
198
238
  // const swFilePath: string = `${theClient.appConfig.get('pubUrl')}/service_worker.js`;
199
239
 
200
- await theClient.swService.registerServiceWorker();
240
+ // await theClient.swService.registerServiceWorker();
201
241
 
202
- if(theClient.getUser()){
203
- theClient.pushUserToServiceWorker({...theClient.getUser(), instructor: false});
204
- }
242
+ //if(theClient.getUser()){
243
+ // theClient.pushUserToServiceWorker({...theClient.getUser(), instructor: false});
244
+ //}
205
245
 
206
246
  });
207
247
 
208
- theClient.setNotifier((message: string, logType: NotifyLogType, uiType: NotifyUiType = 'notification', onConfirm: (params: any) => void) => {
248
+ theClient.setNotifier((message: string, logType: NotifyLogType, uiType: NotifyUiType = 'notification', onConfirm: (params: any) => void, notifierOptions: any = {}) => {
209
249
  switch(uiType){
210
- case 'notification':
211
- let notifType = 'success';
250
+ case 'notification':
251
+ let notifType = 'success';
212
252
 
213
- if(logType === 'error'){
214
- notifType = 'error';
215
- }
253
+ if(logType === 'error'){
254
+ notifType = 'error';
255
+ }
256
+
257
+ if(logType === 'warning'){
258
+ notifType = 'warning';
259
+ }
216
260
 
217
- if(logType === 'warning'){
218
- notifType = 'warning';
261
+ return alertify.notify(message, notifType, 5, onConfirm);
262
+
263
+ case 'alert':
264
+ const alertObj = alertify.alert('Junction AI Notification', message, onConfirm);
265
+
266
+ Object.keys(notifierOptions).forEach(key => {
267
+ const optionValue = notifierOptions[key];
268
+
269
+ if(key === 'width'){
270
+
271
+ alertObj.elements.dialog.style = `max-width: ${optionValue};`;
272
+
273
+ return;
219
274
  }
220
275
 
221
- alertify.notify(message, notifType, 5, onConfirm);
222
- return;
223
- case 'alert':
224
- alertify.alert('Junction AI Notification', message, onConfirm);
225
- return;
226
- case 'silent':
227
- if(logType == 'warning'){
228
- console.warn(message);
229
- }else if(logType == 'error'){
230
- console.error(message);
231
- }else{
232
- console.log(message);
233
- }
234
- return;
276
+ alertObj.set(key, optionValue);
277
+ });
278
+
279
+ alertObj.show();
280
+
281
+ return alertObj;
282
+ case 'silent':
283
+ if(logType == 'warning'){
284
+ console.warn(message);
285
+ }else if(logType == 'error'){
286
+ console.error(message);
287
+ }else{
288
+ console.log(message);
289
+ }
290
+ return;
235
291
  }
236
292
  });
237
293
 
@@ -245,6 +301,8 @@ initializeApp().catch(console.error);
245
301
 
246
302
  In `application/_initComponents.ts`, you initialize the custom components used in your application. If components added in here will include other components they dont need to be listed here. A component imported in this mode needs to be imported once.
247
303
 
304
+ **This should be conditioned not to execute imported code when using parted mode.**
305
+
248
306
  ### Default component structure
249
307
 
250
308
  ```
@@ -292,41 +350,21 @@ component-dir/
292
350
  Only if parted mode is false.
293
351
 
294
352
  ```typescript
295
- import jTrainerComponents from '../../../jtrainer/frontend/src/application/_initComponents';
296
-
297
- import { WebChat } from '../../../jtrainer/frontend/src/components/webchat/component';
298
- import { JunctionTrainer } from '../../../jtrainer/frontend/src/components/trainer/component';
299
-
300
- import { BookLoader } from '../components/book-loader/component'
301
- import { ChatLoader } from '../components/chat-loader/component'
302
-
303
- import { registerRWSComponents } from '@rws-framework/client';
304
-
305
- export default () => {
306
- jTrainerComponents();
307
- WebChat;
308
- JunctionTrainer;
309
- BookLoader;
310
- ChatLoader;
311
-
312
- RWSClientInstance.defineAllComponents();
313
- }
314
-
315
- ```
316
-
317
- ```typescript
318
- //index.ts
319
-
320
- const theClient = new RWSClient();
321
-
322
-
323
- theClient.addRoutes(routes); //routes are optional
324
-
325
- theClient.onInit(async () => {
326
- initComponents(); //user components from _initComponents.ts (dont run and import when parted: true)
327
- provideFASTDesignSystem().register(allComponents); // @microsoft/fast-components ready components init
328
- });
329
-
353
+ import { ChatNav } from '../components/chat-nav/component';
354
+ import { DefaultLayout } from '../components/default-layout/component';
355
+ import { RWSIcon } from '../components/rws-icon/component';
356
+ import { LineSplitter } from '../components/line-splitter/component';
357
+ import { WebChat } from '../components/webchat/component';
358
+
359
+ export default (partedMode: boolean = false) => {
360
+ if(!partedMode){
361
+ WebChat;
362
+ LineSplitter;
363
+ DefaultLayout;
364
+ ChatNav;
365
+ RWSIcon;
366
+ }
367
+ };
330
368
  ```
331
369
 
332
370
  **Component needs to extend RWSViewComponent and use @RWSView decorator**:
@@ -379,12 +417,8 @@ Default services: https://github.com/papablack/rws-client/blob/7d16d9c6d83c81c9f
379
417
 
380
418
  ```typescript
381
419
  import {
382
- NotifyService, RWSView, RWSViewComponent,
383
- WSService, ApiService, ConfigService,
384
- ConfigServiceInstance, UtilsServiceInstance, ApiServiceInstance,
385
- UtilsService, DOMServiceInstance, DOMService,
386
- NotifyServiceInstance, WSServiceInstance, RoutingService,
387
- RoutingServiceInstance, RWSInject
420
+ RWSView, RWSViewComponent, RWSInject,
421
+ DateService, DateServiceInstance
388
422
  } from 'rws-js-client';
389
423
 
390
424
  import DateService, {DateServiceInstance} from '../../my-custom-services/DateService';
@@ -392,18 +426,14 @@ import DateService, {DateServiceInstance} from '../../my-custom-services/DateSer
392
426
 
393
427
  @RWSView('your-tag')
394
428
  class YourComponent extends RWSViewComponent {
429
+ //usage in props:
430
+ private @RWSInject(ServiceFASTDIPointer) serviceProperty: ServiceClassType;
431
+
432
+ //usage in constructor:
395
433
  constructor(
396
- @RWSInject(DateService) protected dateService: DateServiceInstance, //custom service - default services from RWSViewComponent below
397
- @RWSInject(ConfigService) protected config: ConfigServiceInstance,
398
- @RWSInject(RoutingService) protected routingService: RoutingServiceInstance,
399
- @RWSInject(DOMService) protected domService: DOMServiceInstance,
400
- @RWSInject(UtilsService) protected utilsService: UtilsServiceInstance,
401
- @RWSInject(ApiService) protected apiService: ApiServiceInstance,
402
- @RWSInject(WSService) protected wsService: WSServiceInstance,
403
- @RWSInject(NotifyService) protected notifyService: NotifyServiceInstance
434
+ private @RWSInject(DateService) protected dateService: DateServiceInstance
404
435
  ) {
405
- super(config, routingService, domService, utilsService, apiService, wsService, notifyService);
406
- applyConstructor(this); //fix-incoming: DI constructor data inheritance problem - applyConstructor in super is bugged. Need tmp workaround.
436
+ super();
407
437
  }
408
438
 
409
439
  someMethod(url: string): void
@@ -414,6 +444,20 @@ class YourComponent extends RWSViewComponent {
414
444
 
415
445
  ```
416
446
 
447
+ Custom service needs to export .getSingleton() as default export and have service class exported as classic export for TS typing:
448
+
449
+ ```typescript
450
+ import { RWSService } from '@rws-framework/client';
451
+
452
+
453
+ class DateService extends RWSService {
454
+ //(...)
455
+ }
456
+
457
+ export default DateService.getSingleton(); // Fast DI service pointer (it points to instanced service in DI container)
458
+ export { DateService as DateServiceInstance }; // the custom service class type
459
+ ```
460
+
417
461
  ## Frontend routes
418
462
 
419
463
  if you are passing routes this is example routing file for frontend:
@@ -525,14 +569,6 @@ Ensure that a notifier is set in the RWS Client to use the `NotifyService` effec
525
569
 
526
570
  If you pass ```{serviceWorker: 'service_worker_class_path.ts'}``` to RWS Webpack wrapper function param, the code will build ServiceWorker to pubDir.
527
571
 
528
- **Remember to have lib field set in tesconfig.json**
529
-
530
- ```json
531
- {
532
- "lib": ["DOM", "ESNext", "WebWorker"]
533
- }
534
- ```
535
-
536
572
  example ServiceWorker class:
537
573
 
538
574
  ```typescript
@@ -662,6 +698,8 @@ class MyServiceWorker extends RWSServiceWorker {
662
698
  MyServiceWorker.create();
663
699
  ```
664
700
 
701
+ **We point to this file in webpack / .rws.json "service_worker" option**
702
+
665
703
  ## Example: WebChat Component
666
704
 
667
705
  The WebChat component demonstrates a practical use of `APIService` in a real-world scenario. It shows how to send and receive data from the backend.
@@ -916,6 +954,47 @@ are defined in backend/src/config/config
916
954
  }
917
955
  ```
918
956
 
919
- ## Links
957
+ ## Other configs
958
+
959
+ ### example tsconfig.json
960
+
961
+ ```json
962
+ {
963
+ "compilerOptions": {
964
+ "baseUrl": "../",
965
+ "experimentalDecorators": true,
966
+ "emitDecoratorMetadata": true,
967
+ "target": "ES2018",
968
+ "module": "es2022",
969
+ "moduleResolution": "node",
970
+ "strict": true,
971
+ "esModuleInterop": true,
972
+ "sourceMap": true,
973
+ "outDir": "dist",
974
+ "strictNullChecks": false,
975
+ "allowSyntheticDefaultImports": true,
976
+ "lib": ["DOM", "ESNext", "WebWorker"],
977
+ "paths": {
978
+ }
979
+ },
980
+ "include": [
981
+ "src",
982
+ "../node_modules/@rws-framework/client/declarations.d.ts", //TEMPORARILY NEEDED TO WORK
983
+ ],
984
+ "exclude": [
985
+ "../node_modules/@rws-framework/client/src/tests"
986
+ ]
987
+ }
988
+ ```
989
+
990
+ **Remember to have lib field set in tsconfig.json**
920
991
 
992
+ ```json
993
+ {
994
+ "lib": ["DOM", "ESNext"]
995
+ }
996
+ ```
997
+
998
+ ## Links
999
+ - https://www.fast.design/docs/fast-element/getting-started ( Base FAST documentation, mostly valid not considering passing styles and templates as RWS handles it with Webpack loaders )
921
1000
  - https://www.webcomponents.org (open-source WebComponents repository)
@@ -10,7 +10,7 @@ const _DEFAULT_CONFIG_VARS = {
10
10
  //Frontend RWS client configs
11
11
  backendUrl: null,
12
12
  wsUrl: null,
13
- partedDirUrlPrefix: '/lib/rws',
13
+ partedDirUrlPrefix: '/',
14
14
  partedPrefix: 'rws',
15
15
  pubUrlFilePrefix: '/',
16
16
  //Universal configs
package/console.js CHANGED
@@ -77,7 +77,7 @@ async function buildSwCmd(){
77
77
 
78
78
  try {
79
79
  console.log(chalk.yellow('[RWS Client]'), 'Installing service worker...');
80
- await tools.runCommand(`${webpackCmd} --config ${path.resolve(moduleDir,'src','service_worker')}/webpack.config.js`, executionDir, false, { env: { SWPATH: firstArg } });
80
+ await tools.runCommand(`${webpackCmd} --config ${path.resolve(moduleDir, 'service_worker')}/webpack.config.js`, executionDir, false, { env: { SWPATH: firstArg } });
81
81
  console.log(chalk.green('[RWS Client]'), 'Service worker installed.');
82
82
  }catch(e){
83
83
  console.error('runerror',e);
@@ -9,24 +9,26 @@
9
9
  --dark-hl-3: #9CDCFE;
10
10
  --light-hl-4: #0070C1;
11
11
  --dark-hl-4: #4FC1FF;
12
- --light-hl-5: #0000FF;
13
- --dark-hl-5: #569CD6;
14
- --light-hl-6: #AF00DB;
15
- --dark-hl-6: #C586C0;
16
- --light-hl-7: #267F99;
17
- --dark-hl-7: #4EC9B0;
18
- --light-hl-8: #008000;
19
- --dark-hl-8: #6A9955;
20
- --light-hl-9: #098658;
21
- --dark-hl-9: #B5CEA8;
22
- --light-hl-10: #800000;
23
- --dark-hl-10: #808080;
12
+ --light-hl-5: #008000;
13
+ --dark-hl-5: #6A9955;
14
+ --light-hl-6: #0000FF;
15
+ --dark-hl-6: #569CD6;
16
+ --light-hl-7: #0451A5;
17
+ --dark-hl-7: #9CDCFE;
18
+ --light-hl-8: #267F99;
19
+ --dark-hl-8: #4EC9B0;
20
+ --light-hl-9: #AF00DB;
21
+ --dark-hl-9: #C586C0;
22
+ --light-hl-10: #098658;
23
+ --dark-hl-10: #B5CEA8;
24
24
  --light-hl-11: #800000;
25
- --dark-hl-11: #569CD6;
26
- --light-hl-12: #E50000;
27
- --dark-hl-12: #9CDCFE;
28
- --light-hl-13: #0000FF;
29
- --dark-hl-13: #CE9178;
25
+ --dark-hl-11: #808080;
26
+ --light-hl-12: #800000;
27
+ --dark-hl-12: #569CD6;
28
+ --light-hl-13: #E50000;
29
+ --dark-hl-13: #9CDCFE;
30
+ --light-hl-14: #0000FF;
31
+ --dark-hl-14: #CE9178;
30
32
  --light-code-background: #FFFFFF;
31
33
  --dark-code-background: #1E1E1E;
32
34
  }
@@ -46,6 +48,7 @@
46
48
  --hl-11: var(--light-hl-11);
47
49
  --hl-12: var(--light-hl-12);
48
50
  --hl-13: var(--light-hl-13);
51
+ --hl-14: var(--light-hl-14);
49
52
  --code-background: var(--light-code-background);
50
53
  } }
51
54
 
@@ -64,6 +67,7 @@
64
67
  --hl-11: var(--dark-hl-11);
65
68
  --hl-12: var(--dark-hl-12);
66
69
  --hl-13: var(--dark-hl-13);
70
+ --hl-14: var(--dark-hl-14);
67
71
  --code-background: var(--dark-code-background);
68
72
  } }
69
73
 
@@ -82,6 +86,7 @@
82
86
  --hl-11: var(--light-hl-11);
83
87
  --hl-12: var(--light-hl-12);
84
88
  --hl-13: var(--light-hl-13);
89
+ --hl-14: var(--light-hl-14);
85
90
  --code-background: var(--light-code-background);
86
91
  }
87
92
 
@@ -100,6 +105,7 @@
100
105
  --hl-11: var(--dark-hl-11);
101
106
  --hl-12: var(--dark-hl-12);
102
107
  --hl-13: var(--dark-hl-13);
108
+ --hl-14: var(--dark-hl-14);
103
109
  --code-background: var(--dark-code-background);
104
110
  }
105
111
 
@@ -117,4 +123,5 @@
117
123
  .hl-11 { color: var(--hl-11); }
118
124
  .hl-12 { color: var(--hl-12); }
119
125
  .hl-13 { color: var(--hl-13); }
126
+ .hl-14 { color: var(--hl-14); }
120
127
  pre, code { background: var(--code-background); }