@ui5/webcomponents-tools 1.7.1 → 1.8.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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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.8.0](https://github.com/SAP/ui5-webcomponents/compare/v1.7.1...v1.8.0) (2022-10-03)
7
+
8
+
9
+ ### Features
10
+
11
+ * **icons:** create type-definitions for icon imports ([#5753](https://github.com/SAP/ui5-webcomponents/issues/5753)) ([2de4a04](https://github.com/SAP/ui5-webcomponents/commit/2de4a045f56e2f166d3e846ff11e6f9d76e98009)), closes [#5747](https://github.com/SAP/ui5-webcomponents/issues/5747) [#5335](https://github.com/SAP/ui5-webcomponents/issues/5335)
12
+ * **main:** add support for custom SVG icons ([#5865](https://github.com/SAP/ui5-webcomponents/issues/5865)) ([d8b7200](https://github.com/SAP/ui5-webcomponents/commit/d8b7200f30c16d94b7f15ddbdf9808d8efbaa38c))
13
+
14
+
15
+
16
+
17
+
6
18
  ## [1.7.1](https://github.com/SAP/ui5-webcomponents/compare/v1.7.0...v1.7.1) (2022-09-08)
7
19
 
8
20
  **Note:** Version bump only for package @ui5/webcomponents-tools
@@ -48,6 +48,23 @@ export default "${name}";
48
48
  export { pathData, ltr, accData };`;
49
49
 
50
50
 
51
+ const typeDefinitionTemplate = (name, accData, collection) => `declare const pathData: string;
52
+ declare const ltr: boolean;
53
+ declare const accData: ${accData ? '{ key: string; defaultText: string; }' : null}
54
+ declare const _default: "${collection}/${name}";
55
+
56
+ export default _default;
57
+ export { pathData, ltr, accData };`
58
+
59
+ const collectionTypeDefinitionTemplate = (name, accData) => `declare const pathData: string;
60
+ declare const ltr: boolean;
61
+ declare const accData: ${accData ? '{ key: string; defaultText: string; }' : null}
62
+ declare const _default: "${name}";
63
+
64
+ export default _default;
65
+ export { pathData, ltr, accData };`
66
+
67
+
51
68
  const svgTemplate = (pathData) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
52
69
  <path d="${pathData}"/>
53
70
  </svg>`;
@@ -68,9 +85,11 @@ const createIcons = async (file) => {
68
85
 
69
86
  promises.push(fs.writeFile(path.join(destDir, `${name}.js`), content));
70
87
  promises.push(fs.writeFile(path.join(destDir, `${name}.svg`), svgTemplate(pathData)));
88
+ promises.push(fs.writeFile(path.join(destDir, `${name}.d.ts`), typeDefinitionTemplate(name, acc, json.collection)));
71
89
 
72
90
  if (json.version) {
73
91
  promises.push(fs.writeFile(path.join(path.normalize("dist/"), `${name}.js`), collectionTemplate(name)));
92
+ promises.push(fs.writeFile(path.join(path.normalize("dist/"), `${name}.d.ts`), collectionTypeDefinitionTemplate(name, acc)));
74
93
  }
75
94
  }
76
95
 
@@ -17,6 +17,14 @@ const hbs2lit = async (file) => {
17
17
 
18
18
  sPreprocessed = removeWhiteSpaces(sPreprocessed);
19
19
 
20
+ // icons hack
21
+ if (sPreprocessed.startsWith("<g ") || sPreprocessed.startsWith("<g>")) {
22
+ return `
23
+ let block0 = () => {
24
+ return svg\`${sPreprocessed}\`
25
+ }`;
26
+ }
27
+
20
28
  const ast = Handlebars.parse(sPreprocessed);
21
29
 
22
30
  const pv = new PartialsVisitor();
@@ -22,6 +22,15 @@ const generate = async () => {
22
22
  } catch (e) {
23
23
  }
24
24
 
25
+ // Merge messagebundle.properties and messagebundle_en.properties files to generate the default texts.
26
+ // Note:
27
+ // (1) at DEV time, it's intuituve to work with the source bundle file - the messagebundle.properties,
28
+ // and see the changes there take effect.
29
+ // (2) as the messagebundle.properties file is always written in English,
30
+ // it makes sense to consider the messagebundle.properties content only when the default language is "en".
31
+ if (defaultLanguage === "en") {
32
+ defaultLanguageProperties = Object.assign({}, defaultLanguageProperties, properties);
33
+ }
25
34
 
26
35
  /*
27
36
  * Returns the single text object to enable single export.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "1.7.1",
3
+ "version": "1.8.0",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",