@ui5/create-webcomponents-package 0.0.0-4b9b0ab7c → 0.0.0-4e88b8243
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 +1241 -0
- package/README.md +6 -8
- package/create-package.js +65 -57
- package/package.json +1 -1
- package/template/.eslintignore +1 -1
- package/template/.eslintrc.cjs +5 -0
- package/template/.npsrc.json +3 -0
- package/template/bundle.esm.js +0 -2
- package/template/gitignore +3 -0
- package/template/npmrc +2 -0
- package/template/{package-scripts.js → package-scripts.cjs} +0 -1
- package/template/src/MyFirstComponent.ts +20 -9
- package/template/src/MyFirstComponentTemplate.tsx +9 -0
- package/template/src/i18n/messagebundle.properties +3 -2
- package/template/src/i18n/messagebundle_de.properties +1 -1
- package/template/src/i18n/messagebundle_en.properties +1 -1
- package/template/src/i18n/messagebundle_es.properties +1 -1
- package/template/src/i18n/messagebundle_fr.properties +1 -1
- package/template/src/themes/MyFirstComponent.css +16 -10
- package/template/src/themes/sap_fiori_3/parameters-bundle.css +1 -1
- package/template/src/themes/sap_horizon_dark/parameters-bundle.css +3 -0
- package/template/src/themes/sap_horizon_hcb/parameters-bundle.css +3 -0
- package/template/test/pages/css/index.css +41 -0
- package/template/test/pages/img/logo.png +0 -0
- package/template/test/pages/index.html +35 -30
- package/template/test/specs/Demo.spec.js +4 -3
- package/template/tsconfig.json +12 -13
- package/template/config/postcss.components/postcss.config.js +0 -1
- package/template/config/postcss.themes/postcss.config.js +0 -1
- package/template/global.d.ts +0 -12
- package/template/src/Assets.js +0 -5
- package/template/src/MyFirstComponent.hbs +0 -1
- package/template/src/MyFirstComponent.js +0 -67
- package/template/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
- package/template/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
- package/template/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
- package/template/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
- /package/template/config/{wdio.conf.js → wdio.conf.cjs} +0 -0
- /package/template/src/themes/{sap_belize → sap_horizon}/parameters-bundle.css +0 -0
- /package/template/src/themes/{sap_belize_hcb → sap_horizon_hcw}/parameters-bundle.css +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
UI5 Web Components - Create Package
|
|
4
2
|
|
|
5
3
|
[](https://www.npmjs.com/package/@ui5/webcomponents)
|
|
6
4
|
|
|
@@ -18,8 +16,8 @@ Usage:
|
|
|
18
16
|
|
|
19
17
|
Options:
|
|
20
18
|
--name <string> - defines the package name
|
|
21
|
-
--
|
|
22
|
-
--
|
|
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.
|
|
23
21
|
--skip - skips configuration and generates package with a default value for each parameter that wasn't passed
|
|
24
22
|
```
|
|
25
23
|
|
|
@@ -33,8 +31,8 @@ Usage:
|
|
|
33
31
|
yarn create @ui5/webcomponents-package [OPTIONS]
|
|
34
32
|
Options:
|
|
35
33
|
--name <string> - defines the package name
|
|
34
|
+
--component-name <string> - defines the component class name that will be created in your new package
|
|
36
35
|
--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
36
|
--skip - skips configuration and generates package with a default value for each parameter that wasn't passed
|
|
39
37
|
```
|
|
40
38
|
|
|
@@ -44,10 +42,10 @@ components package.
|
|
|
44
42
|
## Resources
|
|
45
43
|
- [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
|
|
46
44
|
- [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/
|
|
45
|
+
- [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/play/)
|
|
48
46
|
|
|
49
47
|
## 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://
|
|
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/).
|
|
51
49
|
|
|
52
50
|
## Contribute
|
|
53
51
|
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
|
package/create-package.js
CHANGED
|
@@ -15,22 +15,33 @@ const version = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"))
|
|
|
15
15
|
// from where all the files will be copied
|
|
16
16
|
const TEMPLATE_DIR = path.join(`${__dirname}`, `template/`);
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
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("");
|
|
18
|
+
const isGitIgnore = sourcePath => {
|
|
19
|
+
return sourcePath.includes("gitignore");
|
|
25
20
|
};
|
|
26
|
-
const
|
|
27
|
-
return
|
|
21
|
+
const isLogo = sourcePath => {
|
|
22
|
+
return sourcePath.includes("logo");
|
|
23
|
+
};
|
|
24
|
+
const isNPMRC = sourcePath => {
|
|
25
|
+
return sourcePath.includes("npmrc");
|
|
28
26
|
};
|
|
29
27
|
|
|
30
28
|
// Validation of user input
|
|
31
|
-
const
|
|
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
32
|
const isTagValid = tag => typeof tag === "string" && tag.match(/^[a-z0-9]+?-[a-zA-Z0-9\-_]+?[a-z0-9]$/);
|
|
33
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
|
+
|
|
34
45
|
// Utils for building the file structure
|
|
35
46
|
const replaceVarsInFileContent = (vars, content) => {
|
|
36
47
|
for (let key in vars) {
|
|
@@ -45,17 +56,26 @@ const replaceVarsInFileName = (vars, fileName) => {
|
|
|
45
56
|
};
|
|
46
57
|
|
|
47
58
|
const copyFile = (vars, sourcePath, destPath) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (ignoreJsRelated || ignoreTsRelated) {
|
|
59
|
+
if (isLogo(sourcePath)) {
|
|
60
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
52
61
|
return;
|
|
53
62
|
}
|
|
54
63
|
|
|
55
64
|
let content = fs.readFileSync(sourcePath, { encoding: "UTF-8" });
|
|
56
65
|
content = replaceVarsInFileContent(vars, content);
|
|
57
66
|
destPath = replaceVarsInFileName(vars, destPath);
|
|
67
|
+
|
|
58
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
|
+
}
|
|
59
79
|
};
|
|
60
80
|
|
|
61
81
|
const copyFiles = (vars, sourcePath, destPath) => {
|
|
@@ -72,23 +92,23 @@ const copyFiles = (vars, sourcePath, destPath) => {
|
|
|
72
92
|
}
|
|
73
93
|
};
|
|
74
94
|
|
|
75
|
-
const generateFilesContent = (
|
|
76
|
-
const
|
|
95
|
+
const generateFilesContent = (packageName, componentName, skipSubfolder) => {
|
|
96
|
+
const tagName = argv.tag || hyphaneteComponentName(componentName);
|
|
77
97
|
|
|
78
98
|
// All variables that will be replaced in the content of the resources/
|
|
79
99
|
const vars = {
|
|
80
|
-
INIT_PACKAGE_VAR_NAME:
|
|
81
|
-
INIT_PACKAGE_VAR_TAG:
|
|
82
|
-
INIT_PACKAGE_VAR_CLASS_NAME:
|
|
83
|
-
INIT_PACKAGE_VAR_TYPESCRIPT: typescript,
|
|
100
|
+
INIT_PACKAGE_VAR_NAME: packageName,
|
|
101
|
+
INIT_PACKAGE_VAR_TAG: tagName,
|
|
102
|
+
INIT_PACKAGE_VAR_CLASS_NAME: componentName,
|
|
84
103
|
};
|
|
85
104
|
|
|
86
105
|
const packageContent = {
|
|
87
|
-
name,
|
|
106
|
+
name: packageName,
|
|
88
107
|
version: "0.0.1",
|
|
89
108
|
ui5: {
|
|
90
109
|
webComponentsPackage: true,
|
|
91
110
|
},
|
|
111
|
+
type: "module",
|
|
92
112
|
scripts: {
|
|
93
113
|
"clean": "wc-dev clean",
|
|
94
114
|
"lint": "wc-dev lint",
|
|
@@ -113,18 +133,21 @@ const generateFilesContent = (name, tag, typescript) => {
|
|
|
113
133
|
"devDependencies": {
|
|
114
134
|
"@ui5/webcomponents-tools": version,
|
|
115
135
|
"chromedriver": "*",
|
|
136
|
+
"typescript": "^5.6.2"
|
|
116
137
|
},
|
|
117
138
|
};
|
|
118
139
|
|
|
119
140
|
// Update package.json
|
|
120
|
-
|
|
141
|
+
let destDir = packageName.includes("@") ? packageName.slice(packageName.lastIndexOf("/") + 1) : packageName;
|
|
142
|
+
|
|
143
|
+
destDir = skipSubfolder ? path.join("./") : path.join("./", destDir);
|
|
121
144
|
mkdirp.sync(destDir);
|
|
122
145
|
fs.writeFileSync(path.join(destDir, "package.json"), JSON.stringify(packageContent, null, 2));
|
|
123
146
|
// Copy files
|
|
124
147
|
copyFiles(vars, TEMPLATE_DIR, destDir);
|
|
125
148
|
|
|
126
149
|
console.log("\nPackage successfully created!\nNext steps:\n");
|
|
127
|
-
console.log(`$ cd ${
|
|
150
|
+
console.log(`$ cd ${destDir}`);
|
|
128
151
|
|
|
129
152
|
let userAgentInfo;
|
|
130
153
|
try {
|
|
@@ -145,20 +168,24 @@ const generateFilesContent = (name, tag, typescript) => {
|
|
|
145
168
|
// Main function
|
|
146
169
|
const createWebcomponentsPackage = async () => {
|
|
147
170
|
let response;
|
|
148
|
-
if (argv.name && !
|
|
149
|
-
throw new Error("The package name should be a string
|
|
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.");
|
|
150
177
|
}
|
|
151
178
|
|
|
152
179
|
if (argv.tag && !isTagValid(argv.tag) ) {
|
|
153
|
-
throw new Error("The tag should be in kebab-case (my-
|
|
180
|
+
throw new Error("The tag should be in kebab-case (f.e my-component) and it can't be a single word.");
|
|
154
181
|
}
|
|
155
182
|
|
|
156
|
-
let
|
|
157
|
-
let
|
|
158
|
-
|
|
183
|
+
let packageName = argv.name || "my-package";
|
|
184
|
+
let componentName = argv.componentName || "MyComponent";
|
|
185
|
+
const skipSubfolder = !!argv.skipSubfolder;
|
|
159
186
|
|
|
160
187
|
if (argv.skip) {
|
|
161
|
-
return generateFilesContent(
|
|
188
|
+
return generateFilesContent(packageName, componentName, skipSubfolder);
|
|
162
189
|
}
|
|
163
190
|
|
|
164
191
|
if (!argv.name) {
|
|
@@ -166,42 +193,23 @@ const createWebcomponentsPackage = async () => {
|
|
|
166
193
|
type: "text",
|
|
167
194
|
name: "name",
|
|
168
195
|
message: "Package name:",
|
|
169
|
-
validate:
|
|
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
|
-
],
|
|
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, _, -].",
|
|
189
197
|
});
|
|
190
|
-
|
|
198
|
+
packageName = response.name;
|
|
191
199
|
}
|
|
192
200
|
|
|
193
|
-
if (!argv.
|
|
201
|
+
if (!argv.componentName) {
|
|
194
202
|
response = await prompts({
|
|
195
203
|
type: "text",
|
|
196
|
-
name: "
|
|
204
|
+
name: "componentName",
|
|
197
205
|
message: "Component name:",
|
|
198
|
-
initial: "
|
|
199
|
-
validate:
|
|
206
|
+
initial: "MyComponent",
|
|
207
|
+
validate: (value) => isComponentNameValid(value) ? true : "Component name should follow PascalCase naming convention (f.e. Button, MyButton, etc.).",
|
|
200
208
|
});
|
|
201
|
-
|
|
209
|
+
componentName = response.componentName;
|
|
202
210
|
}
|
|
203
211
|
|
|
204
|
-
return generateFilesContent(
|
|
212
|
+
return generateFilesContent(packageName, componentName, skipSubfolder);
|
|
205
213
|
};
|
|
206
214
|
|
|
207
215
|
createWebcomponentsPackage();
|
package/package.json
CHANGED
package/template/.eslintignore
CHANGED
|
@@ -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;
|
package/template/bundle.esm.js
CHANGED
|
@@ -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
|
};
|
package/template/npmrc
ADDED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
2
2
|
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
|
3
|
-
import
|
|
3
|
+
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
4
|
+
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
|
4
5
|
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
5
6
|
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
6
7
|
|
|
7
8
|
// Template
|
|
8
|
-
import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./
|
|
9
|
+
import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./INIT_PACKAGE_VAR_CLASS_NAMETemplate.js";
|
|
9
10
|
|
|
10
11
|
// Styles
|
|
11
12
|
import INIT_PACKAGE_VAR_CLASS_NAMECss from "./generated/themes/INIT_PACKAGE_VAR_CLASS_NAME.css.js";
|
|
12
13
|
|
|
13
|
-
import {
|
|
14
|
+
import { COUNT } from "./generated/i18n/i18n-defaults.js";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* @class
|
|
@@ -20,14 +21,12 @@ import { PLEASE_WAIT } from "./generated/i18n/i18n-defaults.js";
|
|
|
20
21
|
* The <code>INIT_PACKAGE_VAR_TAG</code> component is a demo component that displays some text.
|
|
21
22
|
*
|
|
22
23
|
* @constructor
|
|
23
|
-
* @
|
|
24
|
-
* @extends sap.ui.webc.base.UI5Element
|
|
25
|
-
* @tagname INIT_PACKAGE_VAR_TAG
|
|
24
|
+
* @extends UI5Element
|
|
26
25
|
* @public
|
|
27
26
|
*/
|
|
28
27
|
@customElement({
|
|
29
28
|
tag: "INIT_PACKAGE_VAR_TAG",
|
|
30
|
-
renderer:
|
|
29
|
+
renderer: jsxRenderer,
|
|
31
30
|
styles: INIT_PACKAGE_VAR_CLASS_NAMECss,
|
|
32
31
|
template: INIT_PACKAGE_VAR_CLASS_NAMETemplate,
|
|
33
32
|
})
|
|
@@ -38,8 +37,20 @@ class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
|
|
|
38
37
|
INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle = await getI18nBundle("INIT_PACKAGE_VAR_NAME");
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Defines the component count.
|
|
42
|
+
* @default 0
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
@property({ type: Number })
|
|
46
|
+
count = 0;
|
|
47
|
+
|
|
48
|
+
onClick() {
|
|
49
|
+
this.count++;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get counterText() {
|
|
53
|
+
return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(COUNT);
|
|
43
54
|
}
|
|
44
55
|
}
|
|
45
56
|
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# the "counter" text for the sample component
|
|
2
|
+
COUNT=Count
|
|
3
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
COUNT=Zählung
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
COUNT=Count
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
COUNT=Cuenta
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
COUNT=Comte
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
}
|
|
@@ -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
|
|
@@ -10,43 +10,48 @@
|
|
|
10
10
|
|
|
11
11
|
<script data-ui5-config type="application/json">
|
|
12
12
|
{
|
|
13
|
+
"theme": "sap_horizon_dark",
|
|
13
14
|
"language": "EN"
|
|
14
15
|
}
|
|
15
16
|
</script>
|
|
16
17
|
|
|
18
|
+
<link rel="stylesheet" type="text/css" href="./css/index.css">
|
|
17
19
|
<script src="../../bundle.esm.js" type="module"></script>
|
|
18
|
-
|
|
19
|
-
<style>
|
|
20
|
-
code { color: blue; font-size: small; }
|
|
21
|
-
</style>
|
|
22
|
-
|
|
23
20
|
</head>
|
|
24
21
|
|
|
25
22
|
<body>
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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><INIT_PACKAGE_VAR_TAG></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>
|
|
50
56
|
</body>
|
|
51
|
-
|
|
52
57
|
</html>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { assert } from "chai";
|
|
2
2
|
|
|
3
3
|
describe("INIT_PACKAGE_VAR_TAG rendering", async () => {
|
|
4
|
-
|
|
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");
|
package/template/tsconfig.json
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
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
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("@ui5/webcomponents-tools/components-package/postcss.components.js"); // eslint-disable-line
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require("@ui5/webcomponents-tools/components-package/postcss.themes.js"); // eslint-disable-line
|
package/template/global.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|