@ui5/webcomponents-tools 1.22.0-rc.0 → 1.22.0-rc.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
CHANGED
@@ -3,6 +3,17 @@
|
|
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
|
+
# [1.22.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.22.0-rc.0...v1.22.0-rc.1) (2024-01-18)
|
7
|
+
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
* **illustration:** use illustration name as default module export ([#8074](https://github.com/SAP/ui5-webcomponents/issues/8074)) ([a9c0705](https://github.com/SAP/ui5-webcomponents/commit/a9c07055d4e06e4d1f69b7a2a48b36eb77fae4aa))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
6
17
|
# [1.22.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.21.0...v1.22.0-rc.0) (2024-01-11)
|
7
18
|
|
8
19
|
**Note:** Version bump only for package @ui5/webcomponents-tools
|
@@ -12,7 +12,7 @@ const getScripts = (options) => {
|
|
12
12
|
const createIllustrationsJSImportsScript = illustrations.join(" && ");
|
13
13
|
|
14
14
|
// The script creates the "src/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
|
15
|
-
const createIllustrationsLoadersScript = illustrationsData.map(illustrations => `node ${LIB}/generate-js-imports/illustrations.js ${illustrations.destinationPath} ${illustrations.dynamicImports.outputFile} ${illustrations.
|
15
|
+
const createIllustrationsLoadersScript = illustrationsData.map(illustrations => `node ${LIB}/generate-js-imports/illustrations.js ${illustrations.destinationPath} ${illustrations.dynamicImports.outputFile} ${illustrations.set} ${illustrations.collection} ${illustrations.dynamicImports.location} ${illustrations.dynamicImports.filterOut.join(" ")}`).join(" && ");
|
16
16
|
|
17
17
|
const tsOption = options.typescript;
|
18
18
|
const tsCommandOld = tsOption ? "tsc" : "";
|
@@ -59,7 +59,7 @@ const generate = async () => {
|
|
59
59
|
const destPath = process.argv[6];
|
60
60
|
const collection = process.argv[7];
|
61
61
|
const fileNamePattern = new RegExp(`${illustrationsPrefix}-.+-(.+).svg`);
|
62
|
-
// collect each illustration name because each one should have Sample.js file
|
62
|
+
// collect each illustration name because each one should have Sample.js file
|
63
63
|
const fileNames = new Set();
|
64
64
|
|
65
65
|
try {
|
@@ -75,7 +75,7 @@ const generate = async () => {
|
|
75
75
|
return `export default \`${svgContent}\`;`
|
76
76
|
};
|
77
77
|
const svgToJs = async fileName => {
|
78
|
-
const svg = await fs.readFile(path.join(srcPath, fileName), {encoding: "utf-8"});
|
78
|
+
const svg = await fs.readFile(path.join(srcPath, fileName), { encoding: "utf-8" });
|
79
79
|
const fileContent = svgImportTemplate(svg);
|
80
80
|
fileName = fileName.replace(/\.svg$/, ".js");
|
81
81
|
|
@@ -94,58 +94,47 @@ const generate = async () => {
|
|
94
94
|
|
95
95
|
const illustrationNameUpperCase = illustrationNameForTranslation.toUpperCase();
|
96
96
|
|
97
|
-
return
|
97
|
+
return `import { registerIllustration } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
|
98
98
|
import dialogSvg from "./${illustrationsPrefix}-Dialog-${illustrationName}.js";
|
99
99
|
import sceneSvg from "./${illustrationsPrefix}-Scene-${illustrationName}.js";
|
100
|
-
import spotSvg from "./${illustrationsPrefix}-Spot-${illustrationName}.js"
|
101
|
-
import {
|
100
|
+
import spotSvg from "./${illustrationsPrefix}-Spot-${illustrationName}.js";${
|
101
|
+
defaultText ? `import {
|
102
102
|
IM_TITLE_${illustrationNameUpperCase},
|
103
103
|
IM_SUBTITLE_${illustrationNameUpperCase},
|
104
|
-
} from "../generated/i18n/i18n-defaults.js"
|
104
|
+
} from "../generated/i18n/i18n-defaults.js";` : ``}
|
105
105
|
|
106
106
|
const name = "${illustrationName}";
|
107
107
|
const set = "${illustrationSet}";
|
108
|
-
const collection = "${collection}"
|
108
|
+
const collection = "${collection}";${defaultText ? `
|
109
109
|
const title = IM_TITLE_${illustrationNameUpperCase};
|
110
|
-
const subtitle = IM_SUBTITLE_${illustrationNameUpperCase}
|
110
|
+
const subtitle = IM_SUBTITLE_${illustrationNameUpperCase};` : ``}
|
111
111
|
|
112
112
|
registerIllustration(name, {
|
113
113
|
dialogSvg,
|
114
114
|
sceneSvg,
|
115
|
-
spotSvg
|
115
|
+
spotSvg,${defaultText ? `
|
116
116
|
title,
|
117
|
-
subtitle
|
117
|
+
subtitle,` : ``}
|
118
118
|
set,
|
119
119
|
collection,
|
120
120
|
});
|
121
121
|
|
122
|
+
export default "${illustrationSet === "fiori" ? "" : `${illustrationSet}/`}${illustrationName}";
|
122
123
|
export {
|
123
124
|
dialogSvg,
|
124
125
|
sceneSvg,
|
125
126
|
spotSvg,
|
126
|
-
};`
|
127
|
-
|
128
|
-
import dialogSvg from "./${illustrationsPrefix}-Dialog-${illustrationName}.js";
|
129
|
-
import sceneSvg from "./${illustrationsPrefix}-Scene-${illustrationName}.js";
|
130
|
-
import spotSvg from "./${illustrationsPrefix}-Spot-${illustrationName}.js";
|
131
|
-
|
132
|
-
const name = "${illustrationName}";
|
133
|
-
const set = "${illustrationSet}";
|
134
|
-
const collection = "${collection}";
|
127
|
+
};`
|
128
|
+
};
|
135
129
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
collection,
|
142
|
-
});
|
130
|
+
const illustrationTypeDefinition = illustrationName => {
|
131
|
+
return `declare const dialogSvg: string;
|
132
|
+
declare const sceneSvg: string;
|
133
|
+
declare const spotSvg: string;
|
134
|
+
declare const _default: "${illustrationSet === "fiori" ? "" : `${illustrationSet}/`}${illustrationName}";
|
143
135
|
|
144
|
-
export
|
145
|
-
|
146
|
-
sceneSvg,
|
147
|
-
spotSvg,
|
148
|
-
};`
|
136
|
+
export default _default;
|
137
|
+
export { dialogSvg, sceneSvg, spotSvg };`
|
149
138
|
};
|
150
139
|
|
151
140
|
await fs.mkdir(destPath, { recursive: true });
|
@@ -165,6 +154,7 @@ export {
|
|
165
154
|
|
166
155
|
for (let illustrationName of fileNames) {
|
167
156
|
promises.push(fs.writeFile(path.join(destPath, `${illustrationName}.js`), illustrationImportTemplate(illustrationName)));
|
157
|
+
promises.push(fs.writeFile(path.join(destPath, `${illustrationName}.d.ts`), illustrationTypeDefinition(illustrationName)));
|
168
158
|
}
|
169
159
|
|
170
160
|
return Promise.all(promises);
|
@@ -25,10 +25,7 @@ import ${componentName}Css from "./generated/themes/${componentName}.css.js";
|
|
25
25
|
* <code>import ${packageName}/dist/${componentName}.js";</code>
|
26
26
|
*
|
27
27
|
* @constructor
|
28
|
-
* @
|
29
|
-
* @alias sap.ui.webc.${library}.${componentName}
|
30
|
-
* @extends sap.ui.webc.base.UI5Element
|
31
|
-
* @tagname ${tagName}
|
28
|
+
* @extends UI5Element
|
32
29
|
* @public
|
33
30
|
*/
|
34
31
|
@customElement({
|
@@ -43,7 +40,6 @@ import ${componentName}Css from "./generated/themes/${componentName}.css.js";
|
|
43
40
|
* Example custom event.
|
44
41
|
* Please keep in mind that all public events should be documented in the API Reference as shown below.
|
45
42
|
*
|
46
|
-
* @event sap.ui.webc.${library}.${componentName}#interact
|
47
43
|
* @public
|
48
44
|
*/
|
49
45
|
@event("interact", { detail: { /* event payload ( optional ) */ } })
|
@@ -51,9 +47,7 @@ class ${componentName} extends UI5Element {
|
|
51
47
|
/**
|
52
48
|
* Defines the value of the component.
|
53
49
|
*
|
54
|
-
* @
|
55
|
-
* @name sap.ui.webc.${library}.${componentName}.prototype.value
|
56
|
-
* @defaultvalue ""
|
50
|
+
* @default ""
|
57
51
|
* @public
|
58
52
|
*/
|
59
53
|
@property()
|
@@ -62,9 +56,6 @@ class ${componentName} extends UI5Element {
|
|
62
56
|
/**
|
63
57
|
* Defines the text of the component.
|
64
58
|
*
|
65
|
-
* @type {Node[]}
|
66
|
-
* @name sap.ui.webc.${library}.${componentName}.prototype.default
|
67
|
-
* @slot
|
68
59
|
* @public
|
69
60
|
*/
|
70
61
|
@slot({ type: Node, "default": true })
|
@@ -21,12 +21,12 @@ const generateAvailableIllustrationsArray = (fileNames, exclusionPatterns = [])
|
|
21
21
|
);
|
22
22
|
};
|
23
23
|
|
24
|
-
const generateDynamicImportsFileContent = (dynamicImports, availableIllustrations, collection, prefix = "") => {
|
24
|
+
const generateDynamicImportsFileContent = (dynamicImports, availableIllustrations, collection, set, prefix = "") => {
|
25
25
|
return `// @ts-nocheck
|
26
26
|
import { registerIllustrationLoader } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
|
27
27
|
|
28
28
|
export const loadIllustration = async (illustrationName) => {
|
29
|
-
const collectionAndPrefix = "${collection}/${prefix}";
|
29
|
+
const collectionAndPrefix = "${set}/${collection}/${prefix}";
|
30
30
|
const cleanIllustrationName = illustrationName.startsWith(collectionAndPrefix) ? illustrationName.replace(collectionAndPrefix, "") : illustrationName;
|
31
31
|
switch (cleanIllustrationName) {
|
32
32
|
${dynamicImports}
|
@@ -41,7 +41,7 @@ const loadAndCheck = async (illustrationName) => {
|
|
41
41
|
};
|
42
42
|
|
43
43
|
${availableIllustrations}.forEach((illustrationName) =>
|
44
|
-
registerIllustrationLoader(\`${collection}/${prefix}\${illustrationName}\`, loadAndCheck)
|
44
|
+
registerIllustrationLoader(\`${set}/${collection}/${prefix}\${illustrationName}\`, loadAndCheck)
|
45
45
|
);
|
46
46
|
`;
|
47
47
|
};
|
@@ -52,7 +52,7 @@ const getMatchingFiles = async (folder, pattern) => {
|
|
52
52
|
};
|
53
53
|
|
54
54
|
const generateIllustrations = async (config) => {
|
55
|
-
const { inputFolder, outputFile, collection, location, prefix, filterOut } = config;
|
55
|
+
const { inputFolder, outputFile, collection, location, prefix, filterOut, set } = config;
|
56
56
|
|
57
57
|
const normalizedInputFolder = path.normalize(inputFolder);
|
58
58
|
const normalizedOutputFile = path.normalize(outputFile);
|
@@ -62,7 +62,7 @@ const generateIllustrations = async (config) => {
|
|
62
62
|
const dynamicImports = await generateDynamicImportLines(illustrations, location, filterOut);
|
63
63
|
const availableIllustrations = generateAvailableIllustrationsArray(illustrations, filterOut);
|
64
64
|
|
65
|
-
const contentDynamic = generateDynamicImportsFileContent(dynamicImports, availableIllustrations, collection, prefix);
|
65
|
+
const contentDynamic = generateDynamicImportsFileContent(dynamicImports, availableIllustrations, collection, set, prefix);
|
66
66
|
|
67
67
|
await fs.mkdir(path.dirname(normalizedOutputFile), { recursive: true });
|
68
68
|
await fs.writeFile(normalizedOutputFile, contentDynamic);
|
@@ -74,10 +74,10 @@ const generateIllustrations = async (config) => {
|
|
74
74
|
const config = {
|
75
75
|
inputFolder: process.argv[2],
|
76
76
|
outputFile: process.argv[3],
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
filterOut: process.argv.slice
|
77
|
+
set: process.argv[4],
|
78
|
+
collection: process.argv[5],
|
79
|
+
location: process.argv[6],
|
80
|
+
filterOut: process.argv.slice[7],
|
81
81
|
};
|
82
82
|
|
83
83
|
// Run the generation process
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "1.22.0-rc.
|
3
|
+
"version": "1.22.0-rc.1",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -79,5 +79,5 @@
|
|
79
79
|
"esbuild": "^0.19.9",
|
80
80
|
"yargs": "^17.5.1"
|
81
81
|
},
|
82
|
-
"gitHead": "
|
82
|
+
"gitHead": "1a4ba450e7d222535ddaf4f1d3b0ff91b020bb2a"
|
83
83
|
}
|