@ui5/webcomponents-tools 0.0.0-fb61e9889 → 0.0.0-fd6264051

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,80 @@
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.0](https://github.com/SAP/ui5-webcomponents/compare/v1.1.2...v1.2.0) (2022-02-28)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * correct scoping issues with several components ([#4820](https://github.com/SAP/ui5-webcomponents/issues/4820)) ([621dc20](https://github.com/SAP/ui5-webcomponents/commit/621dc20))
12
+ * display methods in child components API ([#4792](https://github.com/SAP/ui5-webcomponents/issues/4792)) ([1929d08](https://github.com/SAP/ui5-webcomponents/commit/1929d08))
13
+
14
+
15
+ ### Features
16
+
17
+ * **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)
18
+
19
+
20
+
21
+
22
+
23
+ ## [1.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
24
+
25
+ **Note:** Version bump only for package @ui5/webcomponents-tools
26
+
27
+
28
+
29
+
30
+
31
+ ## [1.1.1](https://github.com/SAP/ui5-webcomponents/compare/v1.1.0...v1.1.1) (2022-01-24)
32
+
33
+ **Note:** Version bump only for package @ui5/webcomponents-tools
34
+
35
+
36
+
37
+
38
+
39
+ # [1.1.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.2...v1.1.0) (2022-01-21)
40
+
41
+
42
+ **Note:** Version bump only for package @ui5/webcomponents-tools
43
+
44
+
45
+
46
+
47
+
48
+ ## [1.0.2](https://github.com/SAP/ui5-webcomponents/compare/v1.0.1...v1.0.2) (2021-11-29)
49
+
50
+ **Note:** Version bump only for package @ui5/webcomponents-tools
51
+
52
+
53
+
54
+
55
+
56
+ ## [1.0.1](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0...v1.0.1) (2021-11-10)
57
+
58
+ **Note:** Version bump only for package @ui5/webcomponents-tools
59
+
60
+
61
+
62
+
63
+
64
+ # [1.0.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.16...v1.0.0) (2021-11-10)
65
+
66
+
67
+ **Note:** Version bump only for package @ui5/webcomponents-tools
68
+
69
+
70
+ # [1.0.0-rc.16](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.15...v1.0.0-rc.16) (2021-11-09)
71
+
72
+
73
+
74
+ ### Features
75
+
76
+ * **tools:** create an npm init script ([#4090](https://github.com/SAP/ui5-webcomponents/issues/4090)) ([5608e04](https://github.com/SAP/ui5-webcomponents/commit/5608e04))
77
+
78
+
79
+
6
80
  # [1.0.0-rc.15](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.14...v1.0.0-rc.15) (2021-07-23)
7
81
 
8
82
 
package/README.md CHANGED
@@ -17,7 +17,7 @@ used by other UI5 Web Components packages, such as `main` and `fiori`.
17
17
  We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://join-ui5-slack.herokuapp.com/).
18
18
 
19
19
  ## Contribute
20
- Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/CONTRIBUTING.md).
20
+ Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/docs/6-contributing/02-conventions-and-guidelines.md).
21
21
 
22
22
  ## License
23
23
  Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
package/assets-meta.js CHANGED
@@ -9,7 +9,11 @@ const assetsMeta = {
9
9
  "sap_belize_hcw",
10
10
  "sap_fiori_3_hcb",
11
11
  "sap_fiori_3_hcw",
12
- "sap_horizon"
12
+ "sap_horizon",
13
+ "sap_horizon_dark",
14
+ "sap_horizon_hcb",
15
+ "sap_horizon_hcw",
16
+ "sap_horizon_exp"
13
17
  ]
14
18
  },
15
19
  "languages": {
@@ -3,6 +3,9 @@ const combineSelectors = require('postcss-combine-duplicated-selectors');
3
3
  const postcssCSStoJSON = require('../lib/postcss-css-to-json/index.js');
4
4
  const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
5
5
  const cssnano = require('cssnano');
6
+ const fs = require("fs");
7
+
8
+ const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
6
9
 
7
10
  module.exports = {
8
11
  plugins: [
@@ -17,7 +20,7 @@ module.exports = {
17
20
  },
18
21
  ]
19
22
  },),
20
- postcssCSStoJSON({toReplace: 'src'}),
21
- postcssCSStoESM({toReplace: 'src'}),
23
+ postcssCSStoJSON({toReplace: 'src', packageName}),
24
+ postcssCSStoESM({toReplace: 'src', packageName}),
22
25
  ]
23
26
  };
@@ -7,7 +7,8 @@ const url = require("@rollup/plugin-url");
7
7
  const { terser } = require("rollup-plugin-terser");
8
8
  const json = require("@rollup/plugin-json");
9
9
  const replace = require("@rollup/plugin-replace");
10
- const colors = require("colors/safe");
10
+ const commonjs = require("@rollup/plugin-commonjs");
11
+ const colors = require("cli-color");
11
12
  const filesize = require("rollup-plugin-filesize");
12
13
  const livereload = require("rollup-plugin-livereload");
13
14
  const emptyModulePlugin = require("./rollup-plugins/empty-module.js");
@@ -137,10 +138,11 @@ const getPlugins = ({ transpile }) => {
137
138
  }
138
139
 
139
140
  if (transpile) {
141
+ plugins.push(commonjs());
140
142
  plugins.push(babel({
141
143
  presets: ["@babel/preset-env"],
142
144
  exclude: /node_modules\/(?!(lit-html|@ui5\/webcomponents))/, // exclude all node_modules/ except lit-html and all starting with @ui5/webcomponents
143
- sourcemap: true,
145
+ sourcemap: false,
144
146
  babelHelpers: "bundled",
145
147
  }));
146
148
  }
@@ -168,6 +168,21 @@ exports.config = {
168
168
  }, this);
169
169
  }, true);
170
170
 
171
+ await browser.addCommand("isFocusedDeepElement", async function (element) {
172
+ return browser.executeAsync(function (elem, element, done) {
173
+ let activeElement = document.activeElement;
174
+
175
+ while (activeElement.shadowRoot) {
176
+ if (activeElement.shadowRoot.activeElement) {
177
+ activeElement = activeElement.shadowRoot.activeElement;
178
+ } else {
179
+ break;
180
+ }
181
+ }
182
+ done(element === activeElement);
183
+ }, this, element);
184
+ }, true);
185
+
171
186
  await browser.addCommand("setProperty", async function(property, value) {
172
187
  return browser.executeAsync((elem, property, value, done) => {
173
188
  elem[property] = value;
@@ -230,6 +245,7 @@ exports.config = {
230
245
  "isExisting",
231
246
  "isFocused",
232
247
  "isFocusedDeep", // custom
248
+ "isFocusedDeepElement", // custom
233
249
  "shadow$",
234
250
  "shadow$$",
235
251
  ];
@@ -168,6 +168,21 @@ exports.config = {
168
168
  }, this);
169
169
  }, true);
170
170
 
171
+ browser.addCommand("isFocusedDeepElement", function (element) {
172
+ return browser.execute(function (elem, element, done) {
173
+ let activeElement = document.activeElement;
174
+
175
+ while (activeElement.shadowRoot) {
176
+ if (activeElement.shadowRoot.activeElement) {
177
+ activeElement = activeElement.shadowRoot.activeElement;
178
+ } else {
179
+ break;
180
+ }
181
+ }
182
+ done(element === activeElement);
183
+ }, this, element);
184
+ }, true);
185
+
171
186
  browser.addCommand("setProperty", function(property, value) {
172
187
  return browser.execute((elem, property, value) => {
173
188
  return elem[property] = value;
@@ -223,6 +238,7 @@ exports.config = {
223
238
  "isExisting",
224
239
  "isFocused",
225
240
  "isFocusedDeep", // custom
241
+ "isFocusedDeepElement", // custom
226
242
  "shadow$",
227
243
  "shadow$$",
228
244
  ];
@@ -7,15 +7,49 @@ const UP_TO_DATE = `node "${hashIsUpToDate}" dist/ hash.txt && echo "Up to date.
7
7
 
8
8
  const LIB = path.join(__dirname, `../lib/`);
9
9
 
10
+ const createIconImportsCommand = (options) => {
11
+ if (!options.versions) {
12
+ return `node "${LIB}/create-icons/index.js" "${options.collectionName}"`;
13
+ }
14
+
15
+ const command = { default: "nps" };
16
+ options.versions.forEach((v) => {
17
+ command.default += ` build.icons.create${v}`;
18
+ command[`create${v}`] = `node "${LIB}/create-icons/index.js" "${options.collectionName}" "${v}"`;
19
+ });
20
+
21
+ return command;
22
+ }
23
+
24
+ const copyIconAssetsCommand = (options) => {
25
+ if (!options.versions) {
26
+ return {
27
+ default: "nps copy.json-imports copy.icon-collection",
28
+ "json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
29
+ "icon-collection": `node "${LIB}/copy-and-watch/index.js" --silent "src/*.json" dist/generated/assets/`,
30
+ }
31
+ }
32
+
33
+ const command = {
34
+ default: "nps copy.json-imports ",
35
+ "json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
36
+ };
37
+
38
+ options.versions.forEach((v) => {
39
+ command.default += ` copy.icon-collection${v}`;
40
+ command[`icon-collection${v}`] = `node "${LIB}/copy-and-watch/index.js" --silent "src/${v}/*.json" dist/generated/assets/${v}/`;
41
+ });
42
+
43
+ return command;
44
+ }
45
+
10
46
  const getScripts = (options) => {
47
+ const createJSImportsCmd = createIconImportsCommand(options);
48
+ const copyAssetsCmd = copyIconAssetsCommand(options);
11
49
 
12
50
  const scripts = {
13
51
  clean: "rimraf dist",
14
- copy: {
15
- default: "nps copy.json-imports copy.icon-collection",
16
- "json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
17
- "icon-collection": `node "${LIB}/copy-and-watch/index.js" --silent "src/*.json" dist/generated/assets/`
18
- },
52
+ copy: copyAssetsCmd,
19
53
  build: {
20
54
  default: `${UP_TO_DATE} || nps clean copy build.i18n build.icons build.jsonImports hash`,
21
55
  i18n: {
@@ -27,7 +61,7 @@ const getScripts = (options) => {
27
61
  default: "mkdirp dist/generated/json-imports && nps build.jsonImports.i18n",
28
62
  i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
29
63
  },
30
- icons: `node "${LIB}/create-icons/index.js" "${options.collectionName}"`,
64
+ icons: createJSImportsCmd,
31
65
  },
32
66
  hash: `node "${generateHash}" dist/ hash.txt`,
33
67
  };
@@ -3,12 +3,13 @@ const path = require("path");
3
3
  const mkdirp = require("mkdirp");
4
4
 
5
5
  const collectionName = process.argv[2] || "SAP-icons";
6
- const srcFile = path.normalize(`src/${collectionName}.json`);
7
- const destDir = path.normalize("dist/");
6
+ const collectionVersion = process.argv[3];
7
+ const srcFile = collectionVersion ? path.normalize(`src/${collectionVersion}/${collectionName}.json`) : path.normalize(`src/${collectionName}.json`);
8
+ const destDir = collectionVersion ? path.normalize(`dist/${collectionVersion}/`) : path.normalize("dist/");
8
9
 
9
10
  mkdirp.sync(destDir);
10
11
 
11
- const template = (name, pathData, ltr, collection, packageName) => `import { registerIcon } from "@ui5/webcomponents-base/dist/asset-registries/Icons.js";
12
+ const iconTemplate = (name, pathData, ltr, collection, packageName) => `import { registerIcon } from "@ui5/webcomponents-base/dist/asset-registries/Icons.js";
12
13
 
13
14
  const name = "${name}";
14
15
  const pathData = "${pathData}";
@@ -21,8 +22,8 @@ registerIcon(name, { pathData, ltr, collection, packageName });
21
22
  export default { pathData };`;
22
23
 
23
24
 
24
- const accTemplate = (name, pathData, ltr, accData, collection, packageName) => `import { registerIcon } from "@ui5/webcomponents-base/dist/asset-registries/Icons.js";
25
- import { ${accData.key} } from "./generated/i18n/i18n-defaults.js";
25
+ const iconAccTemplate = (name, pathData, ltr, accData, collection, packageName) => `import { registerIcon } from "@ui5/webcomponents-base/dist/asset-registries/Icons.js";
26
+ import { ${accData.key} } from "../generated/i18n/i18n-defaults.js";
26
27
 
27
28
  const name = "${name}";
28
29
  const pathData = "${pathData}";
@@ -35,6 +36,15 @@ registerIcon(name, { pathData, ltr, accData, collection, packageName });
35
36
 
36
37
  export default { pathData, accData };`;
37
38
 
39
+
40
+
41
+ const collectionTemplate = (name) => `import { isThemeFamily } from "@ui5/webcomponents-base/dist/config/Theme.js";
42
+ import pathDataV4 from "./v5/${name}.js";
43
+ import pathDataV5 from "./v4/${name}.js";
44
+ const pathData = isThemeFamily("sap_horizon") ? pathDataV5 : pathDataV4;
45
+ export default { pathData };`;
46
+
47
+
38
48
  const svgTemplate = (pathData) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
39
49
  <path d="${pathData}"/>
40
50
  </svg>`;
@@ -48,10 +58,14 @@ const createIcons = (file) => {
48
58
  const ltr = !!iconData.ltr;
49
59
  const acc = iconData.acc;
50
60
 
51
- const content = acc ? accTemplate(name, pathData, ltr, acc, json.collection, json.packageName) : template(name, pathData, ltr, json.collection, json.packageName);
61
+ const content = acc ? iconAccTemplate(name, pathData, ltr, acc, json.collection, json.packageName) : iconTemplate(name, pathData, ltr, json.collection, json.packageName);
52
62
 
53
63
  fs.writeFileSync(path.join(destDir, `${name}.js`), content);
54
64
  fs.writeFileSync(path.join(destDir, `${name}.svg`), svgTemplate(pathData));
65
+
66
+ if (json.version) {
67
+ fs.writeFileSync(path.join(path.normalize("dist/"), `${name}.js`), collectionTemplate(name));
68
+ }
55
69
  }
56
70
  };
57
71
 
@@ -6,6 +6,51 @@ if (process.argv.length < 7) {
6
6
  return;
7
7
  }
8
8
 
9
+ const ORIGINAL_TEXTS = {
10
+ UnableToLoad: "UnableToLoad",
11
+ UnableToUpload: "UnableToUpload",
12
+ NoActivities: "NoActivities",
13
+ BeforeSearch: "BeforeSearch",
14
+ NoSearchResults: "NoSearchResults",
15
+ NoEntries: "NoEntries",
16
+ NoData: "NoData",
17
+ NoNotifications: "NoNotifications",
18
+ BalloonSky: "BalloonSky",
19
+ SuccessScreen: "SuccessScreen",
20
+ NoMail: "NoMail",
21
+ NoSavedItems: "NoSavedItems",
22
+ NoTasks: "NoTasks"
23
+ };
24
+
25
+ const FALLBACK_TEXTS = {
26
+ ReloadScreen: ORIGINAL_TEXTS.UnableToLoad,
27
+ Connection: ORIGINAL_TEXTS.UnableToLoad,
28
+ ErrorScreen: ORIGINAL_TEXTS.UnableToUpload,
29
+ EmptyCalendar: ORIGINAL_TEXTS.NoActivities,
30
+ SearchEarth: ORIGINAL_TEXTS.BeforeSearch,
31
+ SearchFolder: ORIGINAL_TEXTS.NoSearchResults,
32
+ EmptyList: ORIGINAL_TEXTS.NoEntries,
33
+ Tent: ORIGINAL_TEXTS.NoData,
34
+ SleepingBell: ORIGINAL_TEXTS.NoNotifications,
35
+ SimpleBalloon: ORIGINAL_TEXTS.BalloonSky,
36
+ SimpleBell: ORIGINAL_TEXTS.NoNotifications,
37
+ SimpleCalendar: ORIGINAL_TEXTS.NoActivities,
38
+ SimpleCheckMark: ORIGINAL_TEXTS.SuccessScreen,
39
+ SimpleConnection: ORIGINAL_TEXTS.UnableToLoad,
40
+ SimpleEmptyDoc: ORIGINAL_TEXTS.NoData,
41
+ SimpleEmptyList: ORIGINAL_TEXTS.NoEntries,
42
+ SimpleError: ORIGINAL_TEXTS.UnableToUpload,
43
+ SimpleMagnifier: ORIGINAL_TEXTS.BeforeSearch,
44
+ SimpleMail: ORIGINAL_TEXTS.NoMail,
45
+ SimpleNoSavedItems: ORIGINAL_TEXTS.NoSavedItems,
46
+ SimpleNotFoundMagnifier: ORIGINAL_TEXTS.NoSearchResults,
47
+ SimpleReload: ORIGINAL_TEXTS.UnableToLoad,
48
+ SimpleTask: ORIGINAL_TEXTS.NoTasks,
49
+ SuccessBalloon: ORIGINAL_TEXTS.BalloonSky,
50
+ SuccessCheckMark: ORIGINAL_TEXTS.SuccessScreen,
51
+ SuccessHighFive: ORIGINAL_TEXTS.BalloonSky
52
+ };
53
+
9
54
  const srcPath = process.argv[2];
10
55
  const defaultText = process.argv[3] === "true";
11
56
  const illustrationsPrefix = process.argv[4];
@@ -24,21 +69,31 @@ const svgToJs = fileName => {
24
69
  fs.writeFileSync(path.join(destPath, fileName), fileContent);
25
70
  };
26
71
  const illustrationImportTemplate = illustrationName => {
27
- const illustationNameUpperCase = illustrationName.toUpperCase();
72
+ let illustrationNameForTranslation = illustrationName;
73
+
74
+ if (defaultText) {
75
+ if (FALLBACK_TEXTS[illustrationNameForTranslation]) {
76
+ illustrationNameForTranslation = FALLBACK_TEXTS[illustrationNameForTranslation];
77
+ } else if (illustrationName.indexOf("_v") !== -1) {
78
+ illustrationNameForTranslation = illustrationNameForTranslation.substr(0, illustrationNameForTranslation.indexOf('_v'));
79
+ }
80
+ }
28
81
 
82
+ const illustrationNameUpperCase = illustrationNameForTranslation.toUpperCase();
83
+
29
84
  return defaultText ? `import { registerIllustration } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
30
85
  import dialogSvg from "./${illustrationsPrefix}-Dialog-${illustrationName}.js";
31
86
  import sceneSvg from "./${illustrationsPrefix}-Scene-${illustrationName}.js";
32
87
  import spotSvg from "./${illustrationsPrefix}-Spot-${illustrationName}.js";
33
88
  import {
34
- IM_TITLE_${illustationNameUpperCase},
35
- IM_SUBTITLE_${illustationNameUpperCase},
89
+ IM_TITLE_${illustrationNameUpperCase},
90
+ IM_SUBTITLE_${illustrationNameUpperCase},
36
91
  } from "../generated/i18n/i18n-defaults.js";
37
92
 
38
93
  const name = "${illustrationName}";
39
94
  const set = "${illustrationSet}";
40
- const title = IM_TITLE_${illustationNameUpperCase};
41
- const subtitle = IM_SUBTITLE_${illustationNameUpperCase};
95
+ const title = IM_TITLE_${illustrationNameUpperCase};
96
+ const subtitle = IM_SUBTITLE_${illustrationNameUpperCase};
42
97
 
43
98
  registerIllustration(name, {
44
99
  dialogSvg,
@@ -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 +34,6 @@ module.exports = {
33
34
  <a class="separator" href="https://www.sap.com/about/legal/privacy.html" target="_blank">Privacy Policy</a>
34
35
  <a href="https://www.sap.com/about/legal/impressum.html" target="_blank">Legal</a>
35
36
  </div>
36
- <img src="../../../../../../assets/images/sap-logo-svg.svg" alt="Sap Logo" />
37
+ <img src="../../../assets/images/sap-logo-svg.svg" alt="Sap Logo" />
37
38
  </footer>`
38
39
  };
@@ -8,6 +8,9 @@ let skipIfDefined = false;
8
8
  // when true => an HTML node value, when false => an attribute value
9
9
  let isNodeValue = false;
10
10
 
11
+ // when true => the current attribute is "style"
12
+ let isStyleAttribute = false;
13
+
11
14
  // matches event handlers @click= and boolean attrs ?disabled=
12
15
  const dynamicAttributeRgx = /\s(\?|@)([a-zA-Z|-]+)="?\s*$/;
13
16
 
@@ -77,6 +80,12 @@ HTMLLitVisitor.prototype.ContentStatement = function(content) {
77
80
  isNodeValue = closingIndex > openingIndex;
78
81
  }
79
82
 
83
+ isStyleAttribute = !isNodeValue && contentStatement.match(/style *= *["']? *$/);
84
+
85
+ if (!isStyleAttribute && contentStatement.match(/style=/)) {
86
+ console.log("WARNING: style hard-coded", contentStatement);
87
+ }
88
+
80
89
  // Scope custom element tags
81
90
  contentStatement = contentStatement.replaceAll(/(<\/?\s*)([a-zA-Z0-9_]+-[a-zA-Z0-9_-]+)/g, "$1\${scopeTag(\"$2\", tags, suffix)}");
82
91
 
@@ -91,7 +100,6 @@ HTMLLitVisitor.prototype.MustacheStatement = function(mustache) {
91
100
  } else {
92
101
  const path = normalizePath.call(this, mustache.path.original);
93
102
  const hasCalculatingClasses = path.includes("context.classes");
94
- const hasStylesCalculation = path.includes("context.styles");
95
103
 
96
104
  let parsedCode = "";
97
105
 
@@ -99,7 +107,7 @@ HTMLLitVisitor.prototype.MustacheStatement = function(mustache) {
99
107
  parsedCode = `\${unsafeHTML(${path})}`;
100
108
  } else if (hasCalculatingClasses) {
101
109
  parsedCode = `\${classMap(${path})}`;
102
- } else if (hasStylesCalculation) {
110
+ } else if (isStyleAttribute) {
103
111
  parsedCode = `\${styleMap(${path})}`;
104
112
  } else if (skipIfDefined){
105
113
  parsedCode = `\${${path}}`;
@@ -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
 
@@ -8,10 +8,10 @@ const DEFAULT_THEME = assets.themes.default;
8
8
  const getDefaultThemeCode = packageName => {
9
9
  return `import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
10
10
 
11
- import defaultThemeBase from "@ui5/webcomponents-theme-base/dist/generated/themes/${DEFAULT_THEME}/parameters-bundle.css.js";
11
+ import defaultThemeBase from "@ui5/webcomponents-theming/dist/generated/themes/${DEFAULT_THEME}/parameters-bundle.css.js";
12
12
  import defaultTheme from "./${DEFAULT_THEME}/parameters-bundle.css.js";
13
13
 
14
- registerThemePropertiesLoader("@ui5/webcomponents-theme-base", "${DEFAULT_THEME}", () => defaultThemeBase);
14
+ registerThemePropertiesLoader("@ui5/webcomponents-theming", "${DEFAULT_THEME}", () => defaultThemeBase);
15
15
  registerThemePropertiesLoader("${packageName}", "${DEFAULT_THEME}", () => defaultTheme);
16
16
  `;
17
17
  };
@@ -38,8 +38,8 @@ module.exports = function (opts) {
38
38
 
39
39
  const filePath = `${targetFile}.js`;
40
40
  const defaultTheme = opts.includeDefaultTheme ? getDefaultThemeCode(opts.packageName) : ``;
41
- fs.writeFileSync(filePath, `${defaultTheme}export default ${css};`);
41
+ fs.writeFileSync(filePath, `${defaultTheme}export default {packageName:"${opts.packageName}",fileName:"${targetFile.substr(targetFile.lastIndexOf("themes"))}",content:${css}}`);
42
42
  }
43
43
  };
44
44
  };
45
- module.exports.postcss = true;
45
+ module.exports.postcss = true;
@@ -23,9 +23,14 @@ module.exports = function (opts) {
23
23
  mkdirp.sync(path.dirname(targetFile));
24
24
 
25
25
  const filePath = `${targetFile}.json`;
26
- fs.writeFileSync(filePath, JSON.stringify({_: css}));
26
+ const data = {
27
+ packageName: opts.packageName,
28
+ fileName: targetFile.substr(targetFile.lastIndexOf("themes")),
29
+ content: css
30
+ };
31
+ fs.writeFileSync(filePath, JSON.stringify({_: data}));
27
32
  }
28
33
  };
29
34
  };
30
35
 
31
- module.exports.postcss = true;
36
+ module.exports.postcss = true;
@@ -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
+ });
@@ -2,7 +2,7 @@ const fs = require("fs");
2
2
  const path = require("path");
3
3
  const commandLineArgs = require("command-line-args");
4
4
  const { exec } = require("child_process");
5
- const colors = require("colors/safe");
5
+ const colors = require("cli-color");
6
6
  const isPortReachable = require("is-port-reachable");
7
7
 
8
8
  const options = commandLineArgs([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "0.0.0-fb61e9889",
3
+ "version": "0.0.0-fd6264051",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -25,6 +25,7 @@
25
25
  "@babel/preset-env": "^7.13.10",
26
26
  "@openui5/sap.ui.core": "1.95.0",
27
27
  "@rollup/plugin-babel": "^5.3.0",
28
+ "@rollup/plugin-commonjs": "^21.0.1",
28
29
  "@rollup/plugin-json": "^4.1.0",
29
30
  "@rollup/plugin-node-resolve": "^13.0.5",
30
31
  "@rollup/plugin-replace": "^3.0.0",
@@ -39,7 +40,7 @@
39
40
  "child_process": "^1.0.2",
40
41
  "chokidar": "^3.5.1",
41
42
  "chokidar-cli": "^3.0.0",
42
- "colors": "^1.4.0",
43
+ "cli-color": "^2.0.1",
43
44
  "command-line-args": "^5.1.1",
44
45
  "concurrently": "^6.0.0",
45
46
  "cross-env": "^7.0.3",
@@ -59,10 +60,10 @@
59
60
  "json-beautify": "^1.1.1",
60
61
  "mkdirp": "^1.0.4",
61
62
  "nps": "^5.10.0",
62
- "postcss": "^8.2.10",
63
- "postcss-cli": "^9.0.1",
63
+ "postcss": "^8.4.5",
64
+ "postcss-cli": "^9.1.0",
64
65
  "postcss-combine-duplicated-selectors": "^10.0.3",
65
- "postcss-import": "^14.0.0",
66
+ "postcss-import": "^14.0.2",
66
67
  "properties-reader": "^2.2.0",
67
68
  "recursive-readdir": "^2.2.2",
68
69
  "resolve": "^1.20.0",