@rws-framework/client 2.12.0 → 2.13.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.
Files changed (55) hide show
  1. package/builder/vite/index.ts +5 -0
  2. package/builder/vite/rws.vite.config.ts +44 -0
  3. package/{webpack → builder/webpack}/index.js +3 -1
  4. package/{webpack → builder/webpack}/loaders/rws_fast_html_loader.js +8 -0
  5. package/{webpack → builder/webpack}/loaders/rws_fast_scss_loader.js +8 -1
  6. package/{webpack → builder/webpack}/loaders/rws_fast_ts_loader.js +1 -1
  7. package/{rws.webpack.config.js → builder/webpack/rws.webpack.config.js} +18 -13
  8. package/cfg/build_steps/vite/_build_config.ts +106 -0
  9. package/cfg/build_steps/vite/_env_defines.ts +17 -0
  10. package/cfg/build_steps/vite/_loaders.ts +183 -0
  11. package/cfg/build_steps/vite/index.ts +3 -0
  12. package/cfg/build_steps/vite/loaders/html.ts +14 -0
  13. package/cfg/build_steps/vite/loaders/index.ts +9 -0
  14. package/cfg/build_steps/vite/loaders/loader.type.ts +4 -0
  15. package/cfg/build_steps/vite/loaders/scss.ts +20 -0
  16. package/cfg/build_steps/vite/loaders/ts.ts +19 -0
  17. package/cfg/build_steps/vite/rws_scss_plugin.ts +63 -0
  18. package/cfg/build_steps/vite/scss/_compiler.ts +101 -0
  19. package/cfg/build_steps/vite/scss/_fonts.ts +81 -0
  20. package/cfg/build_steps/vite/scss/_fs.ts +82 -0
  21. package/cfg/build_steps/vite/scss/_import.ts +185 -0
  22. package/cfg/build_steps/vite/types.ts +7 -0
  23. package/cfg/build_steps/webpack/_actions.js +0 -0
  24. package/cfg/build_steps/webpack/_build_config.js +0 -0
  25. package/cfg/build_steps/webpack/_component_handling.js +0 -0
  26. package/cfg/build_steps/webpack/_dev_servers.js +0 -0
  27. package/cfg/build_steps/webpack/_env_defines.js +2 -7
  28. package/cfg/build_steps/webpack/_loaders.js +0 -6
  29. package/cfg/build_steps/webpack/_plugins.js +0 -0
  30. package/cfg/build_steps/webpack/_webpack_config.js +6 -1
  31. package/package.json +3 -2
  32. package/src/client/config.ts +2 -2
  33. package/src/client.ts +1 -1
  34. package/src/components/_component.ts +4 -2
  35. package/src/components/_container.ts +2 -6
  36. package/src/components/_decorator.ts +1 -1
  37. package/src/components/_definitions.ts +0 -1
  38. package/src/components/_event_handling.ts +1 -1
  39. package/src/index.ts +60 -70
  40. package/src/services/ApiService.ts +1 -8
  41. package/src/services/_service.ts +2 -2
  42. package/src/styles/_grid.scss +16 -8
  43. package/src/styles/_scrollbars.scss +1 -0
  44. package/src/styles/includes.scss +0 -1
  45. package/src/types/IRWSConfig.ts +2 -2
  46. package/src/types/IRWSPlugin.ts +3 -5
  47. /package/{webpack → builder/webpack}/after/copy.js +0 -0
  48. /package/{webpack → builder/webpack}/after/sw.js +0 -0
  49. /package/{webpack → builder/webpack}/loaders/ts/html_error.js +0 -0
  50. /package/{webpack → builder/webpack}/rws_scss_plugin.js +0 -0
  51. /package/{webpack → builder/webpack}/rws_webpack_plugin.js +0 -0
  52. /package/{webpack → builder/webpack}/scss/_compiler.js +0 -0
  53. /package/{webpack → builder/webpack}/scss/_fonts.js +0 -0
  54. /package/{webpack → builder/webpack}/scss/_fs.js +0 -0
  55. /package/{webpack → builder/webpack}/scss/_import.js +0 -0
@@ -0,0 +1,101 @@
1
+ const sass = require('sass');
2
+ const path = require('path');
3
+ const chalk = require('chalk');
4
+ const emojiRegex = require('emoji-regex');
5
+
6
+ import _scss_fonts_builder from './_fonts';
7
+ let _scss_fonts: any = null;
8
+
9
+ import _scss_import_builder from './_import';
10
+ let _scss_import: any = null;
11
+
12
+ function compileScssCode(scssCode, fileRootDir, createFile = false, filePath = null, minify = false): {
13
+ code: string,
14
+ dependencies: string[]
15
+ }
16
+ {
17
+ _scss_fonts = _scss_fonts_builder(this);
18
+ _scss_import = _scss_import_builder(this);
19
+
20
+ const [scssImports] = _scss_import.extractScssImports(scssCode, fileRootDir);
21
+
22
+ const dependencies = scssImports.map((item) => item[2]);
23
+
24
+ if (scssImports && scssImports.length) {
25
+ scssCode = _scss_import.replaceImports(_scss_import.processImports(scssImports, fileRootDir), scssCode);
26
+ }
27
+
28
+ const uses = _scss_import.extractScssUses(scssCode)[0];
29
+ let scssUses = '';
30
+
31
+
32
+ uses.forEach(scssUse => {
33
+ const useLine = scssUse[1];
34
+ if(scssCode.indexOf(useLine) === -1){
35
+ scssUses += useLine + '\n';
36
+ scssCode = scssCode.replace(useLine + '\n', '');
37
+ }
38
+ });
39
+
40
+ scssCode = removeComments(scssUses + scssCode);
41
+
42
+ try {
43
+ const result = sass.compileString(scssCode, { loadPaths: [fileRootDir]});
44
+
45
+ let compiledCode = result.css.toString();
46
+ compiledCode = _scss_fonts.replaceFontUrlWithBase64(compiledCode);
47
+ compiledCode = replaceEmojisWithQuestionMark(compiledCode, fileRootDir);
48
+ return { code: compiledCode, dependencies};
49
+ } catch (err) {
50
+ console.error('SASS Error in', fileRootDir);
51
+
52
+ console.error(err);
53
+ throw err;
54
+ };
55
+ }
56
+
57
+ function checkForImporterType(_module, checkTypeExt) {
58
+ let importingFileExtension = '';
59
+
60
+ if (_module && _module.issuer && _module.issuer.resource) {
61
+ importingFileExtension = path.extname(_module.issuer.resource);
62
+ if (importingFileExtension === ('.' + checkTypeExt)) {
63
+ return true;
64
+ }
65
+ } else {
66
+ return false;
67
+ }
68
+
69
+ return false
70
+ }
71
+
72
+ function replaceEmojisWithQuestionMark(code, componentDir) {
73
+ const regex = emojiRegex();
74
+ let hasEmoji = false;
75
+
76
+ const result = code.replace(regex, (match) => {
77
+ hasEmoji = true;
78
+ return '?';
79
+ });
80
+
81
+ if (hasEmoji) {
82
+ console.log(chalk.yellow(`Emojis in css detected and replaced with "?" in "${path.dirname(componentDir)}" component`));
83
+ }
84
+
85
+ return result;
86
+ }
87
+
88
+ function removeComments(code) {
89
+ code = code.replace(/\/\/.*$/gm, '');
90
+ code = code.replace(/\/\*[\s\S]*?\*\//g, '');
91
+ code = code.replace(/^\s*$(?:\r\n?|\n)/gm, '');
92
+
93
+ return code;
94
+ }
95
+
96
+ export default function(element) {
97
+ return {
98
+ checkForImporterType: checkForImporterType.bind(element),
99
+ compileScssCode: compileScssCode.bind(element)
100
+ };
101
+ };
@@ -0,0 +1,81 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const FONT_REGEX = /url\(['"]?(.+?\.(woff|woff2|eot|ttf|otf))['"]?\)/gm;
4
+
5
+ const _scss_import_builder = require('./_import');
6
+ let _scss_import: any = null;
7
+
8
+ function hasFontEmbeds(css) {
9
+ return FONT_REGEX.test(css);
10
+ }
11
+
12
+ function embedFontsInCss(css, cssFilePath) {
13
+ let match;
14
+
15
+ while ((match = FONT_REGEX.exec(css)) !== null) {
16
+ const fontPath = match[1];
17
+ const absoluteFontPath = path.resolve(path.dirname(cssFilePath), fontPath);
18
+
19
+ if (fs.existsSync(absoluteFontPath)) {
20
+ const fontData = fs.readFileSync(absoluteFontPath);
21
+ const base64Font = fontData.toString('base64');
22
+ const fontMimeType = getFontMimeType(path.extname(absoluteFontPath));
23
+ const fontDataURL = `data:${fontMimeType};base64,${base64Font}`;
24
+
25
+ css = css.replace(new RegExp(match[0], 'g'), `url(${fontDataURL})`);
26
+ }
27
+ }
28
+
29
+ return css;
30
+ }
31
+
32
+ function getFontMimeType(extension) {
33
+ switch (extension) {
34
+ case '.woff': return 'font/woff';
35
+ case '.woff2': return 'font/woff2';
36
+ case '.eot': return 'application/vnd.ms-fontobject';
37
+ case '.ttf': return 'font/ttf';
38
+ case '.otf': return 'font/otf';
39
+ default: return 'application/octet-stream';
40
+ }
41
+ }
42
+
43
+ function convertFontToBase64(fontPath) {
44
+ return fs.readFileSync(fontPath, { encoding: 'base64' });
45
+ }
46
+
47
+ function replaceFontUrlWithBase64(cssContent) {
48
+ const fontFaceRegex = /@font-face\s*\{[^}]*\}/g;
49
+ let fontFaces = [...cssContent.matchAll(fontFaceRegex)];
50
+ _scss_import = _scss_import_builder(this);
51
+
52
+ for (const fontFace of fontFaces) {
53
+ const fontFaceContent = fontFace[0];
54
+ const urlRegex = /url\((['"]?)([^)'"]+)(\1)\)/g;
55
+ let match;
56
+
57
+ let modifiedFontFaceContent = fontFaceContent;
58
+
59
+ while ((match = urlRegex.exec(fontFaceContent)) !== null) {
60
+ // Create a promise to convert each font to Base64 and replace in CSS
61
+ const base64 = convertFontToBase64(_scss_import.processImportPath(match[2], null, true));
62
+ const base64Font = `data:font/woff2;base64,${base64}`;
63
+
64
+ modifiedFontFaceContent = modifiedFontFaceContent.replace(match[2], base64Font);
65
+ }
66
+
67
+ cssContent = cssContent.replace(fontFaceContent, modifiedFontFaceContent)
68
+ };
69
+
70
+ return cssContent;
71
+ }
72
+
73
+ export default function(element) {
74
+ return {
75
+ hasFontEmbeds: hasFontEmbeds.bind(element),
76
+ embedFontsInCss: embedFontsInCss.bind(element),
77
+ getFontMimeType: getFontMimeType.bind(element),
78
+ convertFontToBase64: convertFontToBase64.bind(element),
79
+ replaceFontUrlWithBase64: replaceFontUrlWithBase64.bind(element)
80
+ };
81
+ };
@@ -0,0 +1,82 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ import _scss_import from './_import';
5
+ const _COMPILE_DIR_NAME = 'compiled';
6
+
7
+
8
+ function writeCssFile(scssFilePath, cssContent) {
9
+ const cssFilePath = scssFilePath.replace('.scss', '.css');
10
+ let endCssFilePath = cssFilePath.split('/');
11
+ let endCssDirVars: string[] = [...endCssFilePath];
12
+ endCssDirVars[endCssDirVars.length - 1] = `${_COMPILE_DIR_NAME}`;
13
+ const endCssDir: string = endCssDirVars.join('/');
14
+
15
+ if (!fs.existsSync(endCssDir)) {
16
+ fs.mkdirSync(endCssDir);
17
+ }
18
+
19
+ endCssFilePath[endCssFilePath.length - 1] = `${_COMPILE_DIR_NAME}/` + endCssFilePath[endCssFilePath.length - 1];
20
+ endCssFilePath = endCssFilePath.join('/');
21
+
22
+ fs.writeFile(endCssFilePath, cssContent, () => {});
23
+ console.log('Saved external CSS file in: ' + endCssFilePath);
24
+ }
25
+
26
+ function readSCSSFilesFromDirectory(dirPath) {
27
+ let scssFiles: string[] = [];
28
+
29
+ try {
30
+ const files = fs.readdirSync(dirPath);
31
+
32
+ files.forEach(file => {
33
+ const filePath: string = path.join(dirPath, file);
34
+ const stat = fs.statSync(filePath);
35
+
36
+ if (stat.isFile() && path.extname(file) === '.scss') {
37
+ scssFiles.push(filePath);
38
+ } else if (stat.isDirectory()) {
39
+ scssFiles = scssFiles.concat(readSCSSFilesFromDirectory(filePath));
40
+ }
41
+ });
42
+ } catch (e) {
43
+ console.error(`Failed to read directory ${dirPath}:`, e);
44
+ }
45
+
46
+ return scssFiles;
47
+ };
48
+
49
+
50
+ function getCodeFromFile(filePath) {
51
+ filePath = filePath.replace('//', '/');
52
+ if (!fs.existsSync(filePath)) {
53
+ const processedImportPath = _scss_import(this).processImportPath(filePath, path.dirname(filePath));
54
+ if (!fs.existsSync(processedImportPath)) {
55
+ throw new Error(`SCSS loader: File path "${filePath}" was not found.`);
56
+ }
57
+
58
+ filePath = processedImportPath;
59
+ }
60
+
61
+ if (filePath[filePath.length - 1] === '/' && fs.statSync(filePath).isDirectory()) {
62
+ let collectedCode = '';
63
+
64
+ readSCSSFilesFromDirectory(filePath).forEach(scssPath => {
65
+ collectedCode += fs.readFileSync(scssPath, 'utf-8');
66
+ });
67
+
68
+ return collectedCode;
69
+ } else if (fs.statSync(filePath).isDirectory()) {
70
+ throw new Error(`Non-directory path (not ending with "/") "${filePath}" is and should not be a directory`)
71
+ }
72
+
73
+ return fs.readFileSync(filePath, 'utf-8');
74
+ }
75
+
76
+ export default function(element) {
77
+ return {
78
+ writeCssFile: writeCssFile.bind(element),
79
+ readSCSSFilesFromDirectory: readSCSSFilesFromDirectory.bind(element),
80
+ getCodeFromFile: getCodeFromFile.bind(element)
81
+ };
82
+ };
@@ -0,0 +1,185 @@
1
+ const { rwsPath } = require('@rws-framework/console');
2
+
3
+ import _scss_fs_builder from './_fs';
4
+
5
+ const fs = require('fs');
6
+ const path = require('path');
7
+ const CSS_IMPORT_REGEX = /^(?!.*\/\/)(?!.*\/\*).*@import\s+['"]((?![^'"]*:[^'"]*).+?)['"];?/gm;
8
+ const SCSS_USE_REGEX = /^(?!.*\/\/)(?!.*\/\*).*@use\s+['"]?([^'"\s]+)['"]?;?/gm;
9
+
10
+ const WORKSPACE = rwsPath.findRootWorkspacePath(process.cwd());
11
+
12
+ function processImportPath(importPath, fileRootDir = null, noext = false): string
13
+ {
14
+ if (importPath.split('')[0] === '~') {
15
+ return fillSCSSExt(replaceWithNodeModules(importPath, null, true), noext);
16
+ }
17
+
18
+ if (importPath.indexOf('@rws-mixins') === 0) {
19
+ return path.resolve(rwsPath.findPackageDir(__dirname), 'src', 'styles', 'includes.scss');
20
+ }
21
+
22
+ if (importPath.indexOf('@cwd') === 0) {
23
+ return fillSCSSExt(process.cwd() + '/' + importPath.slice(4), noext);
24
+ }
25
+
26
+ if (importPath.split('')[0] === '/') {
27
+
28
+ return fillSCSSExt(importPath, noext);
29
+ }
30
+
31
+ if (fileRootDir) {
32
+ const relativized = path.resolve(fileRootDir) + '/' + importPath;
33
+
34
+ if (importPath.split('')[0] === '.') {
35
+ return fillSCSSExt(relativized, noext);
36
+ }
37
+
38
+ if (!fs.existsSync(relativized)) {
39
+ const partSplit = relativized.split('/');
40
+ partSplit[partSplit.length - 1] = '_' + partSplit[partSplit.length - 1] + '.scss';
41
+
42
+ const newPath = underscorePath(relativized);
43
+
44
+ if (fs.existsSync(newPath)) {
45
+ return newPath;
46
+ }
47
+ }
48
+ return fillSCSSExt(relativized, noext);
49
+ }
50
+
51
+ return importPath;
52
+ }
53
+
54
+ function underscorePath(path, noext = false) {
55
+ const partSplit = path.split('/');
56
+ partSplit[partSplit.length - 1] = '_' + partSplit[partSplit.length - 1] + (path.indexOf('.scss') > - 1 || noext ? '' : '.scss');
57
+ return partSplit.join('/');
58
+ }
59
+
60
+ function fillSCSSExt(scssPath, noext = false) {
61
+ const underscoredPath = underscorePath(scssPath, noext);
62
+ if (!fs.existsSync(scssPath) && fs.existsSync(underscoredPath)) {
63
+ return underscoredPath;
64
+ }
65
+
66
+ if (noext) {
67
+ return scssPath;
68
+ }
69
+
70
+ if ((!fs.existsSync(scssPath) || (fs.existsSync(scssPath) && fs.statSync(scssPath).isDirectory())) && fs.existsSync(`${scssPath}.scss`)) {
71
+ return `${scssPath}.scss`;
72
+ }
73
+
74
+ if (fs.existsSync(`_${scssPath}.scss`)) {
75
+ return `${scssPath}.scss`;
76
+ }
77
+
78
+ return scssPath;
79
+ }
80
+
81
+ function extractScssImports(fileContent, importRootPath) {
82
+ let match;
83
+ const imports: string[][] = [];
84
+
85
+ while ((match = CSS_IMPORT_REGEX.exec(fileContent)) !== null) {
86
+ const importPath = match[1];
87
+ const importLine = match[0];
88
+
89
+ if (fs.statSync(importRootPath).isFile()) {
90
+ importRootPath = path.dirname(importRootPath);
91
+ }
92
+
93
+ const processedImportPath = processImportPath(importPath, importRootPath);
94
+
95
+ imports.push([processedImportPath, importLine, path.resolve(processedImportPath)]);
96
+ }
97
+
98
+ return [imports, fileContent];
99
+ }
100
+
101
+ function extractScssUses(fileContent) {
102
+ let match;
103
+ const uses: string[][] = [];
104
+
105
+ while ((match = SCSS_USE_REGEX.exec(fileContent)) !== null) {
106
+ const usesPath: string = match[1];
107
+ const usesLine: string = match[0];
108
+
109
+ if (!uses.find((item) => {
110
+ return item[0] == usesPath
111
+ }) && !(usesPath !== 'sass:math')) {
112
+ uses.push([usesPath, usesLine]);
113
+ }
114
+ }
115
+
116
+ return [uses];
117
+ }
118
+
119
+ function detectImports(code) {
120
+ return CSS_IMPORT_REGEX.test(code);
121
+ }
122
+
123
+ function replaceWithNodeModules(input, fileDir = null, absolute = false, token = '~') {
124
+ return input.replace(token, absolute ? `${path.resolve(WORKSPACE, 'node_modules')}/` : this.node_modules_dir(fileDir ? fileDir : process.cwd()));
125
+ }
126
+
127
+ function processImports(imports, fileRootDir, importStorage = {}, sub = false) {
128
+ const _scss_fs = _scss_fs_builder(this);
129
+ const importResults: {
130
+ line: number,
131
+ code: string
132
+ }[] = [];
133
+
134
+ const getStorage = (sourceComponentPath, importedFileContent) => {
135
+ const sourceComponentPathFormatted = sourceComponentPath.replace('/', '_');
136
+
137
+ if (!(sourceComponentPathFormatted in importStorage)) {
138
+ importStorage[sourceComponentPathFormatted] = importedFileContent;
139
+
140
+ return importedFileContent;
141
+ }
142
+
143
+ return '';
144
+ }
145
+
146
+ imports.forEach(importData => {
147
+ const originalImportPath = importData[0];
148
+ let importPath = processImportPath(originalImportPath, fileRootDir);
149
+ let replacedScssContent = getStorage(importPath, _scss_fs.getCodeFromFile(importPath).replace(/\/\*[\s\S]*?\*\//g, ''));
150
+
151
+ const recursiveImports = extractScssImports(replacedScssContent, importPath)[0];
152
+
153
+ if (recursiveImports.length) {
154
+
155
+ replacedScssContent = replaceImports(processImports(recursiveImports, path.dirname(importPath), importStorage, true), replacedScssContent);
156
+ }
157
+
158
+ importResults.push({
159
+ line: importData[1],
160
+ code: replacedScssContent
161
+ });
162
+ });
163
+
164
+ return importResults;
165
+ }
166
+
167
+ function replaceImports(processedImports, code) {
168
+ processedImports.forEach(importObj => {
169
+ code = code.replace(importObj.line, importObj.code);
170
+ });
171
+
172
+ return code;
173
+ }
174
+
175
+ export default (element) => ({
176
+ processImportPath: processImportPath.bind(element),
177
+ fillSCSSExt: fillSCSSExt.bind(element),
178
+ underscorePath: underscorePath.bind(element),
179
+ detectImports: detectImports.bind(element),
180
+ extractScssUses: extractScssUses.bind(element),
181
+ extractScssImports: extractScssImports.bind(element),
182
+ replaceImports: replaceImports.bind(element),
183
+ processImports: processImports.bind(element),
184
+ replaceWithNodeModules: replaceWithNodeModules.bind(element)
185
+ });
@@ -0,0 +1,7 @@
1
+ export type RWSViteConfig = {
2
+ dev: boolean
3
+ tsConfigPath: string
4
+ defines?: {
5
+ [key: string]: string
6
+ }
7
+ }
File without changes
File without changes
File without changes
File without changes
@@ -10,13 +10,8 @@ function processEnvDefines(BuildConfigurator, config, devDebug) {
10
10
  const rwsDefines = BuildConfigurator.get('rwsDefines') || config.rwsDefines || null;
11
11
 
12
12
  if (rwsDefines) {
13
- for (const defineKey of Object.keys(rwsDefines)){
14
- _rws_defines = {
15
- ..._rws_defines,
16
- ['process.env.' + defineKey]: JSON.stringify(rwsDefines[defineKey])
17
- }
18
- }
19
- }
13
+ _rws_defines = { ..._rws_defines, ...rwsDefines }
14
+ }
20
15
 
21
16
  return _rws_defines;
22
17
  }
@@ -51,12 +51,6 @@ function getRWSLoaders(packageDir, nodeModulesPath, tsConfigPath, devDebug) {
51
51
  scssLoader,
52
52
  ],
53
53
  },
54
- {
55
- test: /\.css$/i,
56
- use: [
57
- 'css-loader'
58
- ],
59
- },
60
54
  ]
61
55
  }
62
56
 
File without changes
@@ -47,7 +47,12 @@ function createWebpackConfig(
47
47
  externals: rwsExternals(executionDir, modules_setup, automatedChunks, {
48
48
  _vars: devExternalsVars
49
49
  }),
50
- cache: false,
50
+ cache: {
51
+ type: 'filesystem',
52
+ buildDependencies: {
53
+ config: [__filename],
54
+ },
55
+ }
51
56
  }
52
57
  }
53
58
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/client",
3
3
  "private": false,
4
- "version": "2.12.0",
4
+ "version": "2.13.0",
5
5
  "main": "src/index.ts",
6
6
  "scripts": {
7
7
  "docs": "typedoc --tsconfig ./tsconfig.json"
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@microsoft/fast-element": "^1.12.0",
30
30
  "@microsoft/fast-foundation": "^2.46.2",
31
- "@rws-framework/console": "^0.3.16",
31
+ "@rws-framework/console": "^0.3.15",
32
32
  "@types/moment": "^2.13.0",
33
33
  "deepmerge": "^4.3.1",
34
34
  "dragula": "^3.7.3",
@@ -92,6 +92,7 @@
92
92
  "tsc-watch": "^6.0.4",
93
93
  "tslib": "^2.6.2",
94
94
  "uglify-js": "^3.17.4",
95
+ "vite": "^6.0.11",
95
96
  "webpack": "^5.86.0",
96
97
  "webpack-bundle-analyzer": "^4.10.1",
97
98
  "webpack-cli": "^5.1.4",
@@ -73,11 +73,11 @@ function get(this: RWSClientInstance, key: string): any | null
73
73
  }
74
74
 
75
75
  type PluginConstructor<T extends DefaultRWSPluginOptionsType> = new (options: T) => RWSPlugin<T>;
76
- type RWSPluginEntry = IStaticRWSPlugin;
76
+ type RWSPluginEntry<T extends DefaultRWSPluginOptionsType = DefaultRWSPluginOptionsType> = IStaticRWSPlugin<T>;
77
77
 
78
78
  function addPlugin<T extends DefaultRWSPluginOptionsType>(this: RWSClientInstance, pluginEntry: RWSPluginEntry){
79
79
  const rwsWindow: RWSWindow = loadRWSRichWindow();
80
- const pluginClass: PluginConstructor<T> = (Array.isArray(pluginEntry) ? pluginEntry[0] : pluginEntry) as PluginConstructor<T>;
80
+ const pluginClass: PluginConstructor<T> = (Array.isArray(pluginEntry) ? pluginEntry[0] : pluginEntry) as unknown as PluginConstructor<T>;
81
81
  const pluginOptions: T = (Array.isArray(pluginEntry) ? pluginEntry[1] : { enabled: true }) as T;
82
82
 
83
83
  if(!Object.keys(rwsWindow.RWS.plugins).includes(pluginClass.name)){
package/src/client.ts CHANGED
@@ -74,7 +74,7 @@ class RWSClient {
74
74
  }
75
75
  }
76
76
 
77
- addPlugin<T extends DefaultRWSPluginOptionsType>(pluginEntry: IStaticRWSPlugin<T>)
77
+ addPlugin<T extends DefaultRWSPluginOptionsType>(pluginEntry: IStaticRWSPlugin)
78
78
  {
79
79
  this.config.plugins.push(pluginEntry);
80
80
  }
@@ -6,6 +6,7 @@ import DOMService, { DOMServiceInstance, DOMOutputType } from '../services/DOMSe
6
6
  import ApiService, { ApiServiceInstance } from '../services/ApiService';
7
7
  import NotifyService, { NotifyServiceInstance } from '../services/NotifyService';
8
8
  import { IRWSViewComponent, IAssetShowOptions } from '../types/IRWSViewComponent';
9
+ import RWSWindow, { RWSWindowComponentInterface, loadRWSRichWindow } from '../types/RWSWindow';
9
10
  import { applyConstructor, RWSInject } from './_decorator';
10
11
  import TheRWSService from '../services/_service';
11
12
  import { handleExternalChange } from './_attrs/_external_handler';
@@ -70,7 +71,7 @@ abstract class RWSViewComponent extends FoundationElement implements IRWSViewCom
70
71
 
71
72
  constructor() {
72
73
  super();
73
- applyConstructor(this);
74
+ applyConstructor(this);
74
75
  }
75
76
 
76
77
  connectedCallback() {
@@ -240,5 +241,6 @@ abstract class RWSViewComponent extends FoundationElement implements IRWSViewCom
240
241
  export default RWSViewComponent;
241
242
 
242
243
  export type {
243
- IAssetShowOptions, IRWSViewComponent
244
+ IAssetShowOptions,
245
+ IRWSViewComponent
244
246
  } from '../types/IRWSViewComponent';
@@ -1,4 +1,4 @@
1
- import { DI, Container } from '../../foundation/rws-foundation';
1
+ import {DI, Container, Registration } from '../../foundation/rws-foundation';
2
2
  import {loadRWSRichWindow} from '../types/RWSWindow';
3
3
 
4
4
  export default () => {
@@ -13,8 +13,4 @@ export default () => {
13
13
  return richWindow.RWS.container;
14
14
  };
15
15
 
16
- export { DI, Container }
17
-
18
- export type {
19
- Key, Registration, InterfaceSymbol
20
- } from '../../foundation/rws-foundation';
16
+ export { DI, Container, Registration }
@@ -37,7 +37,7 @@ function RWSView<Component extends RWSViewComponent>(name: string, data?: RWSDec
37
37
  if(override.options){
38
38
  (theComponent.definition as any).options = override.options;
39
39
  }
40
- }
40
+ }
41
41
  };
42
42
  }
43
43
 
@@ -39,7 +39,6 @@ export function defineComponent<T extends RWSViewComponent>(element: IWithCompos
39
39
  styles: element.definition.styles
40
40
  }) as RWSWindowComponentInterface;
41
41
 
42
-
43
42
  if (!richWindow.RWS) {
44
43
  throw new Error('RWS client not initialized');
45
44
  }
@@ -1,4 +1,4 @@
1
- import RWSViewComponent from "@rws-framework/client/src/components/_component";
1
+ import RWSViewComponent from './_component';
2
2
 
3
3
  export function on<T>(this: RWSViewComponent, type: string, listener: (event: CustomEvent<any>) => any) {
4
4
  this.addEventListener(type, (baseEvent: Event) => {