@ui5/create-webcomponents-package 0.0.0-111ecd79a

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 (32) hide show
  1. package/CHANGELOG.md +190 -0
  2. package/README.md +57 -0
  3. package/create-package.js +207 -0
  4. package/package.json +27 -0
  5. package/template/.eslintignore +5 -0
  6. package/template/bundle.esm.js +31 -0
  7. package/template/config/postcss.components/postcss.config.js +1 -0
  8. package/template/config/postcss.themes/postcss.config.js +1 -0
  9. package/template/config/wdio.conf.js +1 -0
  10. package/template/global.d.ts +12 -0
  11. package/template/package-scripts.js +12 -0
  12. package/template/src/Assets.js +5 -0
  13. package/template/src/Assets.ts +5 -0
  14. package/template/src/MyFirstComponent.hbs +1 -0
  15. package/template/src/MyFirstComponent.js +67 -0
  16. package/template/src/MyFirstComponent.ts +55 -0
  17. package/template/src/i18n/messagebundle.properties +2 -0
  18. package/template/src/i18n/messagebundle_de.properties +1 -0
  19. package/template/src/i18n/messagebundle_en.properties +1 -0
  20. package/template/src/i18n/messagebundle_es.properties +1 -0
  21. package/template/src/i18n/messagebundle_fr.properties +1 -0
  22. package/template/src/themes/MyFirstComponent.css +11 -0
  23. package/template/src/themes/sap_belize/parameters-bundle.css +3 -0
  24. package/template/src/themes/sap_belize_hcb/parameters-bundle.css +3 -0
  25. package/template/src/themes/sap_belize_hcw/parameters-bundle.css +3 -0
  26. package/template/src/themes/sap_fiori_3/parameters-bundle.css +3 -0
  27. package/template/src/themes/sap_fiori_3_dark/parameters-bundle.css +3 -0
  28. package/template/src/themes/sap_fiori_3_hcb/parameters-bundle.css +3 -0
  29. package/template/src/themes/sap_fiori_3_hcw/parameters-bundle.css +3 -0
  30. package/template/test/pages/index.html +52 -0
  31. package/template/test/specs/Demo.spec.js +12 -0
  32. package/template/tsconfig.json +14 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,190 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [1.11.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.11.0-rc.0...v1.11.0-rc.1) (2023-02-09)
7
+
8
+
9
+ ### Features
10
+
11
+ * **framework:** add option to define package name, tag and typescript support from CLI ([#6379](https://github.com/SAP/ui5-webcomponents/issues/6379)) ([687c0f7](https://github.com/SAP/ui5-webcomponents/commit/687c0f7a420a72f77f294ace2898223c48708ae2)), closes [#6382](https://github.com/SAP/ui5-webcomponents/issues/6382)
12
+
13
+
14
+
15
+
16
+
17
+ # [1.11.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.10.4-rc.0...v1.11.0-rc.0) (2023-02-02)
18
+
19
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
20
+
21
+
22
+
23
+
24
+
25
+ ## [1.10.4-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.10.3...v1.10.4-rc.0) (2023-01-26)
26
+
27
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
28
+
29
+
30
+
31
+
32
+
33
+ ## [1.10.3](https://github.com/SAP/ui5-webcomponents/compare/v1.10.2...v1.10.3) (2023-01-25)
34
+
35
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
36
+
37
+
38
+
39
+
40
+
41
+ ## [1.10.1](https://github.com/SAP/ui5-webcomponents/compare/v0.0.0-7b49a7ff1...v1.10.1) (2023-01-24)
42
+
43
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
44
+
45
+
46
+
47
+
48
+
49
+ # [1.10.0](https://github.com/SAP/ui5-webcomponents/compare/v1.9.3...v1.10.0) (2023-01-20)
50
+
51
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
52
+
53
+
54
+
55
+
56
+
57
+ ## [1.9.3](https://github.com/SAP/ui5-webcomponents/compare/v1.9.2...v1.9.3) (2022-12-16)
58
+
59
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
60
+
61
+
62
+
63
+
64
+
65
+ ## [1.9.1](https://github.com/SAP/ui5-webcomponents/compare/v1.9.0...v1.9.1) (2022-11-10)
66
+
67
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
68
+
69
+
70
+
71
+
72
+
73
+ # [1.9.0](https://github.com/SAP/ui5-webcomponents/compare/v1.8.0...v1.9.0) (2022-10-31)
74
+
75
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
76
+
77
+
78
+
79
+
80
+
81
+ # [1.8.0](https://github.com/SAP/ui5-webcomponents/compare/v1.7.1...v1.8.0) (2022-10-03)
82
+
83
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
84
+
85
+
86
+
87
+
88
+
89
+ ## [1.7.1](https://github.com/SAP/ui5-webcomponents/compare/v1.7.0...v1.7.1) (2022-09-08)
90
+
91
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
92
+
93
+
94
+
95
+
96
+
97
+ # [1.7.0](https://github.com/SAP/ui5-webcomponents/compare/v1.6.0...v1.7.0) (2022-09-02)
98
+
99
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
100
+
101
+
102
+
103
+
104
+
105
+ # [1.6.0](https://github.com/SAP/ui5-webcomponents/compare/v1.5.0...v1.6.0) (2022-07-25)
106
+
107
+
108
+ ### Bug Fixes
109
+
110
+ * create package bugs ([#5517](https://github.com/SAP/ui5-webcomponents/issues/5517)) ([f528f5c](https://github.com/SAP/ui5-webcomponents/commit/f528f5c))
111
+
112
+
113
+
114
+
115
+
116
+ # [1.5.0](https://github.com/SAP/ui5-webcomponents/compare/v1.4.0...v1.5.0) (2022-07-03)
117
+
118
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
119
+
120
+
121
+
122
+
123
+
124
+ # [1.4.0](https://github.com/SAP/ui5-webcomponents/compare/v1.3.1...v1.4.0) (2022-05-25)
125
+
126
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
127
+
128
+
129
+
130
+
131
+
132
+ ## [1.3.1](https://github.com/SAP/ui5-webcomponents/compare/v1.3.0...v1.3.1) (2022-04-27)
133
+
134
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
135
+
136
+
137
+
138
+
139
+
140
+ # [1.3.0](https://github.com/SAP/ui5-webcomponents/compare/v1.2.4...v1.3.0) (2022-04-19)
141
+
142
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
143
+
144
+
145
+
146
+
147
+
148
+ ## [1.2.4](https://github.com/SAP/ui5-webcomponents/compare/v1.2.3...v1.2.4) (2022-03-30)
149
+
150
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
151
+
152
+
153
+
154
+
155
+
156
+ ## [1.2.3](https://github.com/SAP/ui5-webcomponents/compare/v1.2.2...v1.2.3) (2022-03-23)
157
+
158
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
159
+
160
+
161
+
162
+
163
+
164
+ ## [1.2.2](https://github.com/SAP/ui5-webcomponents/compare/v1.2.1...v1.2.2) (2022-03-22)
165
+
166
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
167
+
168
+
169
+
170
+
171
+
172
+ ## [1.2.1](https://github.com/SAP/ui5-webcomponents/compare/v1.2.0...v1.2.1) (2022-03-02)
173
+
174
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
175
+
176
+
177
+
178
+
179
+
180
+ # [1.2.0](https://github.com/SAP/ui5-webcomponents/compare/v1.1.2...v1.2.0) (2022-02-28)
181
+
182
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
183
+
184
+
185
+
186
+
187
+
188
+ ## [1.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
189
+
190
+ **Note:** Version bump only for package @ui5/create-webcomponents-package
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_wide.png)
2
+
3
+ # UI5 Web Components - Create Package
4
+
5
+ [![npm Package Version](https://badge.fury.io/js/%40ui5%2Fwebcomponents.svg)](https://www.npmjs.com/package/@ui5/webcomponents)
6
+
7
+ Provides an `npm init` script for creating new "UI5 Web Components" packages.
8
+
9
+ ## Usage with npm
10
+
11
+ ```
12
+ Usage:
13
+
14
+ # npm 6.x
15
+ npm init @ui5/webcomponents-package [OPTIONS]
16
+ # npm 7+, an extra double-dash is needed:
17
+ npm init @ui5/webcomponents-package -- [OPTIONS]
18
+
19
+ Options:
20
+ --name <string> - defines the package name
21
+ --tag <string> - defines the tag name of the sample web component that will be created in your new package
22
+ --enable-typescript - enables TypeScript support for the package
23
+ --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
24
+ ```
25
+
26
+ The script creates a new directory, and fills it with a `package.json` file and all necessary source files, and resources for a new
27
+ components package.
28
+
29
+ ## Usage with yarn
30
+
31
+ ```
32
+ Usage:
33
+ yarn create @ui5/webcomponents-package [OPTIONS]
34
+ Options:
35
+ --name <string> - defines the package name
36
+ --tag <string> - defines the tag name of the sample web component that will be created in your new package
37
+ --enable-typescript - enables TypeScript support for the package
38
+ --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
39
+ ```
40
+
41
+ The script creates a new directory, and fills it with a `package.json` file and all necessary source files, and resources for a new
42
+ components package.
43
+
44
+ ## Resources
45
+ - [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
46
+ - [UI5 Web Components - Home Page](https://sap.github.io/ui5-webcomponents)
47
+ - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
48
+
49
+ ## Support
50
+ 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/).
51
+
52
+ ## Contribute
53
+ Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
54
+
55
+ ## License
56
+ Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
57
+ This file is licensed under the Apache Software License, Version 2.0 except as noted otherwise in the [LICENSE](https://github.com/SAP/ui5-webcomponents/blob/main/LICENSE.txt) file.
@@ -0,0 +1,207 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const mkdirp = require("mkdirp");
6
+ const prompts = require("prompts");
7
+ const parser = require("npm-config-user-agent-parser");
8
+ const yargs = require("yargs/yargs");
9
+ const { hideBin } = require("yargs/helpers");
10
+
11
+ const argv = yargs(hideBin(process.argv)).argv;
12
+
13
+ const version = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"))).version;
14
+
15
+ // from where all the files will be copied
16
+ const TEMPLATE_DIR = path.join(`${__dirname}`, `template/`);
17
+
18
+ // String utils
19
+ const capitalizeFirst = str => str.substr(0,1).toUpperCase() + str.substr(1);
20
+ const kebabToCamelCase = string => toCamelCase(string.split("-"));
21
+ const toCamelCase = parts => {
22
+ return parts.map((string, index) => {
23
+ return index === 0 ? string.toLowerCase() : string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
24
+ }).join("");
25
+ };
26
+ const isTypescriptRelatedFile = sourcePath => {
27
+ return ["Assets.ts", "MyFirstComponent.ts", "tsconfig.json", "global.d.ts"].some(fileName => sourcePath.includes(fileName));
28
+ };
29
+
30
+ // Validation of user input
31
+ const isNameValid = name => typeof name === "string" && name.match(/^[a-zA-Z0-9\-_]+$/);
32
+ const isTagValid = tag => typeof tag === "string" && tag.match(/^[a-z0-9]+?-[a-zA-Z0-9\-_]+?[a-z0-9]$/);
33
+
34
+ // Utils for building the file structure
35
+ const replaceVarsInFileContent = (vars, content) => {
36
+ for (let key in vars) {
37
+ const re = new RegExp(key, "g");
38
+ content = content.replace(re, vars[key]);
39
+ }
40
+ return content;
41
+ };
42
+
43
+ const replaceVarsInFileName = (vars, fileName) => {
44
+ return fileName.replace(/MyFirstComponent/, vars.INIT_PACKAGE_VAR_CLASS_NAME);
45
+ };
46
+
47
+ const copyFile = (vars, sourcePath, destPath) => {
48
+ const ignoreJsRelated = vars.INIT_PACKAGE_VAR_TYPESCRIPT && sourcePath.includes("MyFirstComponent.js");
49
+ const ignoreTsRelated = !vars.INIT_PACKAGE_VAR_TYPESCRIPT && isTypescriptRelatedFile(sourcePath);
50
+
51
+ if (ignoreJsRelated || ignoreTsRelated) {
52
+ return;
53
+ }
54
+
55
+ let content = fs.readFileSync(sourcePath, { encoding: "UTF-8" });
56
+ content = replaceVarsInFileContent(vars, content);
57
+ destPath = replaceVarsInFileName(vars, destPath);
58
+ fs.writeFileSync(destPath, content);
59
+ };
60
+
61
+ const copyFiles = (vars, sourcePath, destPath) => {
62
+ const isDir = fs.lstatSync(sourcePath).isDirectory();
63
+ if (isDir) {
64
+ if (destPath) {
65
+ mkdirp.sync(destPath);
66
+ }
67
+ fs.readdirSync(sourcePath).forEach(file => {
68
+ copyFiles(vars, path.join(sourcePath, file), path.join(destPath, file));
69
+ });
70
+ } else {
71
+ copyFile(vars, sourcePath, destPath);
72
+ }
73
+ };
74
+
75
+ const generateFilesContent = (name, tag, typescript) => {
76
+ const className = capitalizeFirst(kebabToCamelCase(tag));
77
+
78
+ // All variables that will be replaced in the content of the resources/
79
+ const vars = {
80
+ INIT_PACKAGE_VAR_NAME: name,
81
+ INIT_PACKAGE_VAR_TAG: tag,
82
+ INIT_PACKAGE_VAR_CLASS_NAME: className,
83
+ INIT_PACKAGE_VAR_TYPESCRIPT: typescript,
84
+ };
85
+
86
+ const packageContent = {
87
+ name,
88
+ version: "0.0.1",
89
+ ui5: {
90
+ webComponentsPackage: true,
91
+ },
92
+ scripts: {
93
+ "clean": "wc-dev clean",
94
+ "lint": "wc-dev lint",
95
+ "start": "wc-dev start",
96
+ "watch": "wc-dev watch",
97
+ "build": "wc-dev build",
98
+ "test": "wc-dev test",
99
+ "create-ui5-element": "wc-create-ui5-element",
100
+ "prepublishOnly": "npm run build",
101
+ },
102
+ exports: {
103
+ "./src/*": "./src/*",
104
+ "./dist/*": "./dist/*",
105
+ "./package.json": "./package.json",
106
+ "./bundle.js": "./bundle.js",
107
+ "./*": "./dist/*",
108
+ },
109
+ "dependencies": {
110
+ "@ui5/webcomponents-base": version,
111
+ "@ui5/webcomponents-theming": version,
112
+ },
113
+ "devDependencies": {
114
+ "@ui5/webcomponents-tools": version,
115
+ "chromedriver": "*",
116
+ },
117
+ };
118
+
119
+ // Update package.json
120
+ const destDir = path.join(`./`, name);
121
+ mkdirp.sync(destDir);
122
+ fs.writeFileSync(path.join(destDir, "package.json"), JSON.stringify(packageContent, null, 2));
123
+ // Copy files
124
+ copyFiles(vars, TEMPLATE_DIR, destDir);
125
+
126
+ console.log("\nPackage successfully created!\nNext steps:\n");
127
+ console.log(`$ cd ${name}`);
128
+
129
+ let userAgentInfo;
130
+ try {
131
+ userAgentInfo = parser(process.env.npm_config_user_agent);
132
+ } catch (e) {}
133
+
134
+ if (userAgentInfo && userAgentInfo.yarn) {
135
+ console.log(`$ yarn`);
136
+ console.log(`$ yarn start`);
137
+ } else {
138
+ console.log(`$ npm i`);
139
+ console.log(`$ npm start`);
140
+ }
141
+
142
+ console.log("\n");
143
+ };
144
+
145
+ // Main function
146
+ const createWebcomponentsPackage = async () => {
147
+ let response;
148
+ if (argv.name && !isNameValid(argv.name)) {
149
+ throw new Error("The package name should be a string (a-z, A-Z, 0-9).");
150
+ }
151
+
152
+ if (argv.tag && !isTagValid(argv.tag) ) {
153
+ throw new Error("The tag should be in kebab-case (my-first-component f.e) and it can't be a single word.");
154
+ }
155
+
156
+ let name = argv.name || "my-package";
157
+ let tag = argv.tag || "my-first-component";
158
+ let typescriptSupport = !!argv.enableTypescript;
159
+
160
+ if (argv.skip) {
161
+ return generateFilesContent(name, tag, typescriptSupport);
162
+ }
163
+
164
+ if (!argv.name) {
165
+ response = await prompts({
166
+ type: "text",
167
+ name: "name",
168
+ message: "Package name:",
169
+ validate: isNameValid,
170
+ });
171
+ name = response.name;
172
+ }
173
+
174
+ if (!typescriptSupport) {
175
+ response = await prompts({
176
+ type: "select",
177
+ name: "language",
178
+ message: "Project type:",
179
+ choices: [
180
+ {
181
+ title: "JavaScript",
182
+ value: false,
183
+ },
184
+ {
185
+ title: "TypeScript",
186
+ value: true,
187
+ },
188
+ ],
189
+ });
190
+ typescriptSupport = response.language;
191
+ }
192
+
193
+ if (!argv.tag) {
194
+ response = await prompts({
195
+ type: "text",
196
+ name: "tag",
197
+ message: "Component name:",
198
+ initial: "my-first-component",
199
+ validate: isTagValid,
200
+ });
201
+ tag = response.tag;
202
+ }
203
+
204
+ return generateFilesContent(name, tag, typescriptSupport);
205
+ };
206
+
207
+ createWebcomponentsPackage();
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@ui5/create-webcomponents-package",
3
+ "version": "0.0.0-111ecd79a",
4
+ "description": "UI5 Web Components: create package",
5
+ "author": "SAP SE (https://www.sap.com)",
6
+ "license": "Apache-2.0",
7
+ "private": false,
8
+ "keywords": [
9
+ "openui5",
10
+ "sapui5",
11
+ "ui5"
12
+ ],
13
+ "bin": {
14
+ "create-webcomponents-package": "create-package.js"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/SAP/ui5-webcomponents.git",
19
+ "directory": "packages/create-package"
20
+ },
21
+ "dependencies": {
22
+ "mkdirp": "^1.0.4",
23
+ "npm-config-user-agent-parser": "^1.0.0",
24
+ "prompts": "^2.4.1",
25
+ "yargs": "^17.5.1"
26
+ }
27
+ }
@@ -0,0 +1,5 @@
1
+ # Note: Changes to this file also must be applied to the top level .eslintignore file.
2
+ dist
3
+ test
4
+ src/generated
5
+ jsdoc-dist
@@ -0,0 +1,31 @@
1
+ // used in test pages
2
+ import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js";
3
+
4
+ import { getAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js";
5
+ import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
6
+ import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
7
+ import { getTheme, setTheme } from "@ui5/webcomponents-base/dist/config/Theme.js";
8
+ import { getNoConflict, setNoConflict } from "@ui5/webcomponents-base/dist/config/NoConflict.js";
9
+ import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js";
10
+ import { getFirstDayOfWeek } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
11
+
12
+ // Enable additional themes and i18n texts
13
+ import "./dist/Assets.js";
14
+
15
+ // Import your web components here from the dist/ directory
16
+ import "./dist/INIT_PACKAGE_VAR_CLASS_NAME.js";
17
+
18
+ window["sap-ui-webcomponents-bundle"] = {
19
+ renderFinished,
20
+ configuration: {
21
+ getAnimationMode,
22
+ getLanguage,
23
+ getTheme,
24
+ setTheme,
25
+ getNoConflict,
26
+ setNoConflict,
27
+ getCalendarType,
28
+ getRTL,
29
+ getFirstDayOfWeek,
30
+ },
31
+ };
@@ -0,0 +1 @@
1
+ module.exports = require("@ui5/webcomponents-tools/components-package/postcss.components.js"); // eslint-disable-line
@@ -0,0 +1 @@
1
+ module.exports = require("@ui5/webcomponents-tools/components-package/postcss.themes.js"); // eslint-disable-line
@@ -0,0 +1 @@
1
+ module.exports = require("@ui5/webcomponents-tools/components-package/wdio.js"); // eslint-disable-line
@@ -0,0 +1,12 @@
1
+ // eslint-disable-next-line
2
+ import "@ui5/webcomponents-base/dist/global";
3
+ import { TemplateFunction } from "@ui5/webcomponents-base/dist/renderer/executeTemplate.js";
4
+
5
+ export {};
6
+
7
+ declare global {
8
+ module "*.lit.js" {
9
+ const content: TemplateFunction;
10
+ export default content;
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ const getScripts = require("@ui5/webcomponents-tools/components-package/nps.js"); //eslint-disable-line
2
+
3
+ const options = {
4
+ port: 8080,
5
+ typescript: INIT_PACKAGE_VAR_TYPESCRIPT,
6
+ };
7
+
8
+ const scripts = getScripts(options);
9
+
10
+ module.exports = {
11
+ scripts,
12
+ };
@@ -0,0 +1,5 @@
1
+ import "@ui5/webcomponents-theming/dist/Assets.js"; // Theming
2
+
3
+ // own INIT_PACKAGE_VAR_NAME package assets
4
+ import "./generated/json-imports/Themes.js";
5
+ import "./generated/json-imports/i18n.js";
@@ -0,0 +1,5 @@
1
+ import "@ui5/webcomponents-theming/dist/Assets.js"; // Theming
2
+
3
+ // own INIT_PACKAGE_VAR_NAME package assets
4
+ import "./generated/json-imports/Themes.js";
5
+ import "./generated/json-imports/i18n.js";
@@ -0,0 +1 @@
1
+ <div>This is: INIT_PACKAGE_VAR_TAG. {{pleaseWaitText}}</div>
@@ -0,0 +1,67 @@
1
+ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
3
+ import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
4
+
5
+ // Template
6
+ import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./generated/templates/INIT_PACKAGE_VAR_CLASS_NAMETemplate.lit.js";
7
+
8
+ // Styles
9
+ import INIT_PACKAGE_VAR_CLASS_NAMECss from "./generated/themes/INIT_PACKAGE_VAR_CLASS_NAME.css.js";
10
+
11
+ import { PLEASE_WAIT } from "./generated/i18n/i18n-defaults.js";
12
+
13
+ /**
14
+ * @public
15
+ */
16
+ const metadata = {
17
+ tag: "INIT_PACKAGE_VAR_TAG",
18
+ properties: {
19
+ },
20
+ slots: {
21
+ },
22
+ events: {
23
+ },
24
+ };
25
+
26
+ /**
27
+ * @class
28
+ *
29
+ * <h3 class="comment-api-title">Overview</h3>
30
+ *
31
+ * The <code>INIT_PACKAGE_VAR_TAG</code> component is a demo component that displays some text.
32
+ *
33
+ * @constructor
34
+ * @alias demo.components.INIT_PACKAGE_VAR_CLASS_NAME
35
+ * @extends sap.ui.webc.base.UI5Element
36
+ * @tagname INIT_PACKAGE_VAR_TAG
37
+ * @public
38
+ */
39
+ class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
40
+ static get metadata() {
41
+ return metadata;
42
+ }
43
+
44
+ static get render() {
45
+ return litRender;
46
+ }
47
+
48
+ static get template() {
49
+ return INIT_PACKAGE_VAR_CLASS_NAMETemplate;
50
+ }
51
+
52
+ static get styles() {
53
+ return INIT_PACKAGE_VAR_CLASS_NAMECss;
54
+ }
55
+
56
+ static async onDefine() {
57
+ INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle = await getI18nBundle("INIT_PACKAGE_VAR_NAME");
58
+ }
59
+
60
+ get pleaseWaitText() {
61
+ return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(PLEASE_WAIT);
62
+ }
63
+ }
64
+
65
+ INIT_PACKAGE_VAR_CLASS_NAME.define();
66
+
67
+ export default INIT_PACKAGE_VAR_CLASS_NAME;
@@ -0,0 +1,55 @@
1
+ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
3
+ import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
4
+ import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
5
+ import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
6
+
7
+ // Template
8
+ import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./generated/templates/INIT_PACKAGE_VAR_CLASS_NAMETemplate.lit.js";
9
+
10
+ // Styles
11
+ import INIT_PACKAGE_VAR_CLASS_NAMECss from "./generated/themes/INIT_PACKAGE_VAR_CLASS_NAME.css.js";
12
+
13
+ import { PLEASE_WAIT } from "./generated/i18n/i18n-defaults.js";
14
+
15
+ /**
16
+ * @class
17
+ *
18
+ * <h3 class="comment-api-title">Overview</h3>
19
+ *
20
+ * The <code>INIT_PACKAGE_VAR_TAG</code> component is a demo component that displays some text.
21
+ *
22
+ * @constructor
23
+ * @alias demo.components.INIT_PACKAGE_VAR_CLASS_NAME
24
+ * @extends sap.ui.webc.base.UI5Element
25
+ * @tagname INIT_PACKAGE_VAR_TAG
26
+ * @public
27
+ */
28
+ @customElement("INIT_PACKAGE_VAR_TAG")
29
+ class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
30
+ static i18nBundle: I18nBundle;
31
+
32
+ static get render() {
33
+ return litRender;
34
+ }
35
+
36
+ static get template() {
37
+ return INIT_PACKAGE_VAR_CLASS_NAMETemplate;
38
+ }
39
+
40
+ static get styles() {
41
+ return INIT_PACKAGE_VAR_CLASS_NAMECss;
42
+ }
43
+
44
+ static async onDefine() {
45
+ INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle = await getI18nBundle("INIT_PACKAGE_VAR_NAME");
46
+ }
47
+
48
+ get pleaseWaitText() {
49
+ return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(PLEASE_WAIT);
50
+ }
51
+ }
52
+
53
+ INIT_PACKAGE_VAR_CLASS_NAME.define();
54
+
55
+ export default INIT_PACKAGE_VAR_CLASS_NAME;
@@ -0,0 +1,2 @@
1
+ #please wait text for the sample component
2
+ PLEASE_WAIT=wait
@@ -0,0 +1 @@
1
+ PLEASE_WAIT=Bitte warten
@@ -0,0 +1 @@
1
+ PLEASE_WAIT=Please wait
@@ -0,0 +1 @@
1
+ PLEASE_WAIT=Espere
@@ -0,0 +1 @@
1
+ PLEASE_WAIT=Patientez.
@@ -0,0 +1,11 @@
1
+ :host {
2
+ border: 2px solid var(--my-component-border-color);
3
+ background-color: var(--sapBackgroundColor);
4
+ color: var(--sapTextColor);
5
+ display: block;
6
+ width: 24rem;
7
+ height: 3rem;
8
+ text-align: center;
9
+ vertical-align: middle;
10
+ line-height: 3rem;
11
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --my-component-border-color: lightblue;
3
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --my-component-border-color: black;
3
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --my-component-border-color: black;
3
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --my-component-border-color: green;
3
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --my-component-border-color: blue;
3
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --my-component-border-color: lightblue;
3
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --my-component-border-color: gray;
3
+ }
@@ -0,0 +1,52 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset="utf-8">
6
+
7
+ <title>INIT_PACKAGE_VAR_TAG</title>
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+ <meta charset="utf-8">
10
+
11
+ <script data-ui5-config type="application/json">
12
+ {
13
+ "language": "EN"
14
+ }
15
+ </script>
16
+
17
+ <script src="../../bundle.esm.js" type="module"></script>
18
+
19
+ <style>
20
+ code { color: blue; font-size: small; }
21
+ </style>
22
+
23
+ </head>
24
+
25
+ <body>
26
+ <ul>
27
+ <li><a href="?sap-ui-theme=sap_fiori_3">Fiori 3</a></li>
28
+ <li><a href="?sap-ui-theme=sap_fiori_3_dark">Fiori 3 Dark</a></li>
29
+ <li><a href="?sap-ui-theme=sap_fiori_3_hcb">Fiori 3 High Contrast Black</a></li>
30
+ <li><a href="?sap-ui-theme=sap_fiori_3_hcw">Fiori 3 High Contrast White</a></li>
31
+ <li><a href="?sap-ui-theme=sap_belize">Belize</a></li>
32
+ <li><a href="?sap-ui-theme=sap_belize_hcb">Belize High Contrast Black</a></li>
33
+ <li><a href="?sap-ui-theme=sap_belize_hcw">Belize High Contrast White</a></li>
34
+ </ul>
35
+ <br>
36
+ <span>or in the browser console, for example:</span>
37
+ <code>window['sap-ui-webcomponents-bundle'].configuration.setTheme("sap_belize_hcb")</code>
38
+
39
+ <br><br>
40
+
41
+ <a href="?sap-ui-language=en">English</a> |
42
+ <a href="?sap-ui-language=de">German</a> |
43
+ <a href="?sap-ui-language=es">Spanish</a> |
44
+ <a href="?sap-ui-language=fr">French</a>
45
+
46
+ <br><br>
47
+
48
+ <h1>Test your web components here</h1>
49
+ <INIT_PACKAGE_VAR_TAG id="myFirstComponent"></INIT_PACKAGE_VAR_TAG>
50
+ </body>
51
+
52
+ </html>
@@ -0,0 +1,12 @@
1
+ const assert = require("assert");
2
+
3
+ describe("INIT_PACKAGE_VAR_TAG rendering", async () => {
4
+ await browser.url("test/pages/index.html");
5
+
6
+ it("tests if web component is correctly rendered", async () => {
7
+
8
+ const innerContent = await browser.$("#myFirstComponent").shadow$("div");
9
+
10
+ assert.ok(innerContent, "content rendered");
11
+ });
12
+ });
@@ -0,0 +1,14 @@
1
+ {
2
+ "include": ["src/**/*", "global.d.ts"],
3
+ "compilerOptions": {
4
+ "target": "ES2021",
5
+ // Generate d.ts files
6
+ "declaration": true,
7
+ "outDir": "dist",
8
+ "skipLibCheck": true,
9
+ "sourceMap": true,
10
+ "strict": true,
11
+ "moduleResolution": "node",
12
+ "experimentalDecorators": true,
13
+ },
14
+ }