@ui5/webcomponents-tools 1.1.2 → 1.2.2

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,40 @@
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.2.2](https://github.com/SAP/ui5-webcomponents/compare/v1.2.1...v1.2.2) (2022-03-22)
7
+
8
+
9
+ **Note:** Version bump only for package @ui5/webcomponents-tools
10
+
11
+
12
+
13
+
14
+
15
+ ## [1.2.1](https://github.com/SAP/ui5-webcomponents/compare/v1.2.0...v1.2.1) (2022-03-02)
16
+
17
+ **Note:** Version bump only for package @ui5/webcomponents-tools
18
+
19
+
20
+
21
+
22
+
23
+ # [1.2.0](https://github.com/SAP/ui5-webcomponents/compare/v1.1.2...v1.2.0) (2022-02-28)
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * correct scoping issues with several components ([#4820](https://github.com/SAP/ui5-webcomponents/issues/4820)) ([621dc20](https://github.com/SAP/ui5-webcomponents/commit/621dc20))
29
+ * display methods in child components API ([#4792](https://github.com/SAP/ui5-webcomponents/issues/4792)) ([1929d08](https://github.com/SAP/ui5-webcomponents/commit/1929d08))
30
+
31
+
32
+ ### Features
33
+
34
+ * **jsdoc:** remove attr name for Object props ([#4680](https://github.com/SAP/ui5-webcomponents/issues/4680)) ([1741bd6](https://github.com/SAP/ui5-webcomponents/commit/1741bd6)), closes [#4674](https://github.com/SAP/ui5-webcomponents/issues/4674)
35
+
36
+
37
+
38
+
39
+
6
40
  ## [1.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
7
41
 
8
42
  **Note:** Version bump only for package @ui5/webcomponents-tools
package/assets-meta.js CHANGED
@@ -10,6 +10,9 @@ const assetsMeta = {
10
10
  "sap_fiori_3_hcb",
11
11
  "sap_fiori_3_hcw",
12
12
  "sap_horizon",
13
+ "sap_horizon_dark",
14
+ "sap_horizon_hcb",
15
+ "sap_horizon_hcw",
13
16
  "sap_horizon_exp"
14
17
  ]
15
18
  },
@@ -133,6 +136,7 @@ const assetsMeta = {
133
136
  "sk",
134
137
  "sl",
135
138
  "sr",
139
+ "sr_Latn",
136
140
  "sv",
137
141
  "th",
138
142
  "tr",
@@ -38,10 +38,10 @@ export default { pathData, accData };`;
38
38
 
39
39
 
40
40
 
41
- const collectionTemplate = (name) => `import { isTheme } from "@ui5/webcomponents-base/dist/config/Theme.js";
41
+ const collectionTemplate = (name) => `import { isThemeFamily } from "@ui5/webcomponents-base/dist/config/Theme.js";
42
42
  import pathDataV4 from "./v5/${name}.js";
43
43
  import pathDataV5 from "./v4/${name}.js";
44
- const pathData = isTheme("sap_horizon") ? pathDataV5 : pathDataV4;
44
+ const pathData = isThemeFamily("sap_horizon") ? pathDataV5 : pathDataV4;
45
45
  export default { pathData };`;
46
46
 
47
47
 
@@ -21,7 +21,9 @@ module.exports = {
21
21
  {{/if}}
22
22
  <br>
23
23
  {{#if (toKebabCase this.name)}}
24
- <code>{{toKebabCase this.name}}</code>
24
+ {{#unless this.noattribute}}
25
+ <code>{{toKebabCase this.name}}</code>
26
+ {{/unless}}
25
27
  {{/if}}
26
28
  </div>
27
29
  <div class="cell api-table-content-cell">{{this.type}}</div>
@@ -23,6 +23,7 @@ module.exports = {
23
23
  {{> properties this}}
24
24
  {{> slots this}}
25
25
  {{> events this}}
26
+ {{> methods this}}
26
27
  {{> cssVariables this}}
27
28
  </section>
28
29
  </section>
@@ -33,6 +33,8 @@
33
33
  *
34
34
  * native
35
35
  *
36
+ * noattribute
37
+ *
36
38
  * allowPreventDefault
37
39
  *
38
40
  * It furthermore listens to the following JSDoc3 events to implement additional functionality
@@ -2099,6 +2101,13 @@ exports.defineTags = function(dictionary) {
2099
2101
  doclet.native = true;
2100
2102
  }
2101
2103
  });
2104
+
2105
+ dictionary.defineTag('noattribute', {
2106
+ mustHaveValue: false,
2107
+ onTagged: function(doclet, tag) {
2108
+ doclet.noattribute = true;
2109
+ }
2110
+ });
2102
2111
  };
2103
2112
 
2104
2113
  exports.handlers = {
@@ -2804,6 +2804,10 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
2804
2804
  attrib("export", undefined, '', true);
2805
2805
  }
2806
2806
 
2807
+ if (member.noattribute) {
2808
+ attrib("noattribute", true);
2809
+ }
2810
+
2807
2811
  if (member.readonly) {
2808
2812
  attrib("readonly", member.readonly, null);
2809
2813
  }
@@ -2815,7 +2819,14 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
2815
2819
  if ( member.since ) {
2816
2820
  attrib("since", extractVersion(member.since));
2817
2821
  }
2818
- attrib("type", listTypes(member.type));
2822
+
2823
+ var type = listTypes(member.type);
2824
+ attrib("type", type);
2825
+
2826
+ if ((type === "object" || type === "Object") && visibility(member) === "public") {
2827
+ attrib("noattribute", true);
2828
+ }
2829
+
2819
2830
  tag("description", normalizeWS(member.description), true);
2820
2831
  if (member.defaultvalue) {
2821
2832
  attrib("defaultValue", member.defaultvalue);
@@ -3854,7 +3865,7 @@ function createAPIJS(symbols, filename) {
3854
3865
 
3855
3866
  var output = [];
3856
3867
 
3857
- var rkeywords = /^(?:abstract|as|boolean|break|byte|case|catch|char|class|continue|const|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|is|long|namespace|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|use|var|void|volatile|while|with)$/;
3868
+ var rkeywords = /^(?:abstract|as|boolean|break|byte|case|catch|char|class|continue|const|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|is|long|namespace|native|new|null|noattribute|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|use|var|void|volatile|while|with)$/;
3858
3869
 
3859
3870
  function isNoKeyword($) { return !rkeywords.test($.name); }
3860
3871
 
@@ -0,0 +1,65 @@
1
+ const fs = require("fs");
2
+ const glob = require("glob");
3
+ const path = require("path");
4
+ const process = require("process");
5
+
6
+ const projectPath = process.argv[2];
7
+
8
+ // gather all tags from all files
9
+ const tagsToFiles = new Map();
10
+ const filesToTags = new Map();
11
+
12
+ let files = [
13
+ ...glob.sync(path.join("packages/main/src/**/*.js")),
14
+ ...glob.sync(path.join("packages/fiori/src/**/*.js")),
15
+ ];
16
+ files.forEach(file => {
17
+ let matches = file.match(/([a-zA-Z0-9_]+)\.js$/);
18
+ const name = matches[1];
19
+
20
+ const content = `${fs.readFileSync(file)}`;
21
+ matches = content.match(/tag: "(.*?)",/);
22
+ if (matches) {
23
+ const tag = matches[1];
24
+ tagsToFiles.set(tag, name);
25
+ filesToTags.set(name, tag);
26
+ }
27
+ });
28
+
29
+ // Process the package
30
+ files = glob.sync(path.join(projectPath, "src/**/*.js"));
31
+ tagsToFiles.forEach((file, tag) => {
32
+ const sourcePath = path.join(projectPath, "src/", `${file}.js`);
33
+ if (!fs.existsSync(sourcePath)) {
34
+ return;
35
+ }
36
+ const sourceContent = `${fs.readFileSync(sourcePath)}`.split("\n").join(" ");
37
+
38
+ const hbsPath = path.join(projectPath, "src/", `${file}.hbs`);
39
+ const hbsContent = fs.existsSync(hbsPath) ? `${fs.readFileSync(hbsPath)}` : "";
40
+
41
+ const hbsPopoverPath = path.join(projectPath, "src/", `${file}Popover.hbs`);
42
+ const hbsPopoverContent = fs.existsSync(hbsPopoverPath) ? `${fs.readFileSync(hbsPopoverPath)}` : "";
43
+
44
+ // deps
45
+ let deps = [];
46
+ let matches = sourceContent.match(/static get dependencies\(\) \{\s+return \[(.*?)\]/);
47
+ if (matches) {
48
+ deps = matches[1].split(",").map(x => x.trim()).filter(x => !!x);
49
+ }
50
+
51
+ // tags
52
+ matches = [
53
+ ...hbsContent.matchAll(/<ui5-[a-z0-9-]+/g),
54
+ ...hbsPopoverContent.matchAll(/<ui5-[a-z0-9-]+/g),
55
+ ];
56
+ if (matches) {
57
+ matches.forEach(match => {
58
+ const tagUsed = match[0].substr(1);
59
+ const dep = tagsToFiles.get(tagUsed);
60
+ if (!deps.includes(dep)) {
61
+ console.log(`${file} used ${tagUsed}`);
62
+ }
63
+ });
64
+ }
65
+ });
@@ -0,0 +1,28 @@
1
+ const fs = require("fs");
2
+ const glob = require("glob");
3
+ const path = require("path");
4
+ const process = require("process");
5
+
6
+ // gather all tags from all files
7
+ const tags = new Set();
8
+ const files = glob.sync(path.join(process.argv[2], "src/**/*.js"));
9
+ files.forEach(file => {
10
+ const content = `${fs.readFileSync(file)}`;
11
+ const matches = content.match(/tag: "(.*?)",/);
12
+ if (matches) {
13
+ tags.add(matches[1]);
14
+ }
15
+ });
16
+
17
+ // report all usages of any tag within any file, which is not the tag definition and is not hasAttribute
18
+ files.forEach(file => {
19
+ const content = `${fs.readFileSync(file)}`;
20
+ const lines = content.split("\n");
21
+ lines.forEach(line => {
22
+ tags.forEach(tag => {
23
+ if (line.includes(`"${tag}"`) && !line.includes(`tag: "${tag}",`) && !line.includes(`hasAttribute("${tag}")`)) {
24
+ console.log(`${file}: ${line.trim()}`);
25
+ }
26
+ });
27
+ });
28
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "1.1.2",
3
+ "version": "1.2.2",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -79,4 +79,4 @@
79
79
  "peerDependencies": {
80
80
  "chromedriver": "*"
81
81
  }
82
- }
82
+ }