@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
@@ -1,84 +1,84 @@
1
- import IRWSUser from '../../src/types/IRWSUser';
2
- import RWSContainer from '../../src/components/_container';
3
-
4
- //@4DI
5
- import { Container } from '../../src/components/_container';
6
-
7
- type SWMsgType = {
8
- command: string,
9
- asset_type?: string,
10
- params: any
11
- };
12
-
13
- abstract class RWSServiceWorker<UserType extends IRWSUser> {
14
- protected DI: Container;
15
- protected user: UserType = null;
16
- protected ignoredUrls: RegExp[] = [];
17
- protected regExTypes: { [key: string]: RegExp };
18
-
19
- public workerScope: ServiceWorkerGlobalScope;
20
-
21
- protected static _instances: { [key: string]: RWSServiceWorker<IRWSUser> } | null = {};
22
-
23
- onInit(): Promise<void> { return; }
24
-
25
- onInstall(): Promise<void> { return; }
26
- onActivate(): Promise<void> { return; }
27
-
28
- constructor(workerScope: ServiceWorkerGlobalScope, DI: Container){
29
- this.DI = DI;
30
- this.workerScope = workerScope;
31
-
32
- this.onInit().then(() => {
33
- this.workerScope.addEventListener('install', () => {
34
- console.log('Service Worker: Installed');
35
-
36
- this.onInstall();
37
- });
38
-
39
- this.workerScope.addEventListener('activate', () => {
40
- console.log('[SW] Service Worker: Activated');
41
-
42
- this.onActivate();
43
-
44
- return workerScope.clients.claim();
45
- });
46
- });
47
- }
48
-
49
- sendMessageToClient = (clientId: string, payload: any) => {
50
- return this.workerScope.clients.get(clientId)
51
- .then((client: any) => {
52
- if (client) {
53
- client.postMessage(payload);
54
- }
55
- });
56
- };
57
-
58
- getUser(): UserType
59
- {
60
- return this.user;
61
- }
62
-
63
- setUser(user: UserType): RWSServiceWorker<UserType>
64
- {
65
- this.user = user;
66
-
67
- return this;
68
- }
69
-
70
- static create<T extends new (...args: any[]) => RWSServiceWorker<IRWSUser>>(this: T, workerScope: ServiceWorkerGlobalScope): InstanceType<T>
71
- {
72
- const className = this.name;
73
-
74
- if (!RWSServiceWorker._instances[className]) {
75
- RWSServiceWorker._instances[className] = new this(workerScope, RWSContainer());
76
- }
77
-
78
- return RWSServiceWorker._instances[className] as InstanceType<T>;
79
- }
80
- }
81
-
82
- export default RWSServiceWorker;
83
-
1
+ import IRWSUser from '../../src/types/IRWSUser';
2
+ import RWSContainer from '../../src/components/_container';
3
+
4
+ //@4DI
5
+ import { Container } from '../../src/components/_container';
6
+
7
+ type SWMsgType = {
8
+ command: string,
9
+ asset_type?: string,
10
+ params: any
11
+ };
12
+
13
+ abstract class RWSServiceWorker<UserType extends IRWSUser> {
14
+ protected DI: Container;
15
+ protected user: UserType = null;
16
+ protected ignoredUrls: RegExp[] = [];
17
+ protected regExTypes: { [key: string]: RegExp };
18
+
19
+ public workerScope: ServiceWorkerGlobalScope;
20
+
21
+ protected static _instances: { [key: string]: RWSServiceWorker<IRWSUser> } | null = {};
22
+
23
+ onInit(): Promise<void> { return; }
24
+
25
+ onInstall(): Promise<void> { return; }
26
+ onActivate(): Promise<void> { return; }
27
+
28
+ constructor(workerScope: ServiceWorkerGlobalScope, DI: Container){
29
+ this.DI = DI;
30
+ this.workerScope = workerScope;
31
+
32
+ this.onInit().then(() => {
33
+ this.workerScope.addEventListener('install', () => {
34
+ console.log('Service Worker: Installed');
35
+
36
+ this.onInstall();
37
+ });
38
+
39
+ this.workerScope.addEventListener('activate', () => {
40
+ console.log('[SW] Service Worker: Activated');
41
+
42
+ this.onActivate();
43
+
44
+ return workerScope.clients.claim();
45
+ });
46
+ });
47
+ }
48
+
49
+ sendMessageToClient = (clientId: string, payload: any) => {
50
+ return this.workerScope.clients.get(clientId)
51
+ .then((client: any) => {
52
+ if (client) {
53
+ client.postMessage(payload);
54
+ }
55
+ });
56
+ };
57
+
58
+ getUser(): UserType
59
+ {
60
+ return this.user;
61
+ }
62
+
63
+ setUser(user: UserType): RWSServiceWorker<UserType>
64
+ {
65
+ this.user = user;
66
+
67
+ return this;
68
+ }
69
+
70
+ static create<T extends new (...args: any[]) => RWSServiceWorker<IRWSUser>>(this: T, workerScope: ServiceWorkerGlobalScope): InstanceType<T>
71
+ {
72
+ const className = this.name;
73
+
74
+ if (!RWSServiceWorker._instances[className]) {
75
+ RWSServiceWorker._instances[className] = new this(workerScope, RWSContainer());
76
+ }
77
+
78
+ return RWSServiceWorker._instances[className] as InstanceType<T>;
79
+ }
80
+ }
81
+
82
+ export default RWSServiceWorker;
83
+
84
84
  export { SWMsgType };
@@ -1,21 +1,21 @@
1
- {
2
- "compilerOptions": {
3
- "baseUrl": "./",
4
- "experimentalDecorators": true,
5
- "emitDecoratorMetadata": true,
6
- "target": "ES2018",
7
- "module": "es2022",
8
- "moduleResolution": "node",
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "sourceMap": true,
12
- "outDir": "dist",
13
- "strictNullChecks": false,
14
- "allowSyntheticDefaultImports": true,
15
- "lib": ["DOM", "ESNext", "WebWorker"],
16
- "paths": {
17
- // "@rws-framework/client/*": ["../*"],
18
- // "@rws-framework/client": ["../index"],
19
- }
20
- }
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "./",
4
+ "experimentalDecorators": true,
5
+ "emitDecoratorMetadata": true,
6
+ "target": "ES2018",
7
+ "module": "es2022",
8
+ "moduleResolution": "node",
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "sourceMap": true,
12
+ "outDir": "dist",
13
+ "strictNullChecks": false,
14
+ "allowSyntheticDefaultImports": true,
15
+ "lib": ["DOM", "ESNext", "WebWorker"],
16
+ "paths": {
17
+ // "@rws-framework/client/*": ["../*"],
18
+ // "@rws-framework/client": ["../index"],
19
+ }
20
+ }
21
21
  }
@@ -1,67 +1,67 @@
1
- const path = require('path');
2
- const webpack = require('webpack');
3
- const tools = require('@rws-framework/client/_tools');
4
- const gThis = require.resolve('globalthis')
5
- const {rwsExternals} = require('@rws-framework/client/_rws_externals');
6
-
7
-
8
- const executionDir = process.cwd();
9
- const rootPackageNodeModules = path.resolve(tools.findRootWorkspacePath(process.cwd()), 'node_modules');
10
-
11
- const mergeCodeBaseOptions = {
12
- incl: ['@rws-framework/client/src/services'],
13
- not_incl: ['./services/RoutingService'],
14
- exceptions_context: ['socket.io-', '@socket.io'],
15
- exceptions: ['@rws-framework/client/src/services', './service', './ws_handlers', 'socket.io-', '@socket.io','uuid',]
16
- };
17
-
18
- module.exports = {
19
- entry: process.env.SWPATH,
20
- mode: 'development',
21
- target: 'web',
22
- devtool: 'source-map',
23
- output: {
24
- path: path.resolve(executionDir, 'public'),
25
- filename: 'service_worker.js',
26
- },
27
- resolve: {
28
- extensions: ['.ts', '.js'],
29
- alias: {
30
- document: false,
31
- globalThis: gThis,
32
- '@cwd' : process.cwd(),
33
- // '@rws-framework/client': path.resolve(__dirname, '..') + '/index.ts',
34
- // '@rws-framework/client/*': path.resolve(__dirname, '..', '..')
35
- }
36
- },
37
- plugins: [
38
- new webpack.ProvidePlugin({
39
- global: 'globalThis' // Use 'globalThis' as a fallback for the global object
40
- }),
41
- new webpack.DefinePlugin({
42
- '__SWPATH': "'" + process.env.SWPATH + "'",
43
- }),
44
- ],
45
- module: {
46
- rules: [
47
- {
48
- test: /\.(ts)$/,
49
- use: [
50
- {
51
- loader: 'ts-loader',
52
- options: {
53
- allowTsInNodeModules: true,
54
- configFile: path.resolve(__dirname, 'tsconfig.json')
55
- }
56
- },
57
- {
58
- loader: path.resolve(tools.findPackageDir(),'webpack','rws_fast_ts_loader.js'),
59
- }
60
- ]
61
- }
62
- ],
63
- },
64
- resolveLoader: {
65
- modules: [rootPackageNodeModules],
66
- }
1
+ const path = require('path');
2
+ const webpack = require('webpack');
3
+ const tools = require('@rws-framework/client/_tools');
4
+ const gThis = require.resolve('globalthis')
5
+ const {rwsExternals} = require('@rws-framework/client/_rws_externals');
6
+
7
+
8
+ const executionDir = process.cwd();
9
+ const rootPackageNodeModules = path.resolve(tools.findRootWorkspacePath(process.cwd()), 'node_modules');
10
+
11
+ const mergeCodeBaseOptions = {
12
+ incl: ['@rws-framework/client/src/services'],
13
+ not_incl: ['./services/RoutingService'],
14
+ exceptions_context: ['socket.io-', '@socket.io'],
15
+ exceptions: ['@rws-framework/client/src/services', './service', './ws_handlers', 'socket.io-', '@socket.io','uuid',]
16
+ };
17
+
18
+ module.exports = {
19
+ entry: process.env.SWPATH,
20
+ mode: 'development',
21
+ target: 'web',
22
+ devtool: 'source-map',
23
+ output: {
24
+ path: path.resolve(executionDir, 'public'),
25
+ filename: 'service_worker.js',
26
+ },
27
+ resolve: {
28
+ extensions: ['.ts', '.js'],
29
+ alias: {
30
+ document: false,
31
+ globalThis: gThis,
32
+ '@cwd' : process.cwd(),
33
+ // '@rws-framework/client': path.resolve(__dirname, '..') + '/index.ts',
34
+ // '@rws-framework/client/*': path.resolve(__dirname, '..', '..')
35
+ }
36
+ },
37
+ plugins: [
38
+ new webpack.ProvidePlugin({
39
+ global: 'globalThis' // Use 'globalThis' as a fallback for the global object
40
+ }),
41
+ new webpack.DefinePlugin({
42
+ '__SWPATH': "'" + process.env.SWPATH + "'",
43
+ }),
44
+ ],
45
+ module: {
46
+ rules: [
47
+ {
48
+ test: /\.(ts)$/,
49
+ use: [
50
+ {
51
+ loader: 'ts-loader',
52
+ options: {
53
+ allowTsInNodeModules: true,
54
+ configFile: path.resolve(__dirname, 'tsconfig.json')
55
+ }
56
+ },
57
+ {
58
+ loader: path.resolve(tools.findPackageDir(),'webpack','rws_fast_ts_loader.js'),
59
+ }
60
+ ]
61
+ }
62
+ ],
63
+ },
64
+ resolveLoader: {
65
+ modules: [rootPackageNodeModules],
66
+ }
67
67
  };
@@ -1,68 +1,68 @@
1
- import RWSWindow, { RWSWindowComponentRegister } from "../types/RWSWindow";
2
- import { RWSClientInstance } from "../client";
3
- import RWSViewComponent, { IWithCompose } from "../components/_component";
4
- import { RWSPlugin } from "../plugins/_plugin";
5
- type RWSInfoType = { components: string[] };
6
-
7
- async function loadPartedComponents(this: RWSClientInstance): Promise<RWSInfoType> {
8
- this.assignClientToBrowser();
9
-
10
- return new Promise(async (resolve: (res: RWSInfoType) => void, reject: (res: Error | unknown) => void) => {
11
-
12
- const componentParts: RWSInfoType = await this.apiService.get<RWSInfoType>(this.appConfig.get('partedDirUrlPrefix') + '/rws_info.json');
13
- const loadedComponents = [];
14
-
15
- document.addEventListener(RWSViewComponent._EVENTS.component_define, (event: Event) => {
16
- const customEvent = event as CustomEvent<string>;
17
-
18
- loadedComponents.push(customEvent.detail);
19
- });
20
-
21
- let compList = '';
22
-
23
- componentParts.components.forEach((componentName: string, key: number) => {
24
- const partUrl = `${this.appConfig.get('partedDirUrlPrefix')}/${this.appConfig.get('partedPrefix')}.${componentName}.js`;
25
-
26
- compList += ` - \x1b[1m${componentParts.components[key]}:\x1b[0m component (${partUrl}) \n`;
27
-
28
- const script: HTMLScriptElement = document.createElement('script');
29
- script.async = true;
30
- script.src = partUrl;
31
- script.type = 'text/javascript';
32
- document.body.appendChild(script);
33
- });
34
-
35
- console.info(`\x1b[1m[RWS]\x1b[0m" \x1b[1mPARTED\x1b[0m" mode asynchronously added components: \n${compList}`);
36
-
37
- resolve(componentParts);
38
- });
39
- }
40
-
41
- function defineAllComponents() {
42
- const richWindowComponents: RWSWindowComponentRegister = (window as Window & RWSWindow).RWS.components;
43
-
44
- Object.keys(richWindowComponents).map(key => richWindowComponents[key].component).forEach((el: IWithCompose<RWSViewComponent>) => {
45
- el.define(el as any, el.definition);
46
- });
47
-
48
- for (const plugin of RWSPlugin.getAllPlugins()){
49
- plugin.onComponentsDeclare();
50
- }
51
- }
52
-
53
- function getBinds(this: RWSClientInstance){
54
- return {
55
- loadPartedComponents: loadPartedComponents.bind(this)
56
- };
57
- }
58
-
59
- export default getBinds;
60
-
61
- const ComponentHelperStatic = {
62
- defineAllComponents: defineAllComponents
63
- }
64
-
65
- export {
66
- ComponentHelperStatic,
67
- RWSInfoType
1
+ import RWSWindow, { RWSWindowComponentRegister } from "../types/RWSWindow";
2
+ import { RWSClientInstance } from "../client";
3
+ import RWSViewComponent, { IWithCompose } from "../components/_component";
4
+ import { RWSPlugin } from "../plugins/_plugin";
5
+ type RWSInfoType = { components: string[] };
6
+
7
+ async function loadPartedComponents(this: RWSClientInstance): Promise<RWSInfoType> {
8
+ this.assignClientToBrowser();
9
+
10
+ return new Promise(async (resolve: (res: RWSInfoType) => void, reject: (res: Error | unknown) => void) => {
11
+
12
+ const componentParts: RWSInfoType = await this.apiService.get<RWSInfoType>(this.appConfig.get('partedDirUrlPrefix') + '/rws_info.json');
13
+ const loadedComponents = [];
14
+
15
+ document.addEventListener(RWSViewComponent._EVENTS.component_define, (event: Event) => {
16
+ const customEvent = event as CustomEvent<string>;
17
+
18
+ loadedComponents.push(customEvent.detail);
19
+ });
20
+
21
+ let compList = '';
22
+
23
+ componentParts.components.forEach((componentName: string, key: number) => {
24
+ const partUrl = `${this.appConfig.get('partedDirUrlPrefix')}/${this.appConfig.get('partedPrefix')}.${componentName}.js`;
25
+
26
+ compList += ` - \x1b[1m${componentParts.components[key]}:\x1b[0m component (${partUrl}) \n`;
27
+
28
+ const script: HTMLScriptElement = document.createElement('script');
29
+ script.async = true;
30
+ script.src = partUrl;
31
+ script.type = 'text/javascript';
32
+ document.body.appendChild(script);
33
+ });
34
+
35
+ console.info(`\x1b[1m[RWS]\x1b[0m" \x1b[1mPARTED\x1b[0m" mode asynchronously added components: \n${compList}`);
36
+
37
+ resolve(componentParts);
38
+ });
39
+ }
40
+
41
+ function defineAllComponents() {
42
+ const richWindowComponents: RWSWindowComponentRegister = (window as Window & RWSWindow).RWS.components;
43
+
44
+ Object.keys(richWindowComponents).map(key => richWindowComponents[key].component).forEach((el: IWithCompose<RWSViewComponent>) => {
45
+ el.define(el as any, el.definition);
46
+ });
47
+
48
+ for (const plugin of RWSPlugin.getAllPlugins()){
49
+ plugin.onComponentsDeclare();
50
+ }
51
+ }
52
+
53
+ function getBinds(this: RWSClientInstance){
54
+ return {
55
+ loadPartedComponents: loadPartedComponents.bind(this)
56
+ };
57
+ }
58
+
59
+ export default getBinds;
60
+
61
+ const ComponentHelperStatic = {
62
+ defineAllComponents: defineAllComponents
63
+ }
64
+
65
+ export {
66
+ ComponentHelperStatic,
67
+ RWSInfoType
68
68
  }