@ui5/webcomponents-tools 0.0.0-f651a470c → 0.0.0-f6676abdd

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 (70) hide show
  1. package/CHANGELOG.md +1346 -0
  2. package/README.md +3 -5
  3. package/assets-meta.js +11 -10
  4. package/components-package/cypress/support/commands.js +66 -0
  5. package/components-package/cypress/support/component-index.html +17 -0
  6. package/components-package/cypress/support/component.d.ts +22 -0
  7. package/components-package/cypress/support/component.js +46 -0
  8. package/components-package/cypress/support/cypress-ct-preact.js +11 -0
  9. package/components-package/cypress.config.js +33 -0
  10. package/components-package/eslint.js +94 -28
  11. package/components-package/nps.js +58 -47
  12. package/components-package/postcss.components.js +1 -21
  13. package/components-package/postcss.themes.js +1 -26
  14. package/components-package/vite.config.js +7 -11
  15. package/components-package/wdio.js +415 -393
  16. package/icons-collection/nps.js +9 -7
  17. package/lib/amd-to-es6/index.js +102 -0
  18. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  19. package/lib/cem/custom-elements-manifest.config.mjs +544 -0
  20. package/lib/cem/event.mjs +168 -0
  21. package/lib/cem/schema-internal.json +1413 -0
  22. package/lib/cem/schema.json +1098 -0
  23. package/lib/cem/types-internal.d.ts +808 -0
  24. package/lib/cem/types.d.ts +736 -0
  25. package/lib/cem/utils.mjs +423 -0
  26. package/lib/cem/validate.js +70 -0
  27. package/lib/create-icons/index.js +8 -6
  28. package/lib/create-illustrations/index.js +51 -30
  29. package/lib/create-new-component/{tsFileContentTemplate.js → Component.js} +15 -25
  30. package/lib/create-new-component/ComponentTemplate.js +12 -0
  31. package/lib/create-new-component/index.js +35 -73
  32. package/lib/css-processors/css-processor-components.mjs +77 -0
  33. package/lib/css-processors/css-processor-themes.mjs +74 -0
  34. package/lib/css-processors/scope-variables.mjs +49 -0
  35. package/lib/css-processors/shared.mjs +56 -0
  36. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  37. package/lib/dev-server/{dev-server.js → dev-server.mjs} +4 -4
  38. package/lib/dev-server/virtual-index-html-plugin.js +24 -20
  39. package/lib/generate-js-imports/illustrations.js +78 -64
  40. package/lib/generate-json-imports/i18n.js +45 -61
  41. package/lib/generate-json-imports/themes.js +16 -33
  42. package/lib/hbs2lit/src/compiler.js +9 -6
  43. package/lib/hbs2lit/src/litVisitor2.js +42 -17
  44. package/lib/hbs2lit/src/svgProcessor.js +12 -5
  45. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +39 -6
  46. package/lib/hbs2ui5/index.js +23 -6
  47. package/lib/i18n/defaults.js +3 -2
  48. package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
  49. package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
  50. package/lib/scoping/get-all-tags.js +10 -3
  51. package/lib/scoping/lint-src.js +8 -7
  52. package/lib/scoping/scope-test-pages.js +2 -1
  53. package/lib/test-runner/test-runner.js +2 -2
  54. package/package.json +25 -13
  55. package/tsconfig.json +18 -0
  56. package/types/index.d.ts +1 -0
  57. package/components-package/wdio.sync.js +0 -360
  58. package/lib/create-new-component/jsFileContentTemplate.js +0 -77
  59. package/lib/esm-abs-to-rel/index.js +0 -58
  60. package/lib/generate-custom-elements-manifest/index.js +0 -327
  61. package/lib/jsdoc/config.json +0 -29
  62. package/lib/jsdoc/configTypescript.json +0 -29
  63. package/lib/jsdoc/plugin.js +0 -2468
  64. package/lib/jsdoc/preprocess.js +0 -146
  65. package/lib/jsdoc/template/publish.js +0 -4120
  66. package/lib/postcss-css-to-esm/index.js +0 -90
  67. package/lib/postcss-css-to-json/index.js +0 -47
  68. package/lib/postcss-new-files/index.js +0 -36
  69. package/lib/postcss-p/postcss-p.mjs +0 -14
  70. package/lib/replace-global-core/index.js +0 -25
@@ -1,90 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const mkdirp = require('mkdirp');
4
- const assets = require("../../assets-meta.js");
5
-
6
- const DEFAULT_THEME = assets.themes.default;
7
-
8
- const getDefaultThemeCode = packageName => {
9
- return `import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
10
-
11
- import defaultThemeBase from "@ui5/webcomponents-theming/dist/generated/themes/${DEFAULT_THEME}/parameters-bundle.css.js";
12
- import defaultTheme from "./${DEFAULT_THEME}/parameters-bundle.css.js";
13
-
14
- registerThemePropertiesLoader("@ui5/webcomponents-theming", "${DEFAULT_THEME}", async () => defaultThemeBase);
15
- registerThemePropertiesLoader("${packageName}", "${DEFAULT_THEME}", async () => defaultTheme);
16
- `;
17
- };
18
-
19
- const getFileContent = (tsMode, targetFile, packageName, css, includeDefaultTheme) => {
20
- if (tsMode) {
21
- return getTSContent(targetFile, packageName, css, includeDefaultTheme);
22
- }
23
-
24
- return getJSContent(targetFile, packageName, css, includeDefaultTheme);
25
- }
26
-
27
- const getTSContent = (targetFile, packageName, css, includeDefaultTheme) => {
28
- const typeImport = "import type { StyleData } from \"@ui5/webcomponents-base/dist/types.js\";"
29
- const defaultTheme = includeDefaultTheme ? getDefaultThemeCode(packageName) : "";
30
-
31
- // tabs are intentionally mixed to have proper identation in the produced file
32
- return `${typeImport}
33
- ${defaultTheme}
34
- const styleData: StyleData = {packageName:"${packageName}",fileName:"${targetFile.substr(targetFile.lastIndexOf("themes"))}",content:${css}};
35
- export default styleData;
36
- `;
37
- }
38
-
39
- const getJSContent = (targetFile, packageName, css, includeDefaultTheme) => {
40
- const defaultTheme = includeDefaultTheme ? getDefaultThemeCode(packageName) : "";
41
-
42
- return `${defaultTheme}export default {packageName:"${packageName}",fileName:"${targetFile.substr(targetFile.lastIndexOf("themes"))}",content:${css}}`
43
- }
44
-
45
-
46
- const proccessCSS = css => {
47
- css = css.replace(/\.sapThemeMeta[\s\S]*?:root/, ":root");
48
- css = css.replace(/\.background-image.*{.*}/, "");
49
- css = css.replace(/\.sapContrast[ ]*:root[\s\S]*?}/, "");
50
- css = css.replace(/--sapFontUrl.*\);?/, "");
51
- return JSON.stringify(css);
52
- }
53
-
54
- module.exports = function (opts) {
55
- opts = opts || {};
56
-
57
- const packageName = opts.packageName;
58
- const includeDefaultTheme = opts.includeDefaultTheme;
59
- const toReplace = opts.toReplace;
60
-
61
- return {
62
- postcssPlugin: 'postcss-css-to-esm',
63
- Once (root) {
64
- const tsMode = process.env.UI5_TS === "true";
65
-
66
- let css = root.toString();
67
- css = proccessCSS(css);
68
-
69
- const targetFile = root.source.input.from.replace(`/${toReplace}/`, "/src/generated/").replace(`\\${toReplace}\\`, "\\src\\generated\\");
70
- mkdirp.sync(path.dirname(targetFile));
71
-
72
- const filePath = `${targetFile}.${tsMode ? "ts" : "js"}`;
73
-
74
- // it seems slower to read the old content, but writing the same content with no real changes
75
- // (as in initial build and then watch mode) will cause an unnecessary dev server refresh
76
- let oldContent = "";
77
- try {
78
- oldContent = fs.readFileSync(filePath).toString();
79
- } catch (e) {
80
- // file not found
81
- }
82
-
83
- const content = getFileContent(tsMode, targetFile, packageName, css, includeDefaultTheme);
84
- if (content !== oldContent) {
85
- fs.writeFileSync(filePath, content);
86
- }
87
- }
88
- };
89
- };
90
- module.exports.postcss = true;
@@ -1,47 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const mkdirp = require('mkdirp');
4
-
5
- const proccessCSS = css => {
6
- css = css.replace(/\.sapThemeMeta[\s\S]*?:root/, ":root");
7
- css = css.replace(/\.background-image.*{.*}/, "");
8
- css = css.replace(/\.sapContrast[ ]*:root[\s\S]*?}/, "");
9
- css = css.replace(/--sapFontUrl.*\);?/, "");
10
- return css;
11
- }
12
-
13
- module.exports = function (opts) {
14
- opts = opts || {};
15
-
16
- return {
17
- postcssPlugin: 'postcss-css-to-json',
18
- Once (root) {
19
- let css = root.toString();
20
- css = proccessCSS(css);
21
-
22
- const targetFile = root.source.input.from.replace(`/${opts.toReplace}/`, "/dist/generated/assets/").replace(`\\${opts.toReplace}\\`, "\\dist\\generated\\assets\\");
23
- mkdirp.sync(path.dirname(targetFile));
24
-
25
- const filePath = `${targetFile}.json`;
26
- const data = {
27
- packageName: opts.packageName,
28
- fileName: targetFile.substr(targetFile.lastIndexOf("themes")),
29
- content: css
30
- };
31
- // it seems slower to read the old content, but writing the same content with no real changes
32
- // (as in initial build and then watch mode) will cause an unnecessary dev server refresh
33
- let oldContent = "";
34
- try {
35
- oldContent = fs.readFileSync(filePath).toString();
36
- } catch (e) {
37
- // file not found
38
- }
39
- const content = JSON.stringify({_: data});
40
- if (content !== oldContent) {
41
- fs.writeFileSync(filePath, content);
42
- }
43
- }
44
- };
45
- };
46
-
47
- module.exports.postcss = true;
@@ -1,36 +0,0 @@
1
- const chokidar = require("chokidar");
2
- const commandLineArgs = require("command-line-args");
3
- const { exec } = require("child_process");
4
-
5
- const options = commandLineArgs([
6
- { name: "srcFiles", type: String },
7
- ]);
8
-
9
- const runPostcss = path => {
10
- let command = `postcss ${path} --config config/postcss.components --base src --dir dist/css/`;
11
- console.log(`Executing: ${command}`);
12
- exec(command, (err, stdout, stderr) => {
13
- if (err) {
14
- console.log(`Could not run postcss for ${path}. Error: ${err}`);
15
- }
16
- });
17
-
18
- command = `${command} -w`;
19
- console.log(`Executing: ${command}`);
20
- exec(command, (err, stdout, stderr) => {
21
- if (err) {
22
- console.log(`Could not run postcss in watch mode for ${path}. Error: ${err}`);
23
- }
24
- });
25
- };
26
-
27
- let ready = false; // Do nothing until the ready event has been fired (we don't want to recompile all files initially)
28
- const watcher = chokidar.watch(options.srcFiles);
29
- watcher.on("ready", () => {
30
- ready = true; // Initial scan is over -> waiting for new files
31
- });
32
- watcher.on("add", path => {
33
- if (ready) {
34
- runPostcss(path);
35
- }
36
- });
@@ -1,14 +0,0 @@
1
- import 'zx/globals';
2
-
3
- // don't print executed commands and their output
4
- $.verbose = false;
5
-
6
- const inputFiles = await globby("src/**/parameters-bundle.css");
7
-
8
- const restArgs = process.argv.slice(2);
9
-
10
- // run all postcss processes in parallel as passing the glob directly to postcss makes them processed sequentially.
11
- // and the amount of imports give a big speed up when run in parallel
12
- await Promise.all(inputFiles.map(file => {
13
- return $`postcss ${file} --config config/postcss.themes --base src --dir dist/css/ ${restArgs}`;
14
- }));
@@ -1,25 +0,0 @@
1
- const fs = require("fs").promises;
2
-
3
- const basePath = process.argv[2];
4
-
5
- const replaceGlobalCoreUsage = async (srcPath) => {
6
-
7
- const original = (await fs.readFile(srcPath)).toString();
8
- let replaced = original.replace(/sap\.ui\.getCore\(\)/g, `Core`);
9
-
10
- if (original !== replaced) {
11
- replaced = `import Core from 'sap/ui/core/Core';
12
- ${replaced}`;
13
- return fs.writeFile(srcPath, replaced);
14
- }
15
- };
16
-
17
- const generate = async () => {
18
- const { globby } = await import("globby");
19
- const fileNames = await globby(basePath.replace(/\\/g, "/") + "**/*.js");
20
- return Promise.all(fileNames.map(replaceGlobalCoreUsage).filter(x => !!x));
21
- };
22
-
23
- generate().then(() => {
24
- console.log("Success: Replaced global core usage in:", basePath);
25
- });