@ui5/webcomponents-tools 2.17.0-rc.5 → 2.17.1
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 +24 -0
- package/components-package/nps.js +1 -1
- package/lib/create-illustrations/index.js +1 -2
- package/lib/css-processors/css-processor-components.mjs +2 -2
- package/lib/css-processors/css-processor-themes.mjs +40 -78
- package/lib/css-processors/scope-variables.mjs +9 -17
- package/lib/generate-json-imports/themes.js +7 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
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.1](https://github.com/UI5/webcomponents/compare/v2.17.0...v2.17.1) (2025-12-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **build:** fix legacy (hbs templates) build flow on Windows ([d09bad6](https://github.com/UI5/webcomponents/commit/d09bad66ef29be2472f3f9202416d2eca2317511))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [2.17.0](https://github.com/UI5/webcomponents/compare/v2.17.0-rc.5...v2.17.0) (2025-12-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Reverts
|
|
21
|
+
|
|
22
|
+
* Revert "feat(framework): scope theming css variables with component packages (#12491)" (#12775) ([3385623](https://github.com/UI5/webcomponents/commit/33856235e357a3d4d0b9391eab2a83a5b3010556)), closes [#12491](https://github.com/UI5/webcomponents/issues/12491) [#12775](https://github.com/UI5/webcomponents/issues/12775)
|
|
23
|
+
* Revert "chore: scope theming variables used in illustrations (#12687)" (#12770) ([c9288ff](https://github.com/UI5/webcomponents/commit/c9288ff0f655fdd03262b71ac788e5688c904add)), closes [#12687](https://github.com/UI5/webcomponents/issues/12687) [#12770](https://github.com/UI5/webcomponents/issues/12770)
|
|
24
|
+
* Revert "feat(framework): introduce loadBaseThemingCSSVariables configuration (#12699)" (#12767) ([db375d3](https://github.com/UI5/webcomponents/commit/db375d30b9f4a7e07961fabbdcefdcdc78a93f46)), closes [#12699](https://github.com/UI5/webcomponents/issues/12699) [#12767](https://github.com/UI5/webcomponents/issues/12767)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
# [2.17.0-rc.5](https://github.com/UI5/webcomponents/compare/v2.17.0-rc.4...v2.17.0-rc.5) (2025-12-04)
|
|
7
31
|
|
|
8
32
|
|
|
@@ -92,7 +92,7 @@ const getScripts = (options) => {
|
|
|
92
92
|
},
|
|
93
93
|
build: {
|
|
94
94
|
default: "ui5nps prepare lint build.bundle", // build.bundle2
|
|
95
|
-
templates: options.legacy ? `
|
|
95
|
+
templates: options.legacy ? `node "${LIB}hbs2ui5/index.js" -d src/ -o src/generated/templates` : "",
|
|
96
96
|
styles: {
|
|
97
97
|
default: `ui5nps-p build.styles.themes build.styles.components`, // concurently
|
|
98
98
|
themes: `ui5nps-script "${LIB}css-processors/css-processor-themes.mjs"`,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const fs = require("fs").promises;
|
|
2
2
|
const path = require("path");
|
|
3
|
-
const { scopeThemingVariables } = require("../css-processors/scope-variables.mjs");
|
|
4
3
|
|
|
5
4
|
const generate = async (argv) => {
|
|
6
5
|
if (argv.length < 7) {
|
|
@@ -92,7 +91,7 @@ const generate = async (argv) => {
|
|
|
92
91
|
console.log(`Generating illustrations from ${srcPath} to ${destPath}`)
|
|
93
92
|
|
|
94
93
|
const svgImportTemplate = svgContent => {
|
|
95
|
-
return `export default \`${
|
|
94
|
+
return `export default \`${svgContent}\`;`
|
|
96
95
|
};
|
|
97
96
|
const svgToJs = async fileName => {
|
|
98
97
|
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 scopeVariables 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 = scopeVariables(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,67 +6,10 @@ 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 scopeVariables from "./scope-variables.mjs";
|
|
10
10
|
import { pathToFileURL } from "url";
|
|
11
11
|
|
|
12
|
-
|
|
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
|
-
if (scope) {
|
|
27
|
-
const originalProp = decl.prop;
|
|
28
|
-
const originalValue = decl.value;
|
|
29
|
-
|
|
30
|
-
newRule.append(decl.clone({ prop: originalProp.replace("--sap", "--ui5-sap"), value: `var(${originalProp}, ${originalValue})` }));
|
|
31
|
-
} else {
|
|
32
|
-
newRule.append(decl.clone());
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
return newRule.toString();
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
async function processComponentPackageFile(f, packageJSON) {
|
|
42
|
-
let result = await postcss(combineDuplicatedSelectors).process(f.text);
|
|
43
|
-
|
|
44
|
-
result = scopeUi5Variables(result.css, packageJSON, f.path);
|
|
45
|
-
|
|
46
|
-
result = scopeThemingVariables(result);
|
|
47
|
-
|
|
48
|
-
return result;
|
|
49
|
-
}
|
|
50
|
-
async function writeProcessedContent(basePath, content, packageJSON, extension) {
|
|
51
|
-
const cssPath = basePath;
|
|
52
|
-
const jsonPath = basePath.replace(/dist[\/\\]css/, "dist/generated/assets").replace(".css", ".css.json");
|
|
53
|
-
const jsPath = basePath.replace(/dist[\/\\]css/, "src/generated/").replace(".css", extension);
|
|
54
|
-
|
|
55
|
-
// Write CSS file
|
|
56
|
-
await mkdir(path.dirname(cssPath), { recursive: true });
|
|
57
|
-
await writeFile(cssPath, content);
|
|
58
|
-
|
|
59
|
-
// Write JSON file
|
|
60
|
-
await mkdir(path.dirname(jsonPath), { recursive: true });
|
|
61
|
-
await writeFileIfChanged(jsonPath, JSON.stringify(content));
|
|
62
|
-
|
|
63
|
-
// Write JS/TS file
|
|
64
|
-
const jsContent = getFileContent(packageJSON.name, `\`${content}\``);
|
|
65
|
-
await mkdir(path.dirname(jsPath), { recursive: true });
|
|
66
|
-
await writeFileIfChanged(jsPath, jsContent);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
async function generate(argv) {
|
|
12
|
+
const generate = async (argv) => {
|
|
70
13
|
const tsMode = process.env.UI5_TS === "true";
|
|
71
14
|
const extension = tsMode ? ".css.ts" : ".css.js";
|
|
72
15
|
|
|
@@ -77,27 +20,50 @@ async function generate(argv) {
|
|
|
77
20
|
]);
|
|
78
21
|
const restArgs = argv.slice(2);
|
|
79
22
|
|
|
80
|
-
const
|
|
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
|
+
let scopingPlugin = {
|
|
81
47
|
name: 'scoping',
|
|
82
48
|
setup(build) {
|
|
83
49
|
build.initialOptions.write = false;
|
|
84
50
|
|
|
85
51
|
build.onEnd(result => {
|
|
86
52
|
result.outputFiles.forEach(async f => {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
53
|
+
let newText = f.path.includes("packages/theming") ? await processThemingPackageFile(f) : await processComponentPackageFile(f);
|
|
54
|
+
|
|
55
|
+
await mkdir(path.dirname(f.path), { recursive: true });
|
|
56
|
+
writeFile(f.path, newText);
|
|
57
|
+
|
|
58
|
+
// JSON
|
|
59
|
+
const jsonPath = f.path.replace(/dist[\/\\]css/, "dist/generated/assets").replace(".css", ".css.json");
|
|
60
|
+
await mkdir(path.dirname(jsonPath), { recursive: true });
|
|
61
|
+
writeFileIfChanged(jsonPath, JSON.stringify(newText));
|
|
62
|
+
|
|
63
|
+
// JS/TS
|
|
64
|
+
const jsPath = f.path.replace(/dist[\/\\]css/, "src/generated/").replace(".css", extension);
|
|
65
|
+
const jsContent = getFileContent(packageJSON.name, "\`" + newText + "\`");
|
|
66
|
+
writeFileIfChanged(jsPath, jsContent);
|
|
101
67
|
});
|
|
102
68
|
})
|
|
103
69
|
},
|
|
@@ -133,8 +99,4 @@ if (import.meta.url === fileUrl) {
|
|
|
133
99
|
|
|
134
100
|
export default {
|
|
135
101
|
_ui5mainFn: generate
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export {
|
|
139
|
-
processComponentPackageFile
|
|
140
102
|
}
|
|
@@ -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,22 +36,14 @@ const getOverrideVersion = filePath => {
|
|
|
36
36
|
return overrideVersion;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const expr = /(--_?ui5)([^\,\:\)\s]+)/g;
|
|
43
|
-
let newText = cssText.replaceAll(expr, `$1-${versionStr}$2`);
|
|
39
|
+
const scopeVariables = (cssText, packageJSON, inputFile) => {
|
|
40
|
+
const escapeVersion = version => "v" + version?.replaceAll(/[^0-9A-Za-z\-_]/g, "-");
|
|
41
|
+
const versionStr = escapeVersion(getOverrideVersion(inputFile) || packageJSON.version);
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
}
|
|
43
|
+
const expr = /(--_?ui5)([^\,\:\)\s]+)/g;
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
const scopeThemingVariables = (cssText) => {
|
|
50
|
-
return cssText.replaceAll("--sap", `--ui5-sap`);
|
|
45
|
+
return cssText.replaceAll(expr, `$1-${versionStr}$2`);
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
export
|
|
54
|
-
scopeUi5Variables,
|
|
55
|
-
scopeThemingVariables,
|
|
56
|
-
};
|
|
48
|
+
export default scopeVariables;
|
|
57
49
|
|
|
@@ -7,10 +7,9 @@ const ext = isTypeScript ? 'ts' : 'js';
|
|
|
7
7
|
|
|
8
8
|
const generate = async (argv) => {
|
|
9
9
|
const inputFolder = path.normalize(argv[2]);
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const outputFileFetchMetaResolve = path.normalize(`${argv[3]}/Themes${outputSuffix}-fetch.${ext}`);
|
|
10
|
+
const outputFileDynamic = path.normalize(`${argv[3]}/Themes.${ext}`);
|
|
11
|
+
const outputFileDynamicImportJSONAttr = path.normalize(`${argv[3]}/Themes-node.${ext}`);
|
|
12
|
+
const outputFileFetchMetaResolve = path.normalize(`${argv[3]}/Themes-fetch.${ext}`);
|
|
14
13
|
|
|
15
14
|
// All supported optional themes
|
|
16
15
|
const allThemes = assets.themes.all;
|
|
@@ -25,9 +24,9 @@ const generate = async (argv) => {
|
|
|
25
24
|
const packageName = JSON.parse(await fs.readFile("package.json")).name;
|
|
26
25
|
|
|
27
26
|
const availableThemesArray = `[${themesOnFileSystem.map(theme => `"${theme}"`).join(", ")}]`;
|
|
28
|
-
const dynamicImportLines = themesOnFileSystem.map(theme => `\t\tcase "${theme}": return (await import(/* webpackChunkName: "${packageName.replace("@", "").replace("/", "-")}-${theme.replace("_", "-")}-parameters-bundle" */"../assets/themes/${theme}/parameters-bundle
|
|
29
|
-
const dynamicImportJSONAttrLines = themesOnFileSystem.map(theme => `\t\tcase "${theme}": return (await import(/* webpackChunkName: "${packageName.replace("@", "").replace("/", "-")}-${theme.replace("_", "-")}-parameters-bundle" */"../assets/themes/${theme}/parameters-bundle
|
|
30
|
-
const fetchMetaResolveLines = themesOnFileSystem.map(theme => `\t\tcase "${theme}": return (await fetch(new URL("../assets/themes/${theme}/parameters-bundle
|
|
27
|
+
const dynamicImportLines = themesOnFileSystem.map(theme => `\t\tcase "${theme}": return (await import(/* webpackChunkName: "${packageName.replace("@", "").replace("/", "-")}-${theme.replace("_", "-")}-parameters-bundle" */"../assets/themes/${theme}/parameters-bundle.css.json")).default;`).join("\n");
|
|
28
|
+
const dynamicImportJSONAttrLines = themesOnFileSystem.map(theme => `\t\tcase "${theme}": return (await import(/* webpackChunkName: "${packageName.replace("@", "").replace("/", "-")}-${theme.replace("_", "-")}-parameters-bundle" */"../assets/themes/${theme}/parameters-bundle.css.json", {with: { type: 'json'}})).default;`).join("\n");
|
|
29
|
+
const fetchMetaResolveLines = themesOnFileSystem.map(theme => `\t\tcase "${theme}": return (await fetch(new URL("../assets/themes/${theme}/parameters-bundle.css.json", import.meta.url))).json();`).join("\n");
|
|
31
30
|
|
|
32
31
|
// dynamic imports file content
|
|
33
32
|
const contentDynamic = function (lines) {
|
|
@@ -50,7 +49,7 @@ const loadAndCheck = async (themeName) => {
|
|
|
50
49
|
};
|
|
51
50
|
|
|
52
51
|
${availableThemesArray}
|
|
53
|
-
.forEach(themeName => registerThemePropertiesLoader(${
|
|
52
|
+
.forEach(themeName => registerThemePropertiesLoader(${packageName.split("").map(c => `"${c}"`).join(" + ")}, themeName, loadAndCheck));
|
|
54
53
|
`;
|
|
55
54
|
}
|
|
56
55
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
|
3
|
-
"version": "2.17.
|
|
3
|
+
"version": "2.17.1",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"esbuild": "^0.25.0",
|
|
83
83
|
"yargs": "^17.5.1"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "48db20034ae9198de4b4367866506631afe74105"
|
|
86
86
|
}
|