@ui5/webcomponents-tools 2.17.0-rc.2 → 2.17.0-rc.4
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/CHANGELOG.md +27 -0
- package/components-package/nps.js +2 -1
- package/lib/cem/custom-elements-manifest.config.mjs +16 -0
- package/lib/create-illustrations/index.js +2 -1
- package/lib/css-processors/css-processor-components.mjs +2 -2
- package/lib/css-processors/css-processor-themes.mjs +42 -26
- package/lib/css-processors/scope-variables.mjs +17 -9
- package/lib/i18n/toJSON.js +1 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.17.0-rc.4](https://github.com/UI5/webcomponents/compare/v2.17.0-rc.3...v2.17.0-rc.4) (2025-11-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **build:** fix issue with legacy dev setup ([#12706](https://github.com/UI5/webcomponents/issues/12706)) ([89fa5ca](https://github.com/UI5/webcomponents/commit/89fa5ca9f83551363e8c1d9980269cd58fa09d85))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [2.17.0-rc.3](https://github.com/UI5/webcomponents/compare/v2.17.0-rc.2...v2.17.0-rc.3) (2025-11-20)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **cem:** alias references ([#12682](https://github.com/UI5/webcomponents/issues/12682)) ([4ce5617](https://github.com/UI5/webcomponents/commit/4ce5617ff580c869640996545fa618ff90447ba4))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **framework:** scope theming css variables with component packages ([#12491](https://github.com/UI5/webcomponents/issues/12491)) ([43ff5de](https://github.com/UI5/webcomponents/commit/43ff5defaf6e08bac848df3d2d34943de15bee83))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
# [2.17.0-rc.2](https://github.com/UI5/webcomponents/compare/v2.17.0-rc.1...v2.17.0-rc.2) (2025-11-13)
|
|
7
34
|
|
|
8
35
|
|
|
@@ -129,6 +129,7 @@ const getScripts = (options) => {
|
|
|
129
129
|
},
|
|
130
130
|
copyProps: `ui5nps-script "${LIB}copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/`,
|
|
131
131
|
copyPropsWithWatch: `ui5nps-script "${LIB}copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/ --watch --safe --skip-initial-copy`,
|
|
132
|
+
copySrcWithWatch: `ui5nps-script "${LIB}copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/ --watch --safe --skip-initial-copy`,
|
|
132
133
|
copy: {
|
|
133
134
|
default: options.legacy ? "ui5nps copy.src copy.props" : "",
|
|
134
135
|
src: options.legacy ? `ui5nps-script "${LIB}copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/` : "",
|
|
@@ -137,7 +138,7 @@ const getScripts = (options) => {
|
|
|
137
138
|
watch: {
|
|
138
139
|
default: `ui5nps-p watch.templates watch.typescript watch.src watch.styles watch.i18n watch.props`, // concurently
|
|
139
140
|
devServer: 'ui5nps-p watch.default watch.bundle', // concurently
|
|
140
|
-
src: options.legacy ? 'ui5nps
|
|
141
|
+
src: options.legacy ? 'ui5nps copySrcWithWatch' : "",
|
|
141
142
|
typescript: tsWatchCommandStandalone,
|
|
142
143
|
props: 'ui5nps copyPropsWithWatch',
|
|
143
144
|
bundle: `ui5nps-script ${LIB}dev-server/dev-server.mjs ${viteConfig}`,
|
|
@@ -27,7 +27,17 @@ import { generateCustomData } from "cem-plugin-vs-code-custom-data-generator";
|
|
|
27
27
|
import { customElementJetBrainsPlugin } from "custom-element-jet-brains-integration";
|
|
28
28
|
|
|
29
29
|
const packageJSON = JSON.parse(fs.readFileSync("./package.json"));
|
|
30
|
+
let aliasMap = {};
|
|
31
|
+
|
|
30
32
|
const devMode = process.env.UI5_CEM_MODE === "dev";
|
|
33
|
+
try {
|
|
34
|
+
aliasMap = JSON.parse(fs.readFileSync("./.ui5-cem-aliases.json"));
|
|
35
|
+
} catch (e) {
|
|
36
|
+
if (devMode) {
|
|
37
|
+
console.warn("No .ui5-cem-aliases.json file found. Continuing without aliases.");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
|
|
32
42
|
const extractClassNodeJSDoc = node => {
|
|
33
43
|
const fileContent = node.getFullText();
|
|
@@ -486,6 +496,12 @@ export default {
|
|
|
486
496
|
}
|
|
487
497
|
}
|
|
488
498
|
|
|
499
|
+
moduleDoc.declarations.forEach(declaration => {
|
|
500
|
+
if (declaration.superclass?.name && aliasMap[declaration.superclass.name]) {
|
|
501
|
+
declaration.superclass.name = aliasMap[declaration.superclass.name];
|
|
502
|
+
}
|
|
503
|
+
})
|
|
504
|
+
|
|
489
505
|
const typeReferences = new Set();
|
|
490
506
|
const registerTypeReference = reference => typeReferences.add(JSON.stringify(reference))
|
|
491
507
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const fs = require("fs").promises;
|
|
2
2
|
const path = require("path");
|
|
3
|
+
const { scopeThemingVariables } = require("../css-processors/scope-variables.mjs");
|
|
3
4
|
|
|
4
5
|
const generate = async (argv) => {
|
|
5
6
|
if (argv.length < 7) {
|
|
@@ -91,7 +92,7 @@ const generate = async (argv) => {
|
|
|
91
92
|
console.log(`Generating illustrations from ${srcPath} to ${destPath}`)
|
|
92
93
|
|
|
93
94
|
const svgImportTemplate = svgContent => {
|
|
94
|
-
return `export default \`${svgContent}\`;`
|
|
95
|
+
return `export default \`${scopeThemingVariables(svgContent)}\`;`
|
|
95
96
|
};
|
|
96
97
|
const svgToJs = async fileName => {
|
|
97
98
|
const svg = await fs.readFile(path.join(srcPath, fileName), { encoding: "utf-8" });
|
|
@@ -4,7 +4,7 @@ import * as fs from "fs";
|
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
import { writeFile, mkdir } from "fs/promises";
|
|
6
6
|
import chokidar from "chokidar";
|
|
7
|
-
import
|
|
7
|
+
import {scopeUi5Variables} from "./scope-variables.mjs";
|
|
8
8
|
import { writeFileIfChanged, getFileContent } from "./shared.mjs";
|
|
9
9
|
import { pathToFileURL } from "url";
|
|
10
10
|
|
|
@@ -24,7 +24,7 @@ const generate = async (argv) => {
|
|
|
24
24
|
build.onEnd(result => {
|
|
25
25
|
result.outputFiles.forEach(async f => {
|
|
26
26
|
// scoping
|
|
27
|
-
let newText =
|
|
27
|
+
let newText = scopeUi5Variables(f.text, packageJSON);
|
|
28
28
|
newText = newText.replaceAll(/\\/g, "\\\\"); // Escape backslashes as they might appear in css rules
|
|
29
29
|
await mkdir(path.dirname(f.path), { recursive: true });
|
|
30
30
|
writeFile(f.path, newText);
|
|
@@ -6,10 +6,45 @@ import { writeFile, mkdir } from "fs/promises";
|
|
|
6
6
|
import postcss from "postcss";
|
|
7
7
|
import combineDuplicatedSelectors from "../postcss-combine-duplicated-selectors/index.js"
|
|
8
8
|
import { writeFileIfChanged, getFileContent } from "./shared.mjs";
|
|
9
|
-
import
|
|
9
|
+
import { scopeUi5Variables, scopeThemingVariables } from "./scope-variables.mjs";
|
|
10
10
|
import { pathToFileURL } from "url";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
async function processThemingPackageFile(f) {
|
|
13
|
+
const selector = ':root';
|
|
14
|
+
const newRule = postcss.rule({ selector });
|
|
15
|
+
const result = await postcss().process(f.text);
|
|
16
|
+
|
|
17
|
+
result.root.walkRules(selector, rule => {
|
|
18
|
+
for (const decl of rule.nodes) {
|
|
19
|
+
if (decl.type !== 'decl' ) {
|
|
20
|
+
continue;
|
|
21
|
+
} else if (decl.prop.startsWith('--sapFontUrl')) {
|
|
22
|
+
continue;
|
|
23
|
+
} else if (!decl.prop.startsWith('--sap')) {
|
|
24
|
+
newRule.append(decl.clone());
|
|
25
|
+
} else {
|
|
26
|
+
const originalProp = decl.prop;
|
|
27
|
+
const originalValue = decl.value;
|
|
28
|
+
|
|
29
|
+
newRule.append(decl.clone({ prop: originalProp.replace("--sap", "--ui5-sap"), value: `var(${originalProp}, ${originalValue})` }));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return newRule.toString();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
async function processComponentPackageFile(f, packageJSON) {
|
|
38
|
+
let result = await postcss(combineDuplicatedSelectors).process(f.text);
|
|
39
|
+
|
|
40
|
+
result = scopeUi5Variables(result.css, packageJSON, f.path);
|
|
41
|
+
|
|
42
|
+
result = scopeThemingVariables(result);
|
|
43
|
+
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function generate(argv) {
|
|
13
48
|
const tsMode = process.env.UI5_TS === "true";
|
|
14
49
|
const extension = tsMode ? ".css.ts" : ".css.js";
|
|
15
50
|
|
|
@@ -20,29 +55,6 @@ const generate = async (argv) => {
|
|
|
20
55
|
]);
|
|
21
56
|
const restArgs = argv.slice(2);
|
|
22
57
|
|
|
23
|
-
const processThemingPackageFile = async (f) => {
|
|
24
|
-
const selector = ':root';
|
|
25
|
-
const result = await postcss().process(f.text);
|
|
26
|
-
|
|
27
|
-
const newRule = postcss.rule({ selector });
|
|
28
|
-
|
|
29
|
-
result.root.walkRules(selector, rule => {
|
|
30
|
-
rule.walkDecls(decl => {
|
|
31
|
-
if (!decl.prop.startsWith('--sapFontUrl')) {
|
|
32
|
-
newRule.append(decl.clone());
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
return newRule.toString();
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const processComponentPackageFile = async (f) => {
|
|
41
|
-
const result = await postcss(combineDuplicatedSelectors).process(f.text);
|
|
42
|
-
|
|
43
|
-
return scopeVariables(result.css, packageJSON, f.path);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
58
|
let scopingPlugin = {
|
|
47
59
|
name: 'scoping',
|
|
48
60
|
setup(build) {
|
|
@@ -50,7 +62,7 @@ const generate = async (argv) => {
|
|
|
50
62
|
|
|
51
63
|
build.onEnd(result => {
|
|
52
64
|
result.outputFiles.forEach(async f => {
|
|
53
|
-
let newText = f.path.includes("packages/theming") ? await processThemingPackageFile(f) : await processComponentPackageFile(f);
|
|
65
|
+
let newText = f.path.includes("packages/theming") ? await processThemingPackageFile(f) : await processComponentPackageFile(f, packageJSON);
|
|
54
66
|
|
|
55
67
|
await mkdir(path.dirname(f.path), { recursive: true });
|
|
56
68
|
writeFile(f.path, newText);
|
|
@@ -99,4 +111,8 @@ if (import.meta.url === fileUrl) {
|
|
|
99
111
|
|
|
100
112
|
export default {
|
|
101
113
|
_ui5mainFn: generate
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
processComponentPackageFile
|
|
102
118
|
}
|
|
@@ -9,9 +9,9 @@ const require = createRequire(import.meta.url);
|
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
|
11
11
|
const getOverrideVersion = filePath => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
if (!filePath) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
15
|
|
|
16
16
|
if (!filePath.includes(`overrides${path.sep}`)) {
|
|
17
17
|
return; // The "overrides/" directory is the marker
|
|
@@ -36,14 +36,22 @@ const getOverrideVersion = filePath => {
|
|
|
36
36
|
return overrideVersion;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const scopeUi5Variables = (cssText, packageJSON, inputFile) => {
|
|
40
|
+
const escapeVersion = version => "v" + version?.replaceAll(/[^0-9A-Za-z\-_]/g, "-");
|
|
41
|
+
const versionStr = escapeVersion(getOverrideVersion(inputFile) || packageJSON.version);
|
|
42
|
+
const expr = /(--_?ui5)([^\,\:\)\s]+)/g;
|
|
43
|
+
let newText = cssText.replaceAll(expr, `$1-${versionStr}$2`);
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
return newText.replaceAll("--sap", `--ui5-sap`);
|
|
46
|
+
}
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
// Used with CSS text and SVG file content (illustrations)
|
|
49
|
+
const scopeThemingVariables = (cssText) => {
|
|
50
|
+
return cssText.replaceAll("--sap", `--ui5-sap`);
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
export
|
|
53
|
+
export {
|
|
54
|
+
scopeUi5Variables,
|
|
55
|
+
scopeThemingVariables,
|
|
56
|
+
};
|
|
49
57
|
|
package/lib/i18n/toJSON.js
CHANGED
|
@@ -19,8 +19,7 @@ const convertToJSON = async (file, distPath) => {
|
|
|
19
19
|
const filename = path.basename(file, path.extname(file));
|
|
20
20
|
const language = filename.match(/^messagebundle_(.*?)$/)[1];
|
|
21
21
|
if (!allLanguages.includes(language)) {
|
|
22
|
-
console.
|
|
23
|
-
return;
|
|
22
|
+
console.warn("Not supported language or script: ", language);
|
|
24
23
|
}
|
|
25
24
|
const outputFile = path.normalize(`${distPath}/${filename}.json`);
|
|
26
25
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
|
3
|
-
"version": "2.17.0-rc.
|
|
3
|
+
"version": "2.17.0-rc.4",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"esbuild": "^0.25.0",
|
|
85
85
|
"yargs": "^17.5.1"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "b7e93525288be73f17828a4aec16465097c1550b"
|
|
88
88
|
}
|