@ui5/webcomponents-tools 2.0.0-rc.1 → 2.0.0-rc.3

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,66 @@
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.0.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v2.0.0-rc.2...v2.0.0-rc.3) (2024-05-10)
7
+
8
+
9
+ ### chore
10
+
11
+ * **Icons:** make pathData async ([#8785](https://github.com/SAP/ui5-webcomponents/issues/8785)) ([0549dc9](https://github.com/SAP/ui5-webcomponents/commit/0549dc95edae139f7a4f9efbbc7170922b3ab6cb))
12
+
13
+
14
+ ### Code Refactoring
15
+
16
+ * **theming:** remove Belize theme ([#8519](https://github.com/SAP/ui5-webcomponents/issues/8519)) ([990313f](https://github.com/SAP/ui5-webcomponents/commit/990313fc8e429a491f4d6e67306d3df2703e54fe)), closes [#8461](https://github.com/SAP/ui5-webcomponents/issues/8461)
17
+
18
+
19
+ ### BREAKING CHANGES
20
+
21
+ * **theming:** Remove SAP Belize theme
22
+ * **Icons:** UI5 Web Components Icons now export `getPathData` (function) instead of `pathData` (string)
23
+
24
+ If you used icons like this:
25
+
26
+ ```js
27
+ import "@ui5/webcomponents-icons/dist/accept.js";
28
+ ```
29
+
30
+ or like this:
31
+
32
+ ```js
33
+ import accept from "@ui5/webcomponents-icons/dist/accept.js";
34
+ ```
35
+
36
+ **there is no change and no adaptations are required**.
37
+
38
+ In the rare case you imported `pathData` from icons, for example:
39
+
40
+ ```js
41
+ import { pathData, ltr, accData } from "@ui5/webcomponents-icons/dist/accept.js";
42
+ console.log(pathData); // String containing the SVG path
43
+ ```
44
+
45
+ you must change your code to, for example:
46
+
47
+ ```js
48
+ import { getPathData, ltr, accData } from "@ui5/webcomponents-icons/dist/accept.js";
49
+ getPathData().then(pathData => {
50
+ console.log(pathData); // String containing the SVG path
51
+ });
52
+ ```
53
+
54
+
55
+
56
+
57
+
58
+ # [2.0.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v2.0.0-rc.1...v2.0.0-rc.2) (2024-04-18)
59
+
60
+ **Note:** Version bump only for package @ui5/webcomponents-tools
61
+
62
+
63
+
64
+
65
+
6
66
  # [2.0.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v2.0.0-rc.0...v2.0.0-rc.1) (2024-04-11)
7
67
 
8
68
  **Note:** Version bump only for package @ui5/webcomponents-tools
package/assets-meta.js CHANGED
@@ -4,9 +4,6 @@ const assetsMeta = {
4
4
  "all": [
5
5
  "sap_fiori_3",
6
6
  "sap_fiori_3_dark",
7
- "sap_belize",
8
- "sap_belize_hcb",
9
- "sap_belize_hcw",
10
7
  "sap_fiori_3_hcb",
11
8
  "sap_fiori_3_hcw",
12
9
  "sap_horizon",
@@ -100,7 +100,7 @@ const getScripts = (options) => {
100
100
  props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
101
101
  },
102
102
  watch: {
103
- default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" "nps watch.api" "nps watch.src" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
103
+ default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" "nps watch.src" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
104
104
  devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
105
105
  src: 'nps "copy.src --watch --safe --skip-initial-copy"',
106
106
  typescript: tsWatchCommandStandalone,
@@ -113,7 +113,6 @@ const getScripts = (options) => {
113
113
  componentStyles: `nps "build.styles.componentStyles -w"`,
114
114
  },
115
115
  templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
116
- api: 'nps generateAPI',
117
116
  i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
118
117
  },
119
118
  start: "nps prepare watch.devServer",
@@ -131,7 +130,7 @@ const getScripts = (options) => {
131
130
  replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
132
131
  },
133
132
  watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
134
- watch: 'concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.props" "nps watch.styles"',
133
+ watch: 'concurrently "nps watch.templates" "nps watch.src" "nps watch.props" "nps watch.styles"',
135
134
  bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
136
135
  },
137
136
  generateAPI: {
@@ -38,14 +38,16 @@ export { pathData, ltr, accData };`;
38
38
 
39
39
 
40
40
 
41
- const collectionTemplate = (name, versions, fullName) => `import { isLegacyThemeFamily } from "@ui5/webcomponents-base/dist/config/Theme.js";
41
+ const collectionTemplate = (name, versions, fullName) => `import { isLegacyThemeFamilyAsync } from "@ui5/webcomponents-base/dist/config/Theme.js";
42
42
  import { pathData as pathData${versions[0]}, ltr, accData } from "./${versions[0]}/${name}.js";
43
43
  import { pathData as pathData${versions[1]} } from "./${versions[1]}/${name}.js";
44
44
 
45
- const pathData = isLegacyThemeFamily() ? pathData${versions[0]} : pathData${versions[1]};
45
+ const getPathData = async() => {
46
+ return await isLegacyThemeFamilyAsync() ? pathDatav4 : pathDatav5;
47
+ };
46
48
 
47
49
  export default "${fullName}";
48
- export { pathData, ltr, accData };`;
50
+ export { getPathData, ltr, accData };`;
49
51
 
50
52
 
51
53
  const typeDefinitionTemplate = (name, accData, collection) => `declare const pathData: string;
@@ -56,13 +58,13 @@ declare const _default: "${collection}/${name}";
56
58
  export default _default;
57
59
  export { pathData, ltr, accData };`
58
60
 
59
- const collectionTypeDefinitionTemplate = (name, accData) => `declare const pathData: string;
61
+ const collectionTypeDefinitionTemplate = (name, accData) => `declare const getPathData: () => Promise<string>;
60
62
  declare const ltr: boolean;
61
63
  declare const accData: ${accData ? '{ key: string; defaultText: string; }' : null}
62
64
  declare const _default: "${name}";
63
65
 
64
66
  export default _default;
65
- export { pathData, ltr, accData };`
67
+ export { getPathData, ltr, accData };`
66
68
 
67
69
 
68
70
  const svgTemplate = (pathData) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
@@ -91,7 +93,7 @@ const createIcons = async (file) => {
91
93
 
92
94
  // For versioned icons collections, the script creates top level (unversioned) module that internally imports the versioned ones.
93
95
  // For example, the top level "@ui5/ui5-webcomponents-icons/dist/accept.js" imports:
94
- // - "@ui5/ui5-webcomponents-icons/dist/v5/accept.js"
96
+ // - "@ui5/ui5-webcomponents-icons/dist/v5/accept.js"
95
97
  // - "@ui5/ui5-webcomponents-icons/dist/v4/accept.js"
96
98
 
97
99
  if (json.version) {
@@ -0,0 +1,26 @@
1
+ const fs = require("fs");
2
+
3
+ /**
4
+ * UI5Elements loads the ssr-dom.js file with a package specifier to use the export conditions
5
+ * in the package.json so that a shim for the dom can be loaded from SSR environments
6
+ * This however makes the TS Checker plugin used for development try to load the file from dist as input
7
+ * This plugin loads an empty file and TS ignores the file completely
8
+ */
9
+
10
+ const ssrDomShimLoader = async () => {
11
+ return {
12
+ name: 'ssr-dom-shim-loader',
13
+ resolveId(id) {
14
+ if (id === "@ui5/webcomponents-base/dist/ssr-dom.js") {
15
+ return "\0shim"
16
+ }
17
+ },
18
+ load(id) {
19
+ if (id === "\0shim") {
20
+ return "";
21
+ }
22
+ }
23
+ }
24
+ };
25
+
26
+ module.exports = ssrDomShimLoader;
@@ -7,25 +7,26 @@ const tags = getAllTags(process.cwd());
7
7
 
8
8
  const errors = [];
9
9
 
10
+ const removeComments = str => str.replaceAll(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, "");
11
+
10
12
  glob.sync(path.join(process.cwd(), "src/**/*.css")).forEach(file => {
11
- let content = String(fs.readFileSync(file));
13
+ let content = removeComments(String(fs.readFileSync(file)));
12
14
  tags.forEach(tag => {
13
15
  if (content.match(new RegExp(`(^|[^\.\-_A-Za-z0-9"\[])(${tag})([^\-_A-Za-z0-9]|$)`, "g"))) {
14
- errors.push(`Warning! ${tag} found in ${file}`);
16
+ errors.push(`${tag} found in ${file}`);
15
17
  }
16
18
  });
17
19
  });
18
20
 
19
- glob.sync(path.join(process.cwd(), "src/**/*.js")).forEach(file => {
20
- let content = String(fs.readFileSync(file));
21
+ glob.sync(path.join(process.cwd(), "src/**/*.ts")).forEach(file => {
22
+ let content = removeComments(String(fs.readFileSync(file)));
21
23
  tags.forEach(tag => {
22
24
  if (content.match(new RegExp(`querySelector[A-Za-z]*..${tag}`, "g"))) {
23
- errors.push(`Warning! querySelector for ${tag} found in ${file}`);
25
+ errors.push(`querySelector for ${tag} found in ${file}`);
24
26
  }
25
27
  });
26
28
  });
27
29
 
28
30
  if (errors.length) {
29
- errors.forEach(error => console.log(error));
30
- throw new Error("Errors found.");
31
+ throw new Error(`Scoping-related errors found (f.e. used ui5-input instead of [ui5-input]): \n ${errors.join("\n")}`);
31
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "2.0.0-rc.1",
3
+ "version": "2.0.0-rc.3",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -80,5 +80,5 @@
80
80
  "esbuild": "^0.19.9",
81
81
  "yargs": "^17.5.1"
82
82
  },
83
- "gitHead": "4594e9aa13dbb152e422c93126412c654357f43f"
83
+ "gitHead": "4a5356f64d72a8cbf752bb9f3dee5f57528743aa"
84
84
  }