@rws-framework/client 2.11.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.
- package/builder/vite/index.ts +5 -0
- package/builder/vite/rws.vite.config.ts +44 -0
- package/{webpack → builder/webpack}/index.js +3 -1
- package/{webpack → builder/webpack}/loaders/rws_fast_ts_loader.js +1 -1
- package/{rws.webpack.config.js → builder/webpack/rws.webpack.config.js} +18 -13
- package/cfg/build_steps/vite/_build_config.ts +106 -0
- package/cfg/build_steps/vite/_env_defines.ts +17 -0
- package/cfg/build_steps/vite/_loaders.ts +183 -0
- package/cfg/build_steps/vite/index.ts +3 -0
- package/cfg/build_steps/vite/loaders/html.ts +14 -0
- package/cfg/build_steps/vite/loaders/index.ts +9 -0
- package/cfg/build_steps/vite/loaders/loader.type.ts +4 -0
- package/cfg/build_steps/vite/loaders/scss.ts +20 -0
- package/cfg/build_steps/vite/loaders/ts.ts +19 -0
- package/cfg/build_steps/vite/rws_scss_plugin.ts +63 -0
- package/cfg/build_steps/vite/scss/_compiler.ts +101 -0
- package/cfg/build_steps/vite/scss/_fonts.ts +81 -0
- package/cfg/build_steps/vite/scss/_fs.ts +82 -0
- package/cfg/build_steps/vite/scss/_import.ts +185 -0
- package/cfg/build_steps/vite/types.ts +7 -0
- package/cfg/build_steps/webpack/_actions.js +0 -0
- package/cfg/build_steps/webpack/_build_config.js +0 -0
- package/cfg/build_steps/webpack/_component_handling.js +0 -0
- package/cfg/build_steps/webpack/_dev_servers.js +0 -0
- package/cfg/build_steps/webpack/_env_defines.js +2 -7
- package/cfg/build_steps/webpack/_loaders.js +0 -6
- package/cfg/build_steps/webpack/_plugins.js +0 -0
- package/cfg/build_steps/webpack/_webpack_config.js +6 -1
- package/package.json +3 -2
- package/src/client/config.ts +2 -2
- package/src/client.ts +1 -1
- package/src/components/_component.ts +4 -2
- package/src/components/_container.ts +2 -6
- package/src/components/_decorator.ts +1 -1
- package/src/components/_definitions.ts +0 -1
- package/src/components/_event_handling.ts +1 -1
- package/src/index.ts +60 -70
- package/src/services/ApiService.ts +1 -8
- package/src/services/_service.ts +2 -2
- package/src/styles/_grid.scss +16 -8
- package/src/styles/_scrollbars.scss +1 -0
- package/src/styles/includes.scss +0 -1
- package/src/types/IRWSConfig.ts +2 -2
- package/src/types/IRWSPlugin.ts +3 -5
- /package/{webpack → builder/webpack}/after/copy.js +0 -0
- /package/{webpack → builder/webpack}/after/sw.js +0 -0
- /package/{webpack → builder/webpack}/loaders/rws_fast_html_loader.js +0 -0
- /package/{webpack → builder/webpack}/loaders/rws_fast_scss_loader.js +0 -0
- /package/{webpack → builder/webpack}/loaders/ts/html_error.js +0 -0
- /package/{webpack → builder/webpack}/rws_scss_plugin.js +0 -0
- /package/{webpack → builder/webpack}/rws_webpack_plugin.js +0 -0
- /package/{webpack → builder/webpack}/scss/_compiler.js +0 -0
- /package/{webpack → builder/webpack}/scss/_fonts.js +0 -0
- /package/{webpack → builder/webpack}/scss/_fs.js +0 -0
- /package/{webpack → builder/webpack}/scss/_import.js +0 -0
|
@@ -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
|
+
});
|
|
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
|
-
|
|
14
|
-
|
|
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
|
}
|
|
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:
|
|
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.
|
|
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.
|
|
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",
|
package/src/client/config.ts
CHANGED
|
@@ -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
|
@@ -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,
|
|
244
|
+
IAssetShowOptions,
|
|
245
|
+
IRWSViewComponent
|
|
244
246
|
} from '../types/IRWSViewComponent';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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 }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import RWSViewComponent from
|
|
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) => {
|