@ui5/webcomponents-tools 0.0.0-d1315d658 → 0.0.0-d473b9686

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 (53) hide show
  1. package/CHANGELOG.md +767 -0
  2. package/README.md +2 -1
  3. package/assets-meta.js +15 -10
  4. package/components-package/eslint.js +2 -0
  5. package/components-package/nps.js +51 -43
  6. package/components-package/postcss.components.js +1 -21
  7. package/components-package/postcss.themes.js +1 -50
  8. package/components-package/wdio.js +414 -400
  9. package/icons-collection/nps.js +7 -5
  10. package/lib/amd-to-es6/index.js +102 -0
  11. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  12. package/lib/cem/custom-elements-manifest.config.mjs +501 -0
  13. package/lib/cem/event.mjs +131 -0
  14. package/lib/cem/schema-internal.json +1357 -0
  15. package/lib/cem/schema.json +1098 -0
  16. package/lib/cem/types-internal.d.ts +796 -0
  17. package/lib/cem/types.d.ts +736 -0
  18. package/lib/cem/utils.mjs +384 -0
  19. package/lib/cem/validate.js +70 -0
  20. package/lib/create-icons/index.js +8 -6
  21. package/lib/create-illustrations/index.js +51 -30
  22. package/lib/create-new-component/index.js +4 -11
  23. package/lib/create-new-component/tsFileContentTemplate.js +3 -12
  24. package/lib/css-processors/css-processor-component-styles.mjs +48 -0
  25. package/lib/css-processors/css-processor-components.mjs +77 -0
  26. package/lib/css-processors/css-processor-themes.mjs +79 -0
  27. package/lib/css-processors/scope-variables.mjs +49 -0
  28. package/lib/{postcss-css-to-esm/index.js → css-processors/shared.mjs} +36 -50
  29. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  30. package/lib/dev-server/ssr-dom-shim-loader.js +26 -0
  31. package/lib/generate-js-imports/illustrations.js +78 -64
  32. package/lib/generate-json-imports/i18n.js +10 -37
  33. package/lib/generate-json-imports/themes.js +9 -31
  34. package/lib/i18n/defaults.js +1 -1
  35. package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
  36. package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
  37. package/lib/scoping/get-all-tags.js +1 -1
  38. package/lib/scoping/lint-src.js +8 -7
  39. package/lib/scoping/scope-test-pages.js +2 -1
  40. package/package.json +11 -10
  41. package/components-package/wdio.sync.js +0 -368
  42. package/lib/create-new-component/jsFileContentTemplate.js +0 -73
  43. package/lib/esm-abs-to-rel/index.js +0 -58
  44. package/lib/generate-custom-elements-manifest/index.js +0 -327
  45. package/lib/jsdoc/config.json +0 -29
  46. package/lib/jsdoc/configTypescript.json +0 -29
  47. package/lib/jsdoc/plugin.js +0 -2468
  48. package/lib/jsdoc/preprocess.js +0 -146
  49. package/lib/jsdoc/template/publish.js +0 -4120
  50. package/lib/postcss-css-to-json/index.js +0 -47
  51. package/lib/postcss-new-files/index.js +0 -36
  52. package/lib/postcss-p/postcss-p.mjs +0 -14
  53. package/lib/replace-global-core/index.js +0 -25
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_wide.png)
2
2
 
3
+
3
4
  # UI5 Web Components - Tools
4
5
 
5
6
  [![npm Package Version](https://badge.fury.io/js/%40ui5%2Fwebcomponents.svg)](https://www.npmjs.com/package/@ui5/webcomponents)
@@ -13,7 +14,7 @@ used by other UI5 Web Components packages, such as `main` and `fiori`.
13
14
  - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
14
15
 
15
16
  ## Support
16
- We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/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/).
17
+ We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://ui5-slack-invite.cfapps.eu10.hana.ondemand.com/).
17
18
 
18
19
  ## Contribute
19
20
  Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
package/assets-meta.js CHANGED
@@ -1,20 +1,20 @@
1
1
  const assetsMeta = {
2
2
  "themes": {
3
- "default": "sap_fiori_3",
3
+ "default": "sap_horizon",
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
- "sap_horizon",
13
- "sap_horizon_dark",
14
- "sap_horizon_hcb",
15
- "sap_horizon_hcw",
16
- "sap_horizon_exp"
17
- ]
9
+ "sap_horizon",
10
+ "sap_horizon_dark",
11
+ "sap_horizon_hcb",
12
+ "sap_horizon_hcw",
13
+ "sap_horizon_exp",
14
+ "sap_horizon_dark_exp",
15
+ "sap_horizon_hcb_exp",
16
+ "sap_horizon_hcw_exp",
17
+ ],
18
18
  },
19
19
  "languages": {
20
20
  "default": "en",
@@ -22,6 +22,7 @@ const assetsMeta = {
22
22
  "ar",
23
23
  "bg",
24
24
  "ca",
25
+ "cnr",
25
26
  "cs",
26
27
  "cy",
27
28
  "da",
@@ -49,6 +50,7 @@ const assetsMeta = {
49
50
  "ko",
50
51
  "lt",
51
52
  "lv",
53
+ "mk",
52
54
  "ms",
53
55
  "nl",
54
56
  "no",
@@ -60,6 +62,7 @@ const assetsMeta = {
60
62
  "sh",
61
63
  "sk",
62
64
  "sl",
65
+ "sr",
63
66
  "sv",
64
67
  "th",
65
68
  "tr",
@@ -77,6 +80,7 @@ const assetsMeta = {
77
80
  "ar_SA",
78
81
  "bg",
79
82
  "ca",
83
+ "cnr",
80
84
  "cs",
81
85
  "da",
82
86
  "de",
@@ -124,6 +128,7 @@ const assetsMeta = {
124
128
  "lt",
125
129
  "lv",
126
130
  "ms",
131
+ "mk",
127
132
  "nb",
128
133
  "nl",
129
134
  "nl_BE",
@@ -15,6 +15,7 @@ const overrides = tsMode ? [{
15
15
  ],
16
16
  parserOptions: {
17
17
  "project": ["./tsconfig.json", "./packages/*/tsconfig.json"],
18
+ EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
18
19
  },
19
20
  rules: {
20
21
  "no-shadow": "off",
@@ -27,6 +28,7 @@ const overrides = tsMode ? [{
27
28
  "@typescript-eslint/no-unsafe-call": "off",
28
29
  "@typescript-eslint/no-non-null-assertion": "off",
29
30
  "@typescript-eslint/no-empty-function": "off",
31
+ "@typescript-eslint/no-empty-interface": "off",
30
32
  "lines-between-class-members": "off",
31
33
  }
32
34
  }] : [];
@@ -1,24 +1,32 @@
1
1
  const path = require("path");
2
2
  const fs = require("fs");
3
- const resolve = require("resolve");
4
3
  const LIB = path.join(__dirname, `../lib/`);
5
- const preprocessJSDocScript = resolve.sync("@ui5/webcomponents-tools/lib/jsdoc/preprocess.js");
4
+ let websiteBaseUrl = "/";
5
+
6
+ if (process.env.DEPOY) {
7
+ websiteBaseUrl = "/ui5-webcomponents/";
8
+ } else if (process.env.DEPLOY_NIGHTLY) {
9
+ websiteBaseUrl = "/ui5-webcomponents/nightly/";
10
+ }
6
11
 
7
12
  const getScripts = (options) => {
8
13
 
9
14
  // The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
10
15
  const illustrationsData = options.illustrationsData || [];
11
- const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath}`);
16
+ const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`);
12
17
  const createIllustrationsJSImportsScript = illustrations.join(" && ");
13
18
 
14
- // The script creates the "dist/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
15
- const illustrationDestinationPaths = illustrationsData.map(illustrations => illustrations.destinationPath);
16
- const createIllustrationsLoadersScript = options.fioriPackage ? `node ${LIB}/generate-js-imports/illustrations.js ${illustrationDestinationPaths[0]} ${illustrationDestinationPaths[1]} dist/generated/js-imports` : "";
17
- const tsOption = options.typescript;
18
- const tsCommand = tsOption ? "tsc" : "";
19
- const tsWatchCommand = tsOption ? "tsc --watch" : "";
19
+ // The script creates the "src/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
20
+ const createIllustrationsLoadersScript = illustrationsData.map(illustrations => `node ${LIB}/generate-js-imports/illustrations.js ${illustrations.destinationPath} ${illustrations.dynamicImports.outputFile} ${illustrations.set} ${illustrations.collection} ${illustrations.dynamicImports.location} ${illustrations.dynamicImports.filterOut.join(" ")}`).join(" && ");
21
+
22
+ const tsOption = !options.legacy;
23
+ const tsCommandOld = tsOption ? "tsc" : "";
24
+ let tsWatchCommandStandalone = tsOption ? "tsc --watch" : "";
25
+ // this command is only used for standalone projects. monorepo projects get their watch from vite, so opt-out here
26
+ if (options.noWatchTS) {
27
+ tsWatchCommandStandalone = "";
28
+ }
20
29
  const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
21
- const copySrcGenerated = tsOption ? "" : "copy.srcGenerated";
22
30
 
23
31
  if (tsOption) {
24
32
  try {
@@ -51,22 +59,28 @@ const getScripts = (options) => {
51
59
  }
52
60
 
53
61
  const scripts = {
54
- clean: 'rimraf jsdoc-dist && rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
62
+ clean: 'rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
55
63
  lint: `eslint . ${eslintConfig}`,
56
64
  lintfix: `eslint . ${eslintConfig} --fix`,
57
- prepare: {
58
- default: `${tsCrossEnv} nps clean prepare.all typescript generateAPI`,
65
+ generate: {
66
+ default: `${tsCrossEnv} nps prepare.all`,
59
67
  all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.illustrations"',
60
68
  styleRelated: "nps build.styles build.jsonImports build.jsImports",
61
69
  },
62
- typescript: tsCommand,
70
+ prepare: {
71
+ default: `${tsCrossEnv} nps clean prepare.all copy prepare.typescript generateAPI`,
72
+ all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps build.illustrations"',
73
+ styleRelated: "nps build.styles build.jsonImports build.jsImports",
74
+ typescript: tsCommandOld,
75
+ },
63
76
  build: {
64
- default: "nps prepare lint build.bundle",
65
- templates: `mkdirp dist/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
77
+ default: "nps prepare lint build.bundle", // build.bundle2
78
+ templates: `mkdirp src/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
66
79
  styles: {
67
- default: `nps build.styles.themes build.styles.components ${copySrcGenerated}`,
68
- themes: `node "${LIB}/postcss-p/postcss-p.mjs"`,
69
- components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
80
+ default: `concurrently "nps build.styles.themes" "nps build.styles.components" "nps build.styles.componentStyles"`,
81
+ themes: `node "${LIB}/css-processors/css-processor-themes.mjs"`,
82
+ components: `node "${LIB}/css-processors/css-processor-components.mjs"`,
83
+ componentStyles: `node "${LIB}/css-processors/css-processor-component-styles.mjs"`,
70
84
  },
71
85
  i18n: {
72
86
  default: "nps build.i18n.defaultsjs build.i18n.json",
@@ -74,41 +88,38 @@ const getScripts = (options) => {
74
88
  json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
75
89
  },
76
90
  jsonImports: {
77
- default: "mkdirp dist/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
78
- themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes dist/generated/json-imports`,
79
- i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
91
+ default: "mkdirp src/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
92
+ themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes src/generated/json-imports`,
93
+ i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n src/generated/json-imports`,
80
94
  },
81
95
  jsImports: {
82
- default: "mkdirp dist/generated/js-imports && nps build.jsImports.illustrationsLoaders",
96
+ default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
83
97
  illustrationsLoaders: createIllustrationsLoadersScript,
84
98
  },
85
- bundle: `vite build ${viteConfig}`,
99
+ bundle: `vite build ${viteConfig} --mode testing --base ${websiteBaseUrl}`,
100
+ bundle2: ``,
86
101
  illustrations: createIllustrationsJSImportsScript,
87
102
  },
88
103
  copy: {
89
104
  default: "nps copy.src copy.props",
90
- src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
91
- srcGenerated: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.js" dist/generated/`,
105
+ src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/`,
106
+ // srcGenerated2: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.{js,json}" dist/generated/`,
92
107
  props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
93
108
  },
94
109
  watch: {
95
- default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.typescript" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
110
+ default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" "nps watch.src" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
96
111
  devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
97
112
  src: 'nps "copy.src --watch --safe --skip-initial-copy"',
98
- typescript: tsWatchCommand,
113
+ typescript: tsWatchCommandStandalone,
99
114
  props: 'nps "copy.props --watch --safe --skip-initial-copy"',
100
115
  bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
101
116
  styles: {
102
- default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
117
+ default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components" "nps watch.styles.componentStyles" ',
103
118
  themes: 'nps "build.styles.themes -w"',
104
- components: {
105
- default: 'concurrently "nps watch.styles.components.existingFiles" "nps watch.styles.components.newFiles"',
106
- existingFiles: `nps "build.styles.components -w"`,
107
- newFiles: `node "${LIB}/postcss-new-files/index.js" --srcFiles="src/themes/*.css"`,
108
- },
119
+ components: `nps "build.styles.components -w"`,
120
+ componentStyles: `nps "build.styles.componentStyles -w"`,
109
121
  },
110
122
  templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
111
- api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
112
123
  i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
113
124
  },
114
125
  start: "nps prepare watch.devServer",
@@ -117,7 +128,7 @@ const getScripts = (options) => {
117
128
  "test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
118
129
  startWithScope: "nps scope.prepare scope.watchWithBundle",
119
130
  scope: {
120
- prepare: "nps scope.lint prepare scope.testPages",
131
+ prepare: "nps scope.lint scope.testPages",
121
132
  lint: `node "${LIB}/scoping/lint-src.js"`,
122
133
  testPages: {
123
134
  default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
@@ -126,16 +137,13 @@ const getScripts = (options) => {
126
137
  replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
127
138
  },
128
139
  watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
129
- watch: 'concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.props" "nps watch.styles"',
140
+ watch: 'concurrently "nps watch.templates" "nps watch.src" "nps watch.props" "nps watch.styles"',
130
141
  bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
131
142
  },
132
143
  generateAPI: {
133
- default: "nps generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup generateAPI.prepareManifest",
134
- prepare: `node "${LIB}/copy-and-watch/index.js" --silent "dist/**/*.js" jsdoc-dist/`,
135
- prepareManifest: `node "${LIB}/generate-custom-elements-manifest/index.js" dist dist`,
136
- preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`,
137
- jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
138
- cleanup: "rimraf jsdoc-dist/"
144
+ default: tsOption ? "nps generateAPI.generateCEM generateAPI.validateCEM" : "",
145
+ generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs" ${ options.dev ? "--dev" : "" }`,
146
+ validateCEM: `node "${LIB}/cem/validate.js" ${ options.dev ? "--dev" : "" }`,
139
147
  },
140
148
  };
141
149
 
@@ -1,21 +1 @@
1
- const postcssImport = require('postcss-import');
2
- const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
3
- const cssnano = require('cssnano');
4
- const fs = require("fs");
5
-
6
- const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
7
-
8
- module.exports = {
9
- plugins: [
10
- postcssImport(),
11
- cssnano({
12
- preset: [
13
- 'default', {
14
- mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
15
- mergeRules: false, // https://github.com/cssnano/cssnano/issues/730
16
- },
17
- ]
18
- }),
19
- postcssCSStoESM({ toReplace: 'src', includeDefaultTheme: true, packageName }),
20
- ]
21
- }
1
+ module.exports = {}
@@ -1,50 +1 @@
1
- const postcssImport = require('postcss-import');
2
- const combineSelectors = require('../lib/postcss-combine-duplicated-selectors/index.js');
3
- const postcssCSStoJSON = require('../lib/postcss-css-to-json/index.js');
4
- const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
5
- const cssnano = require('cssnano');
6
- const modifySelectors = require("modify-selectors");
7
- const fs = require("fs");
8
-
9
- const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
10
- const selectors = [".sapUiSizeCompact", ".ui5-content-density-compact", "[data-ui5-compact-size]", "[dir=\"rtl\"]", "[dir=\"ltr\"]"];
11
-
12
- module.exports = {
13
- plugins: [
14
- postcssImport(),
15
- combineSelectors({
16
- removeDuplicatedProperties: true
17
- }),
18
- cssnano({
19
- preset: [
20
- 'default', {
21
- mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
22
- },
23
- ]
24
- },),
25
- modifySelectors({
26
- enable: true,
27
- suffix: [
28
- {
29
- match: '*',
30
- with: '[_ui5host]', // Add suffix to each selector in the file (:root => :root [_ui5host])
31
- },
32
- ],
33
- }),
34
- modifySelectors({
35
- enable: true,
36
- modify: [
37
- {
38
- match: (selector) => {
39
- return selectors.some($ => selector.startsWith($));
40
- },
41
- with: (selector) => {
42
- return `${selector.replace(" ", "")}, ${selector}`;
43
- },
44
- },
45
- ]
46
- }),
47
- postcssCSStoJSON({ toReplace: 'src', packageName }),
48
- postcssCSStoESM({ toReplace: 'src', packageName }),
49
- ]
50
- };
1
+ module.exports = {};