@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.
- package/CHANGELOG.md +1346 -0
- package/README.md +3 -5
- package/assets-meta.js +11 -10
- package/components-package/cypress/support/commands.js +66 -0
- package/components-package/cypress/support/component-index.html +17 -0
- package/components-package/cypress/support/component.d.ts +22 -0
- package/components-package/cypress/support/component.js +46 -0
- package/components-package/cypress/support/cypress-ct-preact.js +11 -0
- package/components-package/cypress.config.js +33 -0
- package/components-package/eslint.js +94 -28
- package/components-package/nps.js +58 -47
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -26
- package/components-package/vite.config.js +7 -11
- package/components-package/wdio.js +415 -393
- package/icons-collection/nps.js +9 -7
- package/lib/amd-to-es6/index.js +102 -0
- package/lib/amd-to-es6/no-remaining-require.js +33 -0
- package/lib/cem/custom-elements-manifest.config.mjs +544 -0
- package/lib/cem/event.mjs +168 -0
- package/lib/cem/schema-internal.json +1413 -0
- package/lib/cem/schema.json +1098 -0
- package/lib/cem/types-internal.d.ts +808 -0
- package/lib/cem/types.d.ts +736 -0
- package/lib/cem/utils.mjs +423 -0
- package/lib/cem/validate.js +70 -0
- package/lib/create-icons/index.js +8 -6
- package/lib/create-illustrations/index.js +51 -30
- package/lib/create-new-component/{tsFileContentTemplate.js → Component.js} +15 -25
- package/lib/create-new-component/ComponentTemplate.js +12 -0
- package/lib/create-new-component/index.js +35 -73
- package/lib/css-processors/css-processor-components.mjs +77 -0
- package/lib/css-processors/css-processor-themes.mjs +74 -0
- package/lib/css-processors/scope-variables.mjs +49 -0
- package/lib/css-processors/shared.mjs +56 -0
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- package/lib/dev-server/{dev-server.js → dev-server.mjs} +4 -4
- package/lib/dev-server/virtual-index-html-plugin.js +24 -20
- package/lib/generate-js-imports/illustrations.js +78 -64
- package/lib/generate-json-imports/i18n.js +45 -61
- package/lib/generate-json-imports/themes.js +16 -33
- package/lib/hbs2lit/src/compiler.js +9 -6
- package/lib/hbs2lit/src/litVisitor2.js +42 -17
- package/lib/hbs2lit/src/svgProcessor.js +12 -5
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +39 -6
- package/lib/hbs2ui5/index.js +23 -6
- package/lib/i18n/defaults.js +3 -2
- package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
- package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
- package/lib/scoping/get-all-tags.js +10 -3
- package/lib/scoping/lint-src.js +8 -7
- package/lib/scoping/scope-test-pages.js +2 -1
- package/lib/test-runner/test-runner.js +2 -2
- package/package.json +25 -13
- package/tsconfig.json +18 -0
- package/types/index.d.ts +1 -0
- package/components-package/wdio.sync.js +0 -360
- package/lib/create-new-component/jsFileContentTemplate.js +0 -77
- package/lib/esm-abs-to-rel/index.js +0 -58
- package/lib/generate-custom-elements-manifest/index.js +0 -327
- package/lib/jsdoc/config.json +0 -29
- package/lib/jsdoc/configTypescript.json +0 -29
- package/lib/jsdoc/plugin.js +0 -2468
- package/lib/jsdoc/preprocess.js +0 -146
- package/lib/jsdoc/template/publish.js +0 -4120
- package/lib/postcss-css-to-esm/index.js +0 -90
- package/lib/postcss-css-to-json/index.js +0 -47
- package/lib/postcss-new-files/index.js +0 -36
- package/lib/postcss-p/postcss-p.mjs +0 -14
- 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
|
-
});
|