@ui5/webcomponents-tools 0.0.0-e818f286e → 0.0.0-ebd9a4db3

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 (61) hide show
  1. package/CHANGELOG.md +1743 -0
  2. package/README.md +3 -5
  3. package/assets-meta.js +12 -11
  4. package/components-package/eslint.js +66 -2
  5. package/components-package/nps.js +101 -41
  6. package/components-package/postcss.components.js +1 -21
  7. package/components-package/postcss.themes.js +1 -26
  8. package/components-package/vite.config.js +7 -10
  9. package/components-package/wdio.js +42 -13
  10. package/icons-collection/nps.js +13 -8
  11. package/lib/amd-to-es6/index.js +102 -0
  12. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  13. package/lib/cem/custom-elements-manifest.config.mjs +530 -0
  14. package/lib/cem/event.mjs +168 -0
  15. package/lib/cem/schema-internal.json +1422 -0
  16. package/lib/cem/schema.json +1098 -0
  17. package/lib/cem/types-internal.d.ts +808 -0
  18. package/lib/cem/types.d.ts +736 -0
  19. package/lib/cem/utils.mjs +423 -0
  20. package/lib/cem/validate.js +67 -0
  21. package/lib/copy-list/index.js +2 -2
  22. package/lib/create-icons/index.js +60 -15
  23. package/lib/create-illustrations/index.js +51 -30
  24. package/lib/create-new-component/Component.js +74 -0
  25. package/lib/create-new-component/ComponentTemplate.js +12 -0
  26. package/lib/create-new-component/index.js +60 -101
  27. package/lib/css-processors/css-processor-components.mjs +78 -0
  28. package/lib/css-processors/css-processor-themes.mjs +74 -0
  29. package/lib/css-processors/scope-variables.mjs +49 -0
  30. package/lib/css-processors/shared.mjs +56 -0
  31. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  32. package/lib/dev-server/{dev-server.js → dev-server.mjs} +4 -4
  33. package/lib/dev-server/virtual-index-html-plugin.js +25 -21
  34. package/lib/generate-js-imports/illustrations.js +86 -0
  35. package/lib/generate-json-imports/i18n.js +45 -61
  36. package/lib/generate-json-imports/themes.js +16 -33
  37. package/lib/hbs2lit/src/compiler.js +16 -5
  38. package/lib/hbs2lit/src/litVisitor2.js +85 -22
  39. package/lib/hbs2lit/src/svgProcessor.js +12 -5
  40. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +39 -6
  41. package/lib/hbs2ui5/index.js +23 -6
  42. package/lib/i18n/defaults.js +19 -2
  43. package/lib/i18n/toJSON.js +1 -1
  44. package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
  45. package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
  46. package/lib/scoping/get-all-tags.js +11 -11
  47. package/lib/scoping/lint-src.js +8 -7
  48. package/lib/scoping/scope-test-pages.js +2 -1
  49. package/lib/test-runner/test-runner.js +10 -2
  50. package/package.json +23 -11
  51. package/tsconfig.json +18 -0
  52. package/components-package/wdio.sync.js +0 -360
  53. package/lib/esm-abs-to-rel/index.js +0 -58
  54. package/lib/jsdoc/config.json +0 -29
  55. package/lib/jsdoc/plugin.js +0 -2436
  56. package/lib/jsdoc/template/publish.js +0 -4112
  57. package/lib/postcss-css-to-esm/index.js +0 -57
  58. package/lib/postcss-css-to-json/index.js +0 -47
  59. package/lib/postcss-new-files/index.js +0 -36
  60. package/lib/postcss-p/postcss-p.mjs +0 -14
  61. package/lib/replace-global-core/index.js +0 -25
@@ -1,57 +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}", () => defaultThemeBase);
15
- registerThemePropertiesLoader("${packageName}", "${DEFAULT_THEME}", () => defaultTheme);
16
- `;
17
- };
18
-
19
- const proccessCSS = css => {
20
- css = css.replace(/\.sapThemeMeta[\s\S]*?:root/, ":root");
21
- css = css.replace(/\.background-image.*{.*}/, "");
22
- css = css.replace(/\.sapContrast[ ]*:root[\s\S]*?}/, "");
23
- css = css.replace(/--sapFontUrl.*\);?/, "");
24
- return JSON.stringify(css);
25
- }
26
-
27
- module.exports = function (opts) {
28
- opts = opts || {};
29
-
30
- return {
31
- postcssPlugin: 'postcss-css-to-esm',
32
- Once (root) {
33
- let css = root.toString();
34
- css = proccessCSS(css);
35
-
36
- const targetFile = root.source.input.from.replace(`/${opts.toReplace}/`, "/dist/generated/").replace(`\\${opts.toReplace}\\`, "\\dist\\generated\\");
37
- mkdirp.sync(path.dirname(targetFile));
38
-
39
- const filePath = `${targetFile}.js`;
40
- const defaultTheme = opts.includeDefaultTheme ? getDefaultThemeCode(opts.packageName) : ``;
41
-
42
- // it seems slower to read the old content, but writing the same content with no real changes
43
- // (as in initial build and then watch mode) will cause an unnecessary dev server refresh
44
- let oldContent = "";
45
- try {
46
- oldContent = fs.readFileSync(filePath).toString();
47
- } catch (e) {
48
- // file not found
49
- }
50
- const content = `${defaultTheme}export default {packageName:"${opts.packageName}",fileName:"${targetFile.substr(targetFile.lastIndexOf("themes"))}",content:${css}}`
51
- if (content !== oldContent) {
52
- fs.writeFileSync(filePath, content);
53
- }
54
- }
55
- };
56
- };
57
- 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 + "**/*.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
- });