@rws-framework/client 2.7.2 → 2.8.0
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/.emerge-vis-output/fast-element/emerge-file_result_dependency_graph.graphml +126 -127
- package/.emerge-vis-output/fast-element/emerge-filesystem_graph.graphml +122 -123
- package/.emerge-vis-output/fast-element/emerge-statistics-and-metrics.json +1 -1
- package/.emerge-vis-output/fast-element/emerge-statistics-metrics.txt +43 -44
- package/.emerge-vis-output/fast-element/html/emerge.html +0 -0
- package/.emerge-vis-output/fast-element/html/jsconfig.json +0 -0
- package/.emerge-vis-output/fast-element/html/resources/css/custom.css +0 -0
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_common.js +0 -0
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_data.js +9 -9
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_git.js +0 -0
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_graph.js +0 -0
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_heatmap.js +0 -0
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_hull.js +0 -0
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_main.js +0 -0
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_search.js +0 -0
- package/.emerge-vis-output/fast-element/html/resources/js/emerge_ui.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.min.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.min.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.rtl.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.rtl.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.min.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.min.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.min.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.min.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.min.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.min.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.rtl.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.rtl.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.rtl.min.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/css/bootstrap.rtl.min.css.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.bundle.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.bundle.js.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.bundle.min.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.bundle.min.js.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.esm.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.esm.js.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.esm.min.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.esm.min.js.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.js.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.min.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/bootstrap/js/bootstrap.min.js.map +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/d3/d3.v7.8.4.min.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/d3/d3.v7.min.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/dark-mode-switch/css/dark-mode.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/dark-mode-switch/js/dark-mode-switch.min.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/daterangepicker/daterangepicker.css +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/daterangepicker/daterangepicker.min.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/daterangepicker/moment.min.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/jquery/jquery-3.6.0.min.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/popper/popper.min.js +0 -0
- package/.emerge-vis-output/fast-element/html/vendors/simpleheat/simpleheat.js +0 -0
- package/.emerge-vis-output/fast-foundation/emerge-file_result_dependency_graph.graphml +1351 -1339
- package/.emerge-vis-output/fast-foundation/emerge-filesystem_graph.graphml +1314 -1299
- package/.emerge-vis-output/fast-foundation/emerge-statistics-and-metrics.json +1 -1
- package/.emerge-vis-output/fast-foundation/emerge-statistics-metrics.txt +1024 -1016
- package/.emerge-vis-output/fast-foundation/html/emerge.html +0 -0
- package/.emerge-vis-output/fast-foundation/html/jsconfig.json +0 -0
- package/.emerge-vis-output/fast-foundation/html/resources/css/custom.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_common.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_data.js +9 -9
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_git.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_graph.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_heatmap.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_hull.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_main.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_search.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/resources/js/emerge_ui.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.min.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.min.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.rtl.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.rtl.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-grid.rtl.min.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.min.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.min.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.rtl.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-reboot.rtl.min.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.min.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.min.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.rtl.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap-utilities.rtl.min.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.min.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.min.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.rtl.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.rtl.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.rtl.min.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/css/bootstrap.rtl.min.css.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.bundle.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.bundle.js.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.bundle.min.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.bundle.min.js.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.esm.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.esm.js.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.esm.min.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.esm.min.js.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.js.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.min.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/bootstrap/js/bootstrap.min.js.map +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/d3/d3.v7.8.4.min.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/d3/d3.v7.min.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/dark-mode-switch/css/dark-mode.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/dark-mode-switch/js/dark-mode-switch.min.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/daterangepicker/daterangepicker.css +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/daterangepicker/daterangepicker.min.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/daterangepicker/moment.min.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/jquery/jquery-3.6.0.min.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/popper/popper.min.js +0 -0
- package/.emerge-vis-output/fast-foundation/html/vendors/simpleheat/simpleheat.js +0 -0
- package/.emerge-vis-output/rws-client/emerge-file_result_dependency_graph.graphml +61 -61
- package/.emerge-vis-output/rws-client/emerge-filesystem_graph.graphml +34 -34
- package/.emerge-vis-output/rws-client/emerge-statistics-and-metrics.json +1 -1
- package/.emerge-vis-output/rws-client/emerge-statistics-metrics.txt +623 -623
- package/.emerge-vis-output/rws-client/html/resources/js/emerge_data.js +9 -9
- package/_tools.js +22 -21
- package/docs/.nojekyll +0 -0
- package/docs/assets/26e93147f10415a0ed4a.svg +0 -0
- package/docs/assets/75c9471662e97ee24f29.svg +0 -0
- package/docs/assets/db90e4df2373980c497d.svg +0 -0
- package/docs/assets/hierarchy.css +0 -0
- package/docs/assets/hierarchy.js +0 -0
- package/docs/assets/highlight.css +0 -0
- package/docs/assets/icons.js +0 -0
- package/docs/assets/icons.svg +0 -0
- package/docs/assets/main.js +0 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +0 -0
- package/docs/classes/ApiServiceInstance.html +2 -2
- package/docs/classes/ConfigServiceInstance.html +2 -2
- package/docs/classes/DOMServiceInstance.html +2 -2
- package/docs/classes/NotifyServiceInstance.html +2 -2
- package/docs/classes/RWSRouter.html +2 -2
- package/docs/classes/RWSService.html +2 -2
- package/docs/classes/RWSViewComponent.html +22 -22
- package/docs/classes/RoutingServiceInstance.html +2 -2
- package/docs/classes/ServiceWorkerServiceInstance.html +2 -2
- package/docs/classes/UtilsServiceInstance.html +2 -2
- package/docs/classes/WSServiceInstance.html +2 -2
- package/docs/functions/ApiService.html +1 -1
- package/docs/functions/ConfigService.html +1 -1
- package/docs/functions/DOMService.html +1 -1
- package/docs/functions/NotifyService.html +1 -1
- package/docs/functions/RWSContainer.html +1 -1
- package/docs/functions/RWSIgnore.html +1 -1
- package/docs/functions/RWSInject.html +1 -1
- package/docs/functions/RWSView.html +1 -1
- package/docs/functions/RoutingService.html +1 -1
- package/docs/functions/ServiceWorkerService.html +1 -1
- package/docs/functions/UtilsService.html +1 -1
- package/docs/functions/WSService.html +1 -1
- package/docs/functions/attr.html +0 -0
- package/docs/functions/declareRWSComponents.html +1 -1
- package/docs/functions/ngAttr.html +1 -1
- package/docs/functions/observable.html +0 -0
- package/docs/functions/provideRWSDesignSystem.html +1 -1
- package/docs/functions/realtimeWebSuiteClientPackage.html +1 -1
- package/docs/functions/renderRouteComponent.html +1 -1
- package/docs/functions/sanitizedAttr.html +1 -1
- package/docs/hierarchy.html +0 -0
- package/docs/index.html +0 -0
- package/docs/interfaces/HTMLAttributes.html +0 -0
- package/docs/interfaces/HTMLTag.html +0 -0
- package/docs/interfaces/IRWSConfig.html +2 -2
- package/docs/interfaces/IRWSDecoratorOptions.html +2 -2
- package/docs/interfaces/IRWSHttpRoute.html +2 -2
- package/docs/interfaces/IRWSPrefixedHTTProutes.html +2 -2
- package/docs/interfaces/IRWSUser.html +2 -2
- package/docs/interfaces/IRoutingEvent.html +2 -2
- package/docs/modules.html +0 -0
- package/docs/types/DOMOutputType.html +1 -1
- package/docs/types/HTMLTagTransformerType.html +0 -0
- package/docs/types/IRWSAssetShowOptions.html +1 -1
- package/docs/types/IRWSBackendRoute.html +1 -1
- package/docs/types/IRWSFrontRoutes.html +1 -1
- package/docs/types/IRWSRouteResult.html +1 -1
- package/docs/types/IRWSWebsocketStatus.html +1 -1
- package/docs/types/NotifyLogType.html +1 -1
- package/docs/types/NotifyUiType.html +1 -1
- package/docs/types/RWSNotify.html +1 -1
- package/docs/types/RouteReturn.html +1 -1
- package/docs/types/TagsProcessorType.html +1 -1
- package/docs/variables/_ROUTING_EVENT_NAME.html +1 -1
- package/package.json +1 -1
- package/rws.webpack.config.js +24 -20
- package/src/client/components.ts +16 -4
- package/src/client/config.ts +38 -7
- package/src/client.ts +12 -17
- package/src/components/_component.ts +1 -3
- package/src/components/_decorator.ts +20 -3
- package/src/components/index.ts +1 -3
- package/src/components/loader/component.ts +1 -1
- package/src/index.ts +12 -26
- package/src/interfaces/IRWSConfig.ts +6 -1
- package/src/interfaces/RWSWindow.ts +5 -2
- package/src/plugins/_builder.js +32 -0
- package/src/plugins/_plugin.ts +63 -0
- package/src/services/ConfigService.ts +9 -1
- package/src/services/ServiceWorkerService.ts +1 -1
- package/tsconfig.json +3 -0
- package/webpack/loaders/rws_fast_ts_loader.js +14 -28
- package/package.webpack.config.js +0 -17
- package/src/components/router/component.ts +0 -79
- package/src/components/router/template.html +0 -1
- package/src/routing/_router.ts +0 -61
- package/src/routing/index.ts +0 -7
- package/src/run.ts +0 -33
- package/src/services/RoutingService.ts +0 -47
- package/src/services/WSService.ts +0 -226
- package/tsdoc.json +0 -0
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';
|
|
13
|
+
import { sanitizedAttr } from './components/_attrs/sanitize-html';
|
|
15
14
|
import { ngAttr } from './components/_attrs/angular-attr';
|
|
16
|
-
import
|
|
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
|
|
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){
|
package/tsconfig.json
CHANGED
|
@@ -32,8 +32,8 @@ module.exports = async function(content) {
|
|
|
32
32
|
const filePath = this.resourcePath;
|
|
33
33
|
const isDev = this._compiler.options.dev;
|
|
34
34
|
|
|
35
|
-
const
|
|
36
|
-
const tsSourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
35
|
+
const RWSViewRegex = /(@RWSView\([^)]*)\)/;
|
|
36
|
+
const tsSourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
37
37
|
|
|
38
38
|
let templatePath = 'template.html';
|
|
39
39
|
let stylesPath = 'styles/layout.scss';
|
|
@@ -72,29 +72,7 @@ module.exports = async function(content) {
|
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
try {
|
|
75
|
-
if(tagName){
|
|
76
|
-
|
|
77
|
-
const lines = content.split('\n');
|
|
78
|
-
const textToInsert = `static definition = { name: '${tagName}', template: rwsTemplate, styles${addedParams.length? ', ' + (addedParams.join(', ')) : ''} };`;
|
|
79
|
-
|
|
80
|
-
let modifiedContent = '';
|
|
81
|
-
let insertIndex = -1;
|
|
82
|
-
|
|
83
|
-
lines.forEach((line, index) => {
|
|
84
|
-
modifiedContent += line + '\n';
|
|
85
|
-
|
|
86
|
-
if (regex.test(line)) {
|
|
87
|
-
insertIndex = index + 2; // Set the position two lines below the match
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (index === insertIndex) {
|
|
91
|
-
modifiedContent += textToInsert + '\n'; // Insert the text
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
replaced = modifiedContent;
|
|
96
|
-
replaced = replaced.replace(`@RWSView('${tagName}')`, '');
|
|
97
|
-
|
|
75
|
+
if(tagName){
|
|
98
76
|
let styles = 'const styles: null = null;'
|
|
99
77
|
|
|
100
78
|
if(fs.existsSync(path.dirname(filePath) + '/styles')){
|
|
@@ -123,16 +101,24 @@ module.exports = async function(content) {
|
|
|
123
101
|
`;
|
|
124
102
|
}
|
|
125
103
|
|
|
126
|
-
|
|
104
|
+
const viewReg = /(@RWSView\(\s*'[^']*'\s*(,\s*\{[^}]*\})?\s*)\)/s
|
|
105
|
+
|
|
106
|
+
const replacedViewDecoratorContent = processedContent.replace(
|
|
107
|
+
viewReg,
|
|
108
|
+
`$1, ${addedParams.length ? '' : 'null, '}{ template: rwsTemplate, styles${addedParams.length? ', options: {' + (addedParams.join(', ')) + '}': ''} })`
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
processedContent = `import * as T from '@microsoft/fast-element';\n${template}\n${styles}\n${addedParamDefs.join('\n')}\n` + replacedViewDecoratorContent;
|
|
127
112
|
}
|
|
128
113
|
|
|
129
|
-
//
|
|
114
|
+
// if(filePath.indexOf('home') > -1){
|
|
115
|
+
// fs.writeFileSync(filePath.replace('.ts','.debug.ts'), processedContent); //for final RWS TS preview.
|
|
116
|
+
// }
|
|
130
117
|
|
|
131
118
|
return processedContent;
|
|
132
119
|
|
|
133
120
|
}catch(e){
|
|
134
121
|
console.error(e);
|
|
135
|
-
console.warn('IN:\n\n');
|
|
136
122
|
return content;
|
|
137
123
|
}
|
|
138
124
|
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
4
|
-
const RWSWebpackWrapper = require('./rws.webpack.config');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const executionDir = process.cwd();
|
|
8
|
-
|
|
9
|
-
module.exports = RWSWebpackWrapper({
|
|
10
|
-
dev: true,
|
|
11
|
-
hot: false,
|
|
12
|
-
entry: `./src/index.ts`,
|
|
13
|
-
tsConfigPath: './tsconfig.json',
|
|
14
|
-
executionDir: __dirname,
|
|
15
|
-
outputDir: path.resolve(__dirname, 'build'),
|
|
16
|
-
outputFileName: 'rws.client.js'
|
|
17
|
-
});
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { observable } from '@microsoft/fast-element';
|
|
2
|
-
import RoutingService, { RWSRouter, _ROUTING_EVENT_NAME, RouteReturn, RoutingServiceInstance } from '../../services/RoutingService';
|
|
3
|
-
import RWSViewComponent, { IRWSViewComponent } from '../_component';
|
|
4
|
-
import {RWSInject, RWSView} from '../_decorator';
|
|
5
|
-
|
|
6
|
-
@RWSView('rws-router', { ignorePackaging: true})
|
|
7
|
-
export class RouterComponent extends RWSViewComponent {
|
|
8
|
-
static autoLoadFastElement = false;
|
|
9
|
-
private routing: RWSRouter;
|
|
10
|
-
private currentComponent: IRWSViewComponent;
|
|
11
|
-
|
|
12
|
-
@observable currentUrl: string;
|
|
13
|
-
@observable childComponents: HTMLElement[] = [];
|
|
14
|
-
slotEl: HTMLElement = null;
|
|
15
|
-
|
|
16
|
-
constructor(@RWSInject(RoutingService) protected routingService: RoutingServiceInstance){
|
|
17
|
-
super();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
connectedCallback() {
|
|
21
|
-
super.connectedCallback();
|
|
22
|
-
|
|
23
|
-
this.routing = this.routingService.apply(this);
|
|
24
|
-
|
|
25
|
-
if(this.currentUrl){
|
|
26
|
-
this.handleRoute(this.routing.handleRoute(this.currentUrl));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
currentUrlChanged(oldValue: string, newValue: string){
|
|
31
|
-
if(newValue){
|
|
32
|
-
if(!this.routingService){
|
|
33
|
-
console.log(oldValue, newValue);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if(!this.routing){
|
|
38
|
-
this.routing = this.routingService.apply(this);
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
this.handleRoute(this.routing.handleRoute(newValue));
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
private handleRoute(route: RouteReturn){
|
|
46
|
-
const [routeName, childComponent, routeParams] = route;
|
|
47
|
-
|
|
48
|
-
this.$emit(_ROUTING_EVENT_NAME, {
|
|
49
|
-
routeName,
|
|
50
|
-
component: childComponent
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
console.log('handleroute',{
|
|
54
|
-
routeName,
|
|
55
|
-
component: childComponent
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
const newComponent = document.createElement((childComponent as any).definition.name);
|
|
59
|
-
if(Object.keys(routeParams).length){
|
|
60
|
-
newComponent.routeParams = routeParams;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if(this.currentComponent){
|
|
64
|
-
this.getShadowRoot().removeChild(this.currentComponent);
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
this.currentComponent = newComponent;
|
|
69
|
-
|
|
70
|
-
this.getShadowRoot().appendChild(newComponent);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
addComponent(component: any) {
|
|
74
|
-
|
|
75
|
-
this.slotEl = component;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
RouterComponent.defineComponent();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<div class="router"></div>
|
package/src/routing/_router.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import Router from 'url-router';
|
|
2
|
-
import {UtilsServiceInstance} from '../services/UtilsService';
|
|
3
|
-
import { IRWSViewComponent } from '../interfaces/IRWSViewComponent';
|
|
4
|
-
export type RouteReturn = [string, IRWSViewComponent, Record<string, string>];
|
|
5
|
-
export type IRWSRouteResult = {
|
|
6
|
-
handler: () => RouteReturn;
|
|
7
|
-
params: Record<string, string>;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
class RWSRouter {
|
|
11
|
-
private baseComponent: IRWSViewComponent;
|
|
12
|
-
private urlRouter: Router<any>;
|
|
13
|
-
private utilsService: UtilsServiceInstance;
|
|
14
|
-
|
|
15
|
-
constructor(routerComponent: IRWSViewComponent, urlRouter: Router<any>, utilsService: UtilsServiceInstance){
|
|
16
|
-
this.baseComponent = routerComponent;
|
|
17
|
-
this.urlRouter = urlRouter;
|
|
18
|
-
this.utilsService = utilsService;
|
|
19
|
-
|
|
20
|
-
window.addEventListener('popstate', (event: Event) => {
|
|
21
|
-
console.log('pop', event);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public routeComponent(newComponent: IRWSViewComponent)
|
|
26
|
-
{
|
|
27
|
-
this.baseComponent.appendChild(newComponent);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public fireHandler(route: IRWSRouteResult): RouteReturn
|
|
31
|
-
{
|
|
32
|
-
const handler = route.handler();
|
|
33
|
-
return [handler[0], handler[1], this.utilsService.mergeDeep(route.params, handler[2])];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public handleRoute(url: string): RouteReturn
|
|
37
|
-
{
|
|
38
|
-
const currentRoute = this.find(url);
|
|
39
|
-
console.log('CR', currentRoute);
|
|
40
|
-
|
|
41
|
-
if (history.pushState) {
|
|
42
|
-
window.history.pushState({ path: url }, '', url);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return this.fireHandler(currentRoute);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public handleCurrentRoute(): RouteReturn
|
|
49
|
-
{
|
|
50
|
-
const currentRoute = this.find(window.location.pathname);
|
|
51
|
-
|
|
52
|
-
return this.fireHandler(currentRoute);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public find(url: string): IRWSRouteResult
|
|
56
|
-
{
|
|
57
|
-
return this.urlRouter.find(url);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export { RWSRouter };
|
package/src/routing/index.ts
DELETED
package/src/run.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ConfigServiceInstance } from './services/ConfigService';
|
|
2
|
-
import { NotifyServiceInstance } from './services/NotifyService';
|
|
3
|
-
import { WSServiceInstance} from './services/WSService';
|
|
4
|
-
|
|
5
|
-
import { RoutingServiceInstance} from './services/RoutingService';
|
|
6
|
-
|
|
7
|
-
const main = async (
|
|
8
|
-
config: ConfigServiceInstance,
|
|
9
|
-
WSService: WSServiceInstance,
|
|
10
|
-
NotifyService: NotifyServiceInstance,
|
|
11
|
-
RoutingService: RoutingServiceInstance
|
|
12
|
-
): Promise<boolean> => {
|
|
13
|
-
if(config.get('backendUrl')){
|
|
14
|
-
WSService.on('ws:disconnected', (instance, params) => {
|
|
15
|
-
NotifyService.notify(`Your websocket client disconnected from the server. Your ID was <strong>${params.socketId}</strong>`, 'error');
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
WSService.on('ws:connected', (instance, params) => {
|
|
19
|
-
NotifyService.notify('You are connected to websocket. Your ID is: <strong>' + instance.socket().id + '</strong>', 'info');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
WSService.on('ws:reconnect', (instance, params) => {
|
|
23
|
-
console.info('WS RECONNECTION ' + (params.reconnects + 1));
|
|
24
|
-
NotifyService.notify('Your websocket client has tried to reconnect to server. Attempt #' + (params.reconnects+1), 'warning');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
WSService.init(config.get('wsUrl'), config.get('user'), config.get('transports'));
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return true;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default main;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import TheService from './_service';
|
|
3
|
-
import Router from 'url-router';
|
|
4
|
-
import { RWSRouter, IRWSRouteResult, RouteReturn } from '../routing/_router';
|
|
5
|
-
import UtilsService, {UtilsServiceInstance} from './UtilsService';
|
|
6
|
-
import { IRWSViewComponent } from '../interfaces/IRWSViewComponent';
|
|
7
|
-
import ConfigService, { ConfigServiceInstance } from './ConfigService';
|
|
8
|
-
|
|
9
|
-
type IFrontRoutes = Record<string, unknown>;
|
|
10
|
-
|
|
11
|
-
class RoutingService extends TheService {
|
|
12
|
-
static _DEFAULT: boolean = true;
|
|
13
|
-
private router: Router<any>;
|
|
14
|
-
private routes: IFrontRoutes;
|
|
15
|
-
|
|
16
|
-
constructor(@UtilsService private utilsService: UtilsServiceInstance, @ConfigService private config: ConfigServiceInstance){
|
|
17
|
-
super();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public apply(comp: IRWSViewComponent): RWSRouter
|
|
21
|
-
{
|
|
22
|
-
this.routes = this.config.get('routes');
|
|
23
|
-
this.router = new Router(this.routes);
|
|
24
|
-
|
|
25
|
-
return new RWSRouter(comp, this.router, this.utilsService);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
public routeHandler = <T>(comp: T) => () => {
|
|
29
|
-
return comp;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
public getRoutes(): IFrontRoutes
|
|
33
|
-
{
|
|
34
|
-
return this.routes;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const renderRouteComponent = <T>(routeName: string, cmp: T, defaultRouteParams: any = {}) => (): [string, T, any] => [routeName, cmp, defaultRouteParams];
|
|
39
|
-
|
|
40
|
-
const _ROUTING_EVENT_NAME = 'routing.route.change';
|
|
41
|
-
interface IRoutingEvent {
|
|
42
|
-
routeName: string,
|
|
43
|
-
component: IRWSViewComponent
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default RoutingService.getSingleton();
|
|
47
|
-
export { RoutingService as RoutingServiceInstance, IFrontRoutes, RWSRouter, IRWSRouteResult, renderRouteComponent, RouteReturn, _ROUTING_EVENT_NAME, IRoutingEvent};
|