@ui5/create-webcomponents-package 0.0.0-e58530409 → 0.0.0-e5b03d3e8

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 (41) hide show
  1. package/CHANGELOG.md +1522 -0
  2. package/README.md +30 -12
  3. package/create-package.js +215 -0
  4. package/package.json +4 -3
  5. package/template/.eslintignore +2 -0
  6. package/template/.eslintrc.cjs +5 -0
  7. package/template/.npsrc.json +3 -0
  8. package/template/bundle.esm.js +0 -2
  9. package/template/gitignore +3 -0
  10. package/template/npmrc +2 -0
  11. package/template/{package-scripts.js → package-scripts.cjs} +1 -1
  12. package/template/src/MyFirstComponent.ts +56 -0
  13. package/template/src/MyFirstComponentTemplate.tsx +9 -0
  14. package/template/src/i18n/messagebundle.properties +3 -2
  15. package/template/src/i18n/messagebundle_de.properties +1 -1
  16. package/template/src/i18n/messagebundle_en.properties +1 -1
  17. package/template/src/i18n/messagebundle_es.properties +1 -1
  18. package/template/src/i18n/messagebundle_fr.properties +1 -1
  19. package/template/src/themes/MyFirstComponent.css +16 -10
  20. package/template/src/themes/sap_fiori_3/parameters-bundle.css +1 -1
  21. package/template/src/themes/sap_horizon_dark/parameters-bundle.css +3 -0
  22. package/template/src/themes/sap_horizon_hcb/parameters-bundle.css +3 -0
  23. package/template/test/pages/css/index.css +41 -0
  24. package/template/test/pages/img/logo.png +0 -0
  25. package/template/test/pages/index.html +36 -33
  26. package/template/test/specs/Demo.spec.js +4 -3
  27. package/template/tsconfig.json +13 -0
  28. package/template/vite.config.js +14 -0
  29. package/index.js +0 -167
  30. package/template/config/postcss.components/postcss.config.js +0 -1
  31. package/template/config/postcss.themes/postcss.config.js +0 -1
  32. package/template/src/MyFirstComponent.hbs +0 -1
  33. package/template/src/MyFirstComponent.js +0 -51
  34. package/template/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
  35. package/template/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
  36. package/template/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
  37. package/template/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
  38. /package/template/config/{wdio.conf.js → wdio.conf.cjs} +0 -0
  39. /package/template/src/{Assets.js → Assets.ts} +0 -0
  40. /package/template/src/themes/{sap_belize → sap_horizon}/parameters-bundle.css +0 -0
  41. /package/template/src/themes/{sap_belize_hcb → sap_horizon_hcw}/parameters-bundle.css +0 -0
package/README.md CHANGED
@@ -1,22 +1,40 @@
1
- ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_wide.png)
2
-
3
- # UI5 Web Components - Create Package
1
+ # ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_water.png)UI5 Web Components - Create Package
4
2
 
5
3
  [![npm Package Version](https://badge.fury.io/js/%40ui5%2Fwebcomponents.svg)](https://www.npmjs.com/package/@ui5/webcomponents)
6
4
 
7
5
  Provides an `npm init` script for creating new "UI5 Web Components" packages.
8
6
 
9
- ## Usage
7
+ ## Usage with npm
8
+
9
+ ```
10
+ Usage:
11
+
12
+ # npm 6.x
13
+ npm init @ui5/webcomponents-package [OPTIONS]
14
+ # npm 7+, an extra double-dash is needed:
15
+ npm init @ui5/webcomponents-package -- [OPTIONS]
10
16
 
11
- with `npm`
17
+ Options:
18
+ --name <string> - defines the package name
19
+ --component-name <string> - defines the component class name that will be created in your new package
20
+ --tag <string> - defines the tag name of the sample web component that will be created in your new package. The tag will be derived from the component name if not provided.
21
+ --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
22
+ ```
12
23
 
13
- - `npm init @ui5/webcomponents-package` (the user will be asked for **name**, **port**, **tag**);
14
- - `npm init @ui5/webcomponents-package <NEW-PACKAGE-NAME>` (the user will be asked for **port** and **tag** only).
24
+ The script creates a new directory, and fills it with a `package.json` file and all necessary source files, and resources for a new
25
+ components package.
15
26
 
16
- And with `yarn`
27
+ ## Usage with yarn
17
28
 
18
- - `yarn create @ui5/webcomponents-package`
19
- - `yarn create @ui5/webcomponents-package <NEW-PACKAGE-NAME>`.
29
+ ```
30
+ Usage:
31
+ yarn create @ui5/webcomponents-package [OPTIONS]
32
+ Options:
33
+ --name <string> - defines the package name
34
+ --component-name <string> - defines the component class name that will be created in your new package
35
+ --tag <string> - defines the tag name of the sample web component that will be created in your new package
36
+ --skip - skips configuration and generates package with a default value for each parameter that wasn't passed
37
+ ```
20
38
 
21
39
  The script creates a new directory, and fills it with a `package.json` file and all necessary source files, and resources for a new
22
40
  components package.
@@ -24,10 +42,10 @@ components package.
24
42
  ## Resources
25
43
  - [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
26
44
  - [UI5 Web Components - Home Page](https://sap.github.io/ui5-webcomponents)
27
- - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
45
+ - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/play/)
28
46
 
29
47
  ## Support
30
- 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/).
48
+ 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/).
31
49
 
32
50
  ## Contribute
33
51
  Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
@@ -0,0 +1,215 @@
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
+ const isGitIgnore = sourcePath => {
19
+ return sourcePath.includes("gitignore");
20
+ };
21
+ const isLogo = sourcePath => {
22
+ return sourcePath.includes("logo");
23
+ };
24
+ const isNPMRC = sourcePath => {
25
+ return sourcePath.includes("npmrc");
26
+ };
27
+
28
+ // Validation of user input
29
+ const ComponentNamePattern = /^[A-Z][A-Za-z0-9]+$/;
30
+ const isPackageNameValid = name => typeof name === "string" && name.match(/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/);
31
+ const isComponentNameValid = name => typeof name === "string" && ComponentNamePattern.test(name);
32
+ const isTagValid = tag => typeof tag === "string" && tag.match(/^[a-z0-9]+?-[a-zA-Z0-9\-_]+?[a-z0-9]$/);
33
+
34
+ /**
35
+ * Hyphanates the given PascalCase string, f.e.:
36
+ * Foo -> "my-foo" (adds preffix)
37
+ * FooBar -> "foo-bar"
38
+ */
39
+ const hyphaneteComponentName = (componentName) => {
40
+ const result = componentName.replace(/([a-z])([A-Z])/g, '$1-$2' ).toLowerCase();
41
+
42
+ return result.includes("-") ? result : `my-${result}`;
43
+ };
44
+
45
+ // Utils for building the file structure
46
+ const replaceVarsInFileContent = (vars, content) => {
47
+ for (let key in vars) {
48
+ const re = new RegExp(key, "g");
49
+ content = content.replace(re, vars[key]);
50
+ }
51
+ return content;
52
+ };
53
+
54
+ const replaceVarsInFileName = (vars, fileName) => {
55
+ return fileName.replace(/MyFirstComponent/, vars.INIT_PACKAGE_VAR_CLASS_NAME);
56
+ };
57
+
58
+ const copyFile = (vars, sourcePath, destPath) => {
59
+ if (isLogo(sourcePath)) {
60
+ fs.copyFileSync(sourcePath, destPath);
61
+ return;
62
+ }
63
+
64
+ let content = fs.readFileSync(sourcePath, { encoding: "UTF-8" });
65
+ content = replaceVarsInFileContent(vars, content);
66
+ destPath = replaceVarsInFileName(vars, destPath);
67
+
68
+ fs.writeFileSync(destPath, content);
69
+
70
+ // Rename "gitignore" to ".gitignore" (npm init won't include ".gitignore", so we add it as "gitignore" and rename it later)
71
+ if (isGitIgnore(sourcePath)) {
72
+ fs.renameSync(destPath, destPath.replace("gitignore", ".gitignore"))
73
+ }
74
+
75
+ // Rename "npmrc" to ".npmrc" (npm init won't include ".npmrc", so we add it as "npmrc" and rename it later)
76
+ if (isNPMRC(sourcePath)) {
77
+ fs.renameSync(destPath, destPath.replace("npmrc", ".npmrc"));
78
+ }
79
+ };
80
+
81
+ const copyFiles = (vars, sourcePath, destPath) => {
82
+ const isDir = fs.lstatSync(sourcePath).isDirectory();
83
+ if (isDir) {
84
+ if (destPath) {
85
+ mkdirp.sync(destPath);
86
+ }
87
+ fs.readdirSync(sourcePath).forEach(file => {
88
+ copyFiles(vars, path.join(sourcePath, file), path.join(destPath, file));
89
+ });
90
+ } else {
91
+ copyFile(vars, sourcePath, destPath);
92
+ }
93
+ };
94
+
95
+ const generateFilesContent = (packageName, componentName, skipSubfolder) => {
96
+ const tagName = argv.tag || hyphaneteComponentName(componentName);
97
+
98
+ // All variables that will be replaced in the content of the resources/
99
+ const vars = {
100
+ INIT_PACKAGE_VAR_NAME: packageName,
101
+ INIT_PACKAGE_VAR_TAG: tagName,
102
+ INIT_PACKAGE_VAR_CLASS_NAME: componentName,
103
+ };
104
+
105
+ const packageContent = {
106
+ name: packageName,
107
+ version: "0.0.1",
108
+ ui5: {
109
+ webComponentsPackage: true,
110
+ },
111
+ type: "module",
112
+ scripts: {
113
+ "clean": "wc-dev clean",
114
+ "lint": "wc-dev lint",
115
+ "start": "wc-dev start",
116
+ "watch": "wc-dev watch",
117
+ "build": "wc-dev build",
118
+ "test": "wc-dev test",
119
+ "create-ui5-element": "wc-create-ui5-element",
120
+ "prepublishOnly": "npm run build",
121
+ },
122
+ exports: {
123
+ "./src/*": "./src/*",
124
+ "./dist/*": "./dist/*",
125
+ "./package.json": "./package.json",
126
+ "./bundle.js": "./bundle.js",
127
+ "./*": "./dist/*",
128
+ },
129
+ "dependencies": {
130
+ "@ui5/webcomponents-base": version,
131
+ "@ui5/webcomponents-theming": version,
132
+ },
133
+ "devDependencies": {
134
+ "@ui5/webcomponents-tools": version,
135
+ "chromedriver": "*",
136
+ "typescript": "^5.6.2"
137
+ },
138
+ };
139
+
140
+ // Update package.json
141
+ let destDir = packageName.includes("@") ? packageName.slice(packageName.lastIndexOf("/") + 1) : packageName;
142
+
143
+ destDir = skipSubfolder ? path.join("./") : path.join("./", destDir);
144
+ mkdirp.sync(destDir);
145
+ fs.writeFileSync(path.join(destDir, "package.json"), JSON.stringify(packageContent, null, 2));
146
+ // Copy files
147
+ copyFiles(vars, TEMPLATE_DIR, destDir);
148
+
149
+ console.log("\nPackage successfully created!\nNext steps:\n");
150
+ console.log(`$ cd ${destDir}`);
151
+
152
+ let userAgentInfo;
153
+ try {
154
+ userAgentInfo = parser(process.env.npm_config_user_agent);
155
+ } catch (e) {}
156
+
157
+ if (userAgentInfo && userAgentInfo.yarn) {
158
+ console.log(`$ yarn`);
159
+ console.log(`$ yarn start`);
160
+ } else {
161
+ console.log(`$ npm i`);
162
+ console.log(`$ npm start`);
163
+ }
164
+
165
+ console.log("\n");
166
+ };
167
+
168
+ // Main function
169
+ const createWebcomponentsPackage = async () => {
170
+ let response;
171
+ if (argv.name && !isPackageNameValid(argv.name)) {
172
+ throw new Error("The package name should be a string, starting with letter and containing the following symbols [a-z, A-Z, 0-9].");
173
+ }
174
+
175
+ if (argv.componentName && !isComponentNameValid(argv.componentName)) {
176
+ throw new Error("The component name should be a string, starting with a capital letter [A-Z][a-z], for example: Button, MyButton, etc.");
177
+ }
178
+
179
+ if (argv.tag && !isTagValid(argv.tag) ) {
180
+ throw new Error("The tag should be in kebab-case (f.e my-component) and it can't be a single word.");
181
+ }
182
+
183
+ let packageName = argv.name || "my-package";
184
+ let componentName = argv.componentName || "MyComponent";
185
+ const skipSubfolder = !!argv.skipSubfolder;
186
+
187
+ if (argv.skip) {
188
+ return generateFilesContent(packageName, componentName, skipSubfolder);
189
+ }
190
+
191
+ if (!argv.name) {
192
+ response = await prompts({
193
+ type: "text",
194
+ name: "name",
195
+ message: "Package name:",
196
+ validate: (value) => isPackageNameValid(value) ? true : "Package name should be a string, starting with a letter and containing the following symbols [a-z, A-Z ,0-9, _, -].",
197
+ });
198
+ packageName = response.name;
199
+ }
200
+
201
+ if (!argv.componentName) {
202
+ response = await prompts({
203
+ type: "text",
204
+ name: "componentName",
205
+ message: "Component name:",
206
+ initial: "MyComponent",
207
+ validate: (value) => isComponentNameValid(value) ? true : "Component name should follow PascalCase naming convention (f.e. Button, MyButton, etc.).",
208
+ });
209
+ componentName = response.componentName;
210
+ }
211
+
212
+ return generateFilesContent(packageName, componentName, skipSubfolder);
213
+ };
214
+
215
+ createWebcomponentsPackage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/create-webcomponents-package",
3
- "version": "0.0.0-e58530409",
3
+ "version": "0.0.0-e5b03d3e8",
4
4
  "description": "UI5 Web Components: create package",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -11,7 +11,7 @@
11
11
  "ui5"
12
12
  ],
13
13
  "bin": {
14
- "create-webcomponents-package": "index.js"
14
+ "create-webcomponents-package": "create-package.js"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
@@ -21,6 +21,7 @@
21
21
  "dependencies": {
22
22
  "mkdirp": "^1.0.4",
23
23
  "npm-config-user-agent-parser": "^1.0.0",
24
- "prompts": "^2.4.1"
24
+ "prompts": "^2.4.1",
25
+ "yargs": "^17.5.1"
25
26
  }
26
27
  }
@@ -1,3 +1,5 @@
1
1
  # Note: Changes to this file also must be applied to the top level .eslintignore file.
2
2
  dist
3
3
  test
4
+ src/generated
5
+ .eslintrc.cjs
@@ -0,0 +1,5 @@
1
+ const config = require("@ui5/webcomponents-tools/components-package/eslint.js");
2
+
3
+ // This eslint config is defined @ui5/webcomponents-tools,
4
+ // Feel free to override part of the configuration or provide entirely new config to fit your dev requirements.
5
+ module.exports = config;
@@ -0,0 +1,3 @@
1
+ {
2
+ "config": "./package-scripts.cjs"
3
+ }
@@ -6,7 +6,6 @@ import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
6
6
  import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
7
7
  import { getTheme, setTheme } from "@ui5/webcomponents-base/dist/config/Theme.js";
8
8
  import { getNoConflict, setNoConflict } from "@ui5/webcomponents-base/dist/config/NoConflict.js";
9
- import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js";
10
9
  import { getFirstDayOfWeek } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
11
10
 
12
11
  // Enable additional themes and i18n texts
@@ -25,7 +24,6 @@ window["sap-ui-webcomponents-bundle"] = {
25
24
  getNoConflict,
26
25
  setNoConflict,
27
26
  getCalendarType,
28
- getRTL,
29
27
  getFirstDayOfWeek,
30
28
  },
31
29
  };
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ dist
3
+ src/generated
package/template/npmrc ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect the chromedriver version
2
+ detect_chromedriver_version=true
@@ -1,7 +1,7 @@
1
1
  const getScripts = require("@ui5/webcomponents-tools/components-package/nps.js"); //eslint-disable-line
2
2
 
3
3
  const options = {
4
- port: INIT_PACKAGE_VAR_PORT,
4
+ port: 8080,
5
5
  };
6
6
 
7
7
  const scripts = getScripts(options);
@@ -0,0 +1,56 @@
1
+ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
+ import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
3
+ import property from "@ui5/webcomponents-base/dist/decorators/property.js";
4
+ import i18n from "@ui5/webcomponents-base/dist/decorators/i18n.js";
5
+ import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
6
+ import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
7
+
8
+ // Template
9
+ import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./INIT_PACKAGE_VAR_CLASS_NAMETemplate.js";
10
+
11
+ // Styles
12
+ import INIT_PACKAGE_VAR_CLASS_NAMECss from "./generated/themes/INIT_PACKAGE_VAR_CLASS_NAME.css.js";
13
+
14
+ import { COUNT } from "./generated/i18n/i18n-defaults.js";
15
+
16
+ /**
17
+ * @class
18
+ *
19
+ * <h3 class="comment-api-title">Overview</h3>
20
+ *
21
+ * The <code>INIT_PACKAGE_VAR_TAG</code> component is a demo component that displays some text.
22
+ *
23
+ * @constructor
24
+ * @extends UI5Element
25
+ * @public
26
+ */
27
+ @customElement({
28
+ tag: "INIT_PACKAGE_VAR_TAG",
29
+ renderer: jsxRenderer,
30
+ styles: INIT_PACKAGE_VAR_CLASS_NAMECss,
31
+ template: INIT_PACKAGE_VAR_CLASS_NAMETemplate,
32
+ })
33
+ class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
34
+ @i18n("INIT_PACKAGE_VAR_NAME")
35
+ static i18nBundle: I18nBundle;
36
+
37
+ /**
38
+ * Defines the component count.
39
+ * @default 0
40
+ * @public
41
+ */
42
+ @property({ type: Number })
43
+ count = 0;
44
+
45
+ onClick() {
46
+ this.count++;
47
+ }
48
+
49
+ get counterText() {
50
+ return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(COUNT);
51
+ }
52
+ }
53
+
54
+ INIT_PACKAGE_VAR_CLASS_NAME.define();
55
+
56
+ export default INIT_PACKAGE_VAR_CLASS_NAME;
@@ -0,0 +1,9 @@
1
+ import type INIT_PACKAGE_VAR_CLASS_NAME from "./INIT_PACKAGE_VAR_CLASS_NAME.js";
2
+
3
+ export default function INIT_PACKAGE_VAR_CLASS_NAMETemplate(this: INIT_PACKAGE_VAR_CLASS_NAME) {
4
+ return (
5
+ <div class="root" onClick={this.onClick}>
6
+ {this.counterText} :: {this.count}
7
+ </div>
8
+ );
9
+ }
@@ -1,2 +1,3 @@
1
- #please wait text for the sample component
2
- PLEASE_WAIT=wait
1
+ # the "counter" text for the sample component
2
+ COUNT=Count
3
+
@@ -1 +1 @@
1
- PLEASE_WAIT=Bitte warten
1
+ COUNT=Zählung
@@ -1 +1 @@
1
- PLEASE_WAIT=Please wait
1
+ COUNT=Count
@@ -1 +1 @@
1
- PLEASE_WAIT=Espere
1
+ COUNT=Cuenta
@@ -1 +1 @@
1
- PLEASE_WAIT=Patientez.
1
+ COUNT=Comte
@@ -1,11 +1,17 @@
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;
1
+ .root {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ flex-direction: column;
6
+ padding: 0 2rem;
7
+ color: var(--sapAvatar_6_TextColor);
8
+ background-color: var(--sapAvatar_6_Background);
9
+ border: 2px solid var(--my-component-border-color);
10
+ border-radius: 0.5rem;
11
+ box-shadow: var(--sapContent_Shadow0);
12
+ text-align: center;
13
+ line-height: 3rem;
14
+ font-size: 1.25rem;
15
+ user-select: none;
16
+ cursor: pointer;
11
17
  }
@@ -1,3 +1,3 @@
1
1
  :root {
2
- --my-component-border-color: green;
2
+ --my-component-border-color: blue;
3
3
  }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --my-component-border-color: darkblue;
3
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --my-component-border-color: white;
3
+ }
@@ -0,0 +1,41 @@
1
+ body {
2
+ color: var(--sapTextColor);
3
+ background-color: var(--sapBackgroundColor);
4
+ font-size: var(--sapFontSize);
5
+ font-family: var(--sapFontFamily);
6
+ }
7
+
8
+ h1 {
9
+ font-size: var(--sapFontHeader2Size);
10
+ margin-bottom: 0.5rem;
11
+ }
12
+
13
+ h2 {
14
+ font-size: var(--sapFontHeader3Size);
15
+ margin-bottom: 0.5rem;
16
+ }
17
+
18
+ .app, .app-settings, .app-docs, .app-first-component {
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+ flex-direction: column;
23
+ }
24
+
25
+ .app-logo {
26
+ height: 230px;
27
+ width: 230px;
28
+ }
29
+
30
+ .app-first-component {
31
+ margin-bottom: 3rem;
32
+ }
33
+
34
+ .app-docs {
35
+ margin-top: 3rem;
36
+ }
37
+
38
+ a {
39
+ margin: 0.25rem;
40
+ color: var(--sapLinkColor);
41
+ }
Binary file
@@ -2,53 +2,56 @@
2
2
  <html>
3
3
 
4
4
  <head>
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
5
  <meta charset="utf-8">
7
6
 
8
7
  <title>INIT_PACKAGE_VAR_TAG</title>
9
8
  <meta name="viewport" content="width=device-width, initial-scale=1">
10
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
11
9
  <meta charset="utf-8">
12
10
 
13
11
  <script data-ui5-config type="application/json">
14
12
  {
13
+ "theme": "sap_horizon_dark",
15
14
  "language": "EN"
16
15
  }
17
16
  </script>
18
17
 
19
- <script src="../../resources/bundle.esm.js" type="module"></script>
20
-
21
- <style>
22
- code { color: blue; font-size: small; }
23
- </style>
24
-
18
+ <link rel="stylesheet" type="text/css" href="./css/index.css">
19
+ <script src="../../bundle.esm.js" type="module"></script>
25
20
  </head>
26
21
 
27
22
  <body>
28
- <ul>
29
- <li><a href="?sap-ui-theme=sap_fiori_3">Fiori 3</a></li>
30
- <li><a href="?sap-ui-theme=sap_fiori_3_dark">Fiori 3 Dark</a></li>
31
- <li><a href="?sap-ui-theme=sap_fiori_3_hcb">Fiori 3 High Contrast Black</a></li>
32
- <li><a href="?sap-ui-theme=sap_fiori_3_hcw">Fiori 3 High Contrast White</a></li>
33
- <li><a href="?sap-ui-theme=sap_belize">Belize</a></li>
34
- <li><a href="?sap-ui-theme=sap_belize_hcb">Belize High Contrast Black</a></li>
35
- <li><a href="?sap-ui-theme=sap_belize_hcw">Belize High Contrast White</a></li>
36
- </ul>
37
- <br>
38
- <span>or in the browser console, for example:</span>
39
- <code>window['sap-ui-webcomponents-bundle'].configuration.setTheme("sap_belize_hcb")</code>
40
-
41
- <br><br>
42
-
43
- <a href="?sap-ui-language=en">English</a> |
44
- <a href="?sap-ui-language=de">German</a> |
45
- <a href="?sap-ui-language=es">Spanish</a> |
46
- <a href="?sap-ui-language=fr">French</a>
47
-
48
- <br><br>
49
-
50
- <h1>Test your web components here</h1>
51
- <INIT_PACKAGE_VAR_TAG id="myFirstComponent"></INIT_PACKAGE_VAR_TAG>
23
+ <div class="app">
24
+ <a href="https://sap.github.io/ui5-webcomponents/docs/getting-started/first-steps/" target="_blank"><img src="./img/logo.png" class="app-logo" alt="logo"/></a>
25
+
26
+ <div class="app-first-component">
27
+ <h1>Hooray! It's Your First Web Component!</h1>
28
+ <div> <pre>&lt;INIT_PACKAGE_VAR_TAG>&lt;/INIT_PACKAGE_VAR_TAG> </pre></div>
29
+ <INIT_PACKAGE_VAR_TAG id="myFirstComponent"></INIT_PACKAGE_VAR_TAG>
30
+ </div>
31
+
32
+ <div class="app-settings">
33
+
34
+ <h2>Switch themes</h2>
35
+ <div style="display: flex; flex-direction: row;">
36
+ <a class="link" href="?sap-ui-theme=sap_horizon">Horizon</a>
37
+ <a class="link" href="?sap-ui-theme=sap_horizon_dark">Horizon Dark</a>
38
+ <a class="link" href="?sap-ui-theme=sap_horizon_hcb">Horizon High Contrast Black</a>
39
+ <a class="link" href="?sap-ui-theme=sap_horizon_hcw">Horizon High Contrast White</a>
40
+ </div>
41
+
42
+ <h2>Switch language</h2>
43
+ <div>
44
+ <a class="link" href="?sap-ui-language=en">English</a>
45
+ <a class="link" href="?sap-ui-language=de">German</a>
46
+ <a class="link" href="?sap-ui-language=es">Spanish</a>
47
+ <a class="link" href="?sap-ui-language=fr">French</a>
48
+ </div>
49
+ </div>
50
+
51
+ <div class="app-docs">
52
+ <h2>Documentation</h2>
53
+ <a class="link" href="https://sap.github.io/ui5-webcomponents/docs/development/custom-UI5-Web-Components-Packages/">Custom Component Development</a>
54
+ </div>
55
+ </div>
52
56
  </body>
53
-
54
57
  </html>
@@ -1,10 +1,11 @@
1
- const assert = require("assert");
1
+ import { assert } from "chai";
2
2
 
3
3
  describe("INIT_PACKAGE_VAR_TAG rendering", async () => {
4
- await browser.url("test/pages/index.html");
4
+ before(async () => {
5
+ await browser.url("test/pages/index.html");
6
+ });
5
7
 
6
8
  it("tests if web component is correctly rendered", async () => {
7
-
8
9
  const innerContent = await browser.$("#myFirstComponent").shadow$("div");
9
10
 
10
11
  assert.ok(innerContent, "content rendered");
@@ -0,0 +1,13 @@
1
+ {
2
+ "extends": "@ui5/webcomponents-tools/tsconfig.json",
3
+ "include": [
4
+ "src/**/*",
5
+ "global.d.ts"
6
+ ],
7
+ "compilerOptions": {
8
+ "outDir": "dist",
9
+ "experimentalDecorators": true,
10
+ "module": "NodeNext",
11
+ "moduleResolution": "NodeNext",
12
+ },
13
+ }