@ui5/webcomponents-tools 0.0.0-6cb3eb0db → 0.0.0-701b14e36

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.
Files changed (69) hide show
  1. package/CHANGELOG.md +126 -0
  2. package/README.md +1 -1
  3. package/assets-meta.js +6 -1
  4. package/components-package/nps.js +12 -25
  5. package/components-package/postcss.themes.js +6 -3
  6. package/components-package/rollup-plugins/empty-module.js +15 -0
  7. package/components-package/rollup.js +25 -91
  8. package/components-package/wdio.js +16 -0
  9. package/components-package/wdio.sync.js +16 -0
  10. package/icons-collection/nps.js +41 -13
  11. package/lib/copy-and-watch/index.js +24 -0
  12. package/lib/copy-list/index.js +16 -16
  13. package/lib/create-icons/index.js +83 -58
  14. package/lib/create-illustrations/index.js +107 -41
  15. package/lib/documentation/index.js +119 -116
  16. package/lib/documentation/templates/api-properties-section.js +3 -1
  17. package/lib/documentation/templates/template.js +2 -1
  18. package/lib/esm-abs-to-rel/index.js +13 -9
  19. package/lib/generate-json-imports/i18n.js +38 -31
  20. package/lib/generate-json-imports/themes.js +28 -21
  21. package/lib/hbs2lit/src/compiler.js +12 -3
  22. package/lib/hbs2lit/src/includesReplacer.js +5 -5
  23. package/lib/hbs2lit/src/litVisitor2.js +10 -2
  24. package/lib/hbs2ui5/index.js +37 -21
  25. package/lib/i18n/defaults.js +49 -57
  26. package/lib/i18n/toJSON.js +12 -11
  27. package/lib/jsdoc/plugin.js +9 -0
  28. package/lib/jsdoc/template/publish.js +13 -2
  29. package/lib/postcss-combine-duplicated-selectors/index.js +178 -0
  30. package/lib/postcss-css-to-esm/index.js +4 -4
  31. package/lib/postcss-css-to-json/index.js +7 -2
  32. package/lib/postcss-p/postcss-p.mjs +11 -0
  33. package/lib/replace-global-core/index.js +13 -8
  34. package/lib/scoping/missing-dependencies.js +65 -0
  35. package/lib/scoping/report-tags-usage.js +28 -0
  36. package/lib/serve/index.js +1 -1
  37. package/package.json +14 -22
  38. package/bin/init-ui5-package.js +0 -3
  39. package/lib/hash/config.js +0 -10
  40. package/lib/hash/generate.js +0 -19
  41. package/lib/hash/upToDate.js +0 -31
  42. package/lib/init-package/index.js +0 -134
  43. package/lib/init-package/resources/.eslintignore +0 -3
  44. package/lib/init-package/resources/bundle.js +0 -31
  45. package/lib/init-package/resources/config/.eslintrc.js +0 -1
  46. package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
  47. package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
  48. package/lib/init-package/resources/config/rollup.config.js +0 -1
  49. package/lib/init-package/resources/config/wdio.conf.js +0 -1
  50. package/lib/init-package/resources/package-scripts.js +0 -11
  51. package/lib/init-package/resources/src/Assets.js +0 -5
  52. package/lib/init-package/resources/src/MyFirstComponent.hbs +0 -1
  53. package/lib/init-package/resources/src/MyFirstComponent.js +0 -56
  54. package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
  55. package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
  56. package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
  57. package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
  58. package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
  59. package/lib/init-package/resources/src/themes/MyFirstComponent.css +0 -11
  60. package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
  61. package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
  62. package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
  63. package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
  64. package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
  65. package/lib/init-package/resources/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
  66. package/lib/init-package/resources/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
  67. package/lib/init-package/resources/test/pages/index.html +0 -54
  68. package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
  69. package/lib/polyfill-placeholder/index.js +0 -5
package/CHANGELOG.md CHANGED
@@ -3,6 +3,132 @@
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.3.1](https://github.com/SAP/ui5-webcomponents/compare/v1.3.0...v1.3.1) (2022-04-27)
7
+
8
+ **Note:** Version bump only for package @ui5/webcomponents-tools
9
+
10
+
11
+
12
+
13
+
14
+ # [1.3.0](https://github.com/SAP/ui5-webcomponents/compare/v1.2.4...v1.3.0) (2022-04-19)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **localization:** fix js error if "sh" locale set ([#4905](https://github.com/SAP/ui5-webcomponents/issues/4905)) ([979bca2](https://github.com/SAP/ui5-webcomponents/commit/979bca2)), closes [#4904](https://github.com/SAP/ui5-webcomponents/issues/4904)
20
+
21
+
22
+
23
+
24
+
25
+ ## [1.2.4](https://github.com/SAP/ui5-webcomponents/compare/v1.2.3...v1.2.4) (2022-03-30)
26
+
27
+ **Note:** Version bump only for package @ui5/webcomponents-tools
28
+
29
+
30
+
31
+
32
+
33
+ ## [1.2.3](https://github.com/SAP/ui5-webcomponents/compare/v1.2.2...v1.2.3) (2022-03-23)
34
+
35
+ **Note:** Version bump only for package @ui5/webcomponents-tools
36
+
37
+
38
+
39
+
40
+
41
+ ## [1.2.2](https://github.com/SAP/ui5-webcomponents/compare/v1.2.1...v1.2.2) (2022-03-22)
42
+
43
+
44
+ **Note:** Version bump only for package @ui5/webcomponents-tools
45
+
46
+
47
+
48
+
49
+
50
+ ## [1.2.1](https://github.com/SAP/ui5-webcomponents/compare/v1.2.0...v1.2.1) (2022-03-02)
51
+
52
+ **Note:** Version bump only for package @ui5/webcomponents-tools
53
+
54
+
55
+
56
+
57
+
58
+ # [1.2.0](https://github.com/SAP/ui5-webcomponents/compare/v1.1.2...v1.2.0) (2022-02-28)
59
+
60
+
61
+ ### Bug Fixes
62
+
63
+ * correct scoping issues with several components ([#4820](https://github.com/SAP/ui5-webcomponents/issues/4820)) ([621dc20](https://github.com/SAP/ui5-webcomponents/commit/621dc20))
64
+ * display methods in child components API ([#4792](https://github.com/SAP/ui5-webcomponents/issues/4792)) ([1929d08](https://github.com/SAP/ui5-webcomponents/commit/1929d08))
65
+
66
+
67
+ ### Features
68
+
69
+ * **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)
70
+
71
+
72
+
73
+
74
+
75
+ ## [1.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
76
+
77
+ **Note:** Version bump only for package @ui5/webcomponents-tools
78
+
79
+
80
+
81
+
82
+
83
+ ## [1.1.1](https://github.com/SAP/ui5-webcomponents/compare/v1.1.0...v1.1.1) (2022-01-24)
84
+
85
+ **Note:** Version bump only for package @ui5/webcomponents-tools
86
+
87
+
88
+
89
+
90
+
91
+ # [1.1.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.2...v1.1.0) (2022-01-21)
92
+
93
+
94
+ **Note:** Version bump only for package @ui5/webcomponents-tools
95
+
96
+
97
+
98
+
99
+
100
+ ## [1.0.2](https://github.com/SAP/ui5-webcomponents/compare/v1.0.1...v1.0.2) (2021-11-29)
101
+
102
+ **Note:** Version bump only for package @ui5/webcomponents-tools
103
+
104
+
105
+
106
+
107
+
108
+ ## [1.0.1](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0...v1.0.1) (2021-11-10)
109
+
110
+ **Note:** Version bump only for package @ui5/webcomponents-tools
111
+
112
+
113
+
114
+
115
+
116
+ # [1.0.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.16...v1.0.0) (2021-11-10)
117
+
118
+
119
+ **Note:** Version bump only for package @ui5/webcomponents-tools
120
+
121
+
122
+ # [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)
123
+
124
+
125
+
126
+ ### Features
127
+
128
+ * **tools:** create an npm init script ([#4090](https://github.com/SAP/ui5-webcomponents/issues/4090)) ([5608e04](https://github.com/SAP/ui5-webcomponents/commit/5608e04))
129
+
130
+
131
+
6
132
  # [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
133
 
8
134
 
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": {
@@ -132,6 +136,7 @@ const assetsMeta = {
132
136
  "sk",
133
137
  "sl",
134
138
  "sr",
139
+ "sr_Latn",
135
140
  "sv",
136
141
  "th",
137
142
  "tr",
@@ -2,15 +2,13 @@ const path = require("path");
2
2
  const fs = require("fs");
3
3
 
4
4
  const LIB = path.join(__dirname, `../lib/`);
5
- const polyfillDir = path.dirname(require.resolve("@webcomponents/webcomponentsjs"));
6
- const polyfillPath = path.join(polyfillDir, "{*.js,*.map,*.md,bundles/**/*.*}");
7
5
  const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
8
6
 
9
7
  const getScripts = (options) => {
10
8
 
11
9
  const port = options.port || 8080; // preferred port
12
10
  const portStep = options.portStep || 1; // step to check for available ports, if preferred port is already used
13
- let illustrations = options.illustrationsPath || [];
11
+ let illustrations = options.illustrationsData || [];
14
12
 
15
13
  illustrations = illustrations.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath}`);
16
14
 
@@ -21,15 +19,16 @@ const getScripts = (options) => {
21
19
  lint: "eslint . --config config/.eslintrc.js",
22
20
  lintfix: "eslint . --config config/.eslintrc.js --fix",
23
21
  prepare: {
24
- default: "nps clean build.templates build.styles build.i18n build.jsonImports copy build.samples build.illustrations",
25
- es5: "nps clean build.templates build.styles build.i18n build.jsonImports copy.es5 build.samples build.illustrations"
22
+ default: "nps clean prepare.all",
23
+ all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.samples" "nps build.illustrations"',
24
+ styleRelated: "nps build.styles build.jsonImports",
26
25
  },
27
26
  build: {
28
- default: "nps lint prepare.es5 build.bundle",
27
+ default: "nps lint prepare build.bundle",
29
28
  templates: `mkdirp dist/generated/templates && node "${LIB}/hbs2ui5/index.js" -d src/ -o dist/generated/templates`,
30
29
  styles: {
31
30
  default: "nps build.styles.themes build.styles.components",
32
- themes: "postcss src/**/parameters-bundle.css --config config/postcss.themes --base src --dir dist/css/",
31
+ themes: `node "${LIB}/postcss-p/postcss-p.mjs"`,
33
32
  components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
34
33
  },
35
34
  i18n: {
@@ -42,35 +41,26 @@ const getScripts = (options) => {
42
41
  themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes dist/generated/json-imports`,
43
42
  i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
44
43
  },
45
- bundle: "rollup --config config/rollup.config.js --environment ES5_BUILD",
44
+ bundle: "rollup --config config/rollup.config.js",
46
45
  samples: {
47
46
  default: "nps build.samples.api build.samples.docs",
48
47
  api: `jsdoc -c "${LIB}/jsdoc/config.json"`,
49
48
  docs: `node "${LIB}/documentation/index.js" dist/api.json`,
50
49
  },
51
- illustrations: {
52
- default: illustrationsScript
53
- }
50
+ illustrations: illustrationsScript
54
51
  },
55
52
  copy: {
56
- default: "nps copy.src copy.props copy.test copy.webcomponents-polyfill-placeholder",
57
- es5: "nps copy.src copy.props copy.test copy.webcomponents-polyfill",
53
+ default: "nps copy.src copy.props copy.test",
58
54
  src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
59
55
  props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
60
56
  test: `node "${LIB}/copy-and-watch/index.js" --silent "test/**/*.*" dist/test-resources`,
61
- "webcomponents-polyfill": `node "${LIB}/copy-and-watch/index.js" --silent "${polyfillPath}" dist/webcomponentsjs/`,
62
- "webcomponents-polyfill-placeholder": `node "${LIB}/polyfill-placeholder/index.js"`
63
57
  },
64
58
  watch: {
65
59
  default: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.bundle" "nps watch.styles" "nps watch.i18n"',
66
- es5: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.bundle.es5" "nps watch.styles" "nps watch.i18n"',
67
60
  src: 'nps "copy.src --watch --safe --skip-initial-copy"',
68
61
  props: 'nps "copy.props --watch --safe --skip-initial-copy"',
69
62
  test: 'nps "copy.test --watch --safe --skip-initial-copy"',
70
- bundle: {
71
- default: 'rollup --config config/rollup.config.js -w --environment DEV,DEPLOY_PUBLIC_PATH:/resources/',
72
- es5: 'rollup --config config/rollup.config.js -w --environment ES5_BUILD,DEV,DEPLOY_PUBLIC_PATH:/resources/'
73
- },
63
+ bundle: 'rollup --config config/rollup.config.js -w --environment DEV',
74
64
  styles: {
75
65
  default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
76
66
  themes: 'nps "build.styles.themes -w"',
@@ -84,10 +74,7 @@ const getScripts = (options) => {
84
74
  samples: 'chokidar "test/**/*.sample.html" -c "nps build.samples"',
85
75
  i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
86
76
  },
87
- dev: {
88
- default: 'concurrently "nps serve" "nps watch"',
89
- es5: 'concurrently "nps serve" "nps watch.es5"'
90
- },
77
+ dev: 'concurrently "nps serve" "nps watch"',
91
78
  start: "nps prepare dev",
92
79
  serve: `node "${LIB}/serve/index.js" --dir="dist/" --port=${port} --portStep=${portStep} --packageName="${packageName}"`,
93
80
  test: {
@@ -108,7 +95,7 @@ const getScripts = (options) => {
108
95
  },
109
96
  dev: 'concurrently "nps serve" "nps scope.watch"',
110
97
  watch: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.props" "nps scope.bundle" "nps watch.styles"',
111
- bundle: 'rollup --config config/rollup.config.js -w --environment ES5_BUILD,DEV,SCOPE'
98
+ bundle: 'rollup --config config/rollup.config.js -w --environment DEV,SCOPE'
112
99
  }
113
100
  };
114
101
 
@@ -1,8 +1,11 @@
1
1
  const postcssImport = require('postcss-import');
2
- const combineSelectors = require('postcss-combine-duplicated-selectors');
2
+ const combineSelectors = require('../lib/postcss-combine-duplicated-selectors/index.js');
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
  };
@@ -0,0 +1,15 @@
1
+ const slash = require("slash");
2
+
3
+ function emptyModulePlugin({ emptyModules }) {
4
+ return {
5
+ name: "ui5-dev-empty-module-plugin",
6
+ load(id) {
7
+ if (emptyModules.some(mod => slash(id).includes(mod))) {
8
+ return `export default ""`;
9
+ }
10
+ return null;
11
+ },
12
+ };
13
+ }
14
+
15
+ module.exports = emptyModulePlugin;
@@ -1,18 +1,16 @@
1
1
  const process = require("process");
2
2
  const fs = require("fs");
3
3
  const os = require("os");
4
- const { babel } = require("@rollup/plugin-babel");
5
4
  const { nodeResolve } = require("@rollup/plugin-node-resolve");
6
- const url = require("@rollup/plugin-url");
7
5
  const { terser } = require("rollup-plugin-terser");
8
6
  const json = require("@rollup/plugin-json");
9
- const colors = require("colors/safe");
10
- const filesize = require("rollup-plugin-filesize");
7
+ const replace = require("@rollup/plugin-replace");
8
+ const colors = require("cli-color");
11
9
  const livereload = require("rollup-plugin-livereload");
10
+ const emptyModulePlugin = require("./rollup-plugins/empty-module.js");
12
11
 
13
12
  const packageFile = JSON.parse(fs.readFileSync("./package.json"));
14
13
  const packageName = packageFile.name;
15
- const DEPLOY_PUBLIC_PATH = process.env.DEPLOY_PUBLIC_PATH || "";
16
14
 
17
15
  const warningsToSkip = [{
18
16
  warningCode: "THIS_IS_UNDEFINED",
@@ -69,60 +67,35 @@ function ui5DevReadyMessagePlugin() {
69
67
  };
70
68
  }
71
69
 
72
- const getPlugins = ({ transpile }) => {
70
+ const getPlugins = () => {
73
71
  const plugins = [];
74
- if (!process.env.DEV) {
75
- plugins.push(filesize(
76
- {
77
- reporter(options, bundle, {
78
- minSize, gzipSize, brotliSize, bundleSize,
79
- fileName,
80
- // "showBeforeSizes: release"
81
- lastVersion,
82
- // "showBeforeSizes: "release" or "showBeforeSizes": "build"
83
- bundleSizeBefore, brotliSizeBefore, minSizeBefore, gzipSizeBefore,
84
- }) {
85
- // If a promise is returned, it will be awaited before rendering.
86
- return `${fileName.padEnd(35)} ${minSize} / gzipped: ${gzipSize}`;
87
- },
88
- },
89
-
90
- ));
91
- }
92
-
93
- const publicPath = DEPLOY_PUBLIC_PATH;
94
72
 
95
- plugins.push(ui5DevImportCheckerPlugin());
96
-
97
- if (!transpile) {
98
- plugins.push(json({
99
- include: [
100
- /.*assets\/.*\.json/,
101
- ],
102
- namedExports: false,
73
+ if (process.env.DEV) {
74
+ plugins.push(replace({
75
+ values: {
76
+ 'const DEV_MODE = false': 'const DEV_MODE = true',
77
+ },
78
+ preventAssignment: false,
103
79
  }));
104
80
  }
105
81
 
106
- if (transpile) {
107
- plugins.push(url({
108
- limit: 0,
109
- include: [
110
- /.*assets\/.*\.json/,
82
+ if (process.env.DEV && !process.env.ENABLE_CLDR) {
83
+ // Empty the CLDR assets file for better performance during development
84
+ plugins.push(emptyModulePlugin({
85
+ emptyModules: [
86
+ "localization/dist/Assets.js",
111
87
  ],
112
- emitFiles: true,
113
- fileName: "[name].[hash][extname]",
114
- publicPath,
115
88
  }));
116
89
  }
117
90
 
118
- if (transpile) {
119
- plugins.push(babel({
120
- presets: ["@babel/preset-env"],
121
- exclude: /node_modules\/(?!(lit-html|@ui5\/webcomponents))/, // exclude all node_modules/ except lit-html and all starting with @ui5/webcomponents
122
- sourcemap: true,
123
- babelHelpers: "bundled",
124
- }));
125
- }
91
+ plugins.push(ui5DevImportCheckerPlugin());
92
+
93
+ plugins.push(json({
94
+ include: [
95
+ /.*assets\/.*\.json/,
96
+ ],
97
+ namedExports: false,
98
+ }));
126
99
 
127
100
  plugins.push(nodeResolve());
128
101
 
@@ -132,7 +105,7 @@ const getPlugins = ({ transpile }) => {
132
105
  }));
133
106
  }
134
107
 
135
- const es6DevMain = process.env.DEV && !transpile && packageName === "@ui5/webcomponents";
108
+ const es6DevMain = process.env.DEV && packageName === "@ui5/webcomponents";
136
109
  if (es6DevMain && os.platform() !== "win32") {
137
110
  plugins.push(livereload({
138
111
  watch: [
@@ -158,58 +131,19 @@ const getES6Config = (input = "bundle.esm.js") => {
158
131
  format: "esm",
159
132
  sourcemap: true,
160
133
  },
161
- moduleContext: id => {
162
- if (typeof id === "string" && id.includes("url-search-params-polyfill")) {
163
- // suppress the rollup error for this module as it uses this in the global scope correctly even without changing the context here
164
- return "window";
165
- }
166
- },
167
134
  watch: {
168
135
  clearScreen: false,
169
136
  },
170
- plugins: getPlugins({ transpile: false }),
171
- onwarn: onwarn,
172
- }];
173
- };
174
-
175
- const getES5Config = (input = "bundle.es5.js") => {
176
- return [{
177
- input,
178
- output: {
179
- dir: "dist/resources",
180
- format: "iife",
181
- inlineDynamicImports: true,
182
- name: "sap-ui-webcomponents-bundle",
183
- extend: "true", // Whether or not to extend the global variable defined by the name option in umd or iife formats.
184
- sourcemap: true,
185
- },
186
- moduleContext: id => {
187
- if (id.includes("url-search-params-polyfill")) {
188
- // suppress the rollup error for this module as it uses this in the global scope correctly even without changing the context here
189
- return "window";
190
- }
191
- },
192
- watch: {
193
- clearScreen: false,
194
- },
195
- plugins: getPlugins({ transpile: true }),
137
+ plugins: getPlugins(),
196
138
  onwarn: onwarn,
197
139
  }];
198
140
  };
199
141
 
200
142
  let config = getES6Config();
201
143
 
202
- if (process.env.ES5_BUILD && fs.existsSync("bundle.es5.js")) {
203
- config = config.concat(getES5Config());
204
- }
205
-
206
144
  if (process.env.SCOPE) {
207
145
  if (fs.existsSync("bundle.scoped.esm.js")) {
208
146
  config = config.concat(getES6Config("bundle.scoped.esm.js"));
209
-
210
- if (fs.existsSync("bundle.scoped.es5.js") && process.env.ES5_BUILD) {
211
- config = config.concat(getES5Config("bundle.scoped.es5.js"));
212
- }
213
147
  }
214
148
  }
215
149
 
@@ -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
  ];
@@ -1,23 +1,52 @@
1
1
  const path = require("path");
2
- const resolve = require("resolve");
3
-
4
- const generateHash = resolve.sync("@ui5/webcomponents-tools/lib/hash/generate.js");
5
- const hashIsUpToDate = resolve.sync("@ui5/webcomponents-tools/lib/hash/upToDate.js");
6
- const UP_TO_DATE = `node "${hashIsUpToDate}" dist/ hash.txt && echo "Up to date."`;
7
2
 
8
3
  const LIB = path.join(__dirname, `../lib/`);
9
4
 
5
+ const createIconImportsCommand = (options) => {
6
+ if (!options.versions) {
7
+ return `node "${LIB}/create-icons/index.js" "${options.collectionName}"`;
8
+ }
9
+
10
+ const command = { default: "nps" };
11
+ options.versions.forEach((v) => {
12
+ command.default += ` build.icons.create${v}`;
13
+ command[`create${v}`] = `node "${LIB}/create-icons/index.js" "${options.collectionName}" "${v}"`;
14
+ });
15
+
16
+ return command;
17
+ }
18
+
19
+ const copyIconAssetsCommand = (options) => {
20
+ if (!options.versions) {
21
+ return {
22
+ default: "nps copy.json-imports copy.icon-collection",
23
+ "json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
24
+ "icon-collection": `node "${LIB}/copy-and-watch/index.js" --silent "src/*.json" dist/generated/assets/`,
25
+ }
26
+ }
27
+
28
+ const command = {
29
+ default: "nps copy.json-imports ",
30
+ "json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
31
+ };
32
+
33
+ options.versions.forEach((v) => {
34
+ command.default += ` copy.icon-collection${v}`;
35
+ command[`icon-collection${v}`] = `node "${LIB}/copy-and-watch/index.js" --silent "src/${v}/*.json" dist/generated/assets/${v}/`;
36
+ });
37
+
38
+ return command;
39
+ }
40
+
10
41
  const getScripts = (options) => {
42
+ const createJSImportsCmd = createIconImportsCommand(options);
43
+ const copyAssetsCmd = copyIconAssetsCommand(options);
11
44
 
12
45
  const scripts = {
13
46
  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
- },
47
+ copy: copyAssetsCmd,
19
48
  build: {
20
- default: `${UP_TO_DATE} || nps clean copy build.i18n build.icons build.jsonImports hash`,
49
+ default: `nps clean copy build.i18n build.icons build.jsonImports`,
21
50
  i18n: {
22
51
  default: "nps build.i18n.defaultsjs build.i18n.json",
23
52
  defaultsjs: `mkdirp dist/generated/i18n && node "${LIB}/i18n/defaults.js" src/i18n dist/generated/i18n`,
@@ -27,9 +56,8 @@ const getScripts = (options) => {
27
56
  default: "mkdirp dist/generated/json-imports && nps build.jsonImports.i18n",
28
57
  i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
29
58
  },
30
- icons: `node "${LIB}/create-icons/index.js" "${options.collectionName}"`,
59
+ icons: createJSImportsCmd,
31
60
  },
32
- hash: `node "${generateHash}" dist/ hash.txt`,
33
61
  };
34
62
 
35
63
  return scripts;
@@ -1,3 +1,27 @@
1
+ /*
2
+ MIT License
3
+
4
+ Copyright (c) 2017
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+ */
24
+
1
25
  const fs = require('fs');
2
26
  const path = require('path');
3
27
  const chokidar = require('chokidar');