@ui5/create-webcomponents-package 0.0.0-5e31d3069 → 0.0.0-64a57f090
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 +222 -0
- package/README.md +3 -1
- package/create-package.js +45 -22
- package/package.json +1 -1
- package/template/src/MyFirstComponent.hbs +1 -1
- package/template/src/MyFirstComponent.js +20 -5
- package/template/src/MyFirstComponent.ts +19 -4
- 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 +14 -9
- package/template/src/themes/sap_fiori_3/parameters-bundle.css +1 -1
- package/template/src/themes/sap_horizon_dark/parameters-bundle.css +1 -1
- package/template/test/pages/css/index.css +36 -0
- package/template/test/pages/img/logo.png +0 -0
- package/template/test/pages/index.html +35 -31
- package/template/test/specs/Demo.spec.js +0 -1
- package/template/global.d.ts +0 -12
- 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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,228 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [1.18.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.18.0-rc.1...v1.18.0-rc.2) (2023-09-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.18.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.18.0-rc.0...v1.18.0-rc.1) (2023-09-21)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [1.18.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0...v1.18.0-rc.0) (2023-09-07)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# [1.17.0](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.2...v1.17.0) (2023-09-01)
|
|
31
|
+
|
|
32
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# [1.17.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.1...v1.17.0-rc.2) (2023-08-24)
|
|
39
|
+
|
|
40
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# [1.17.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.0...v1.17.0-rc.1) (2023-08-17)
|
|
47
|
+
|
|
48
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# [1.17.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0...v1.17.0-rc.0) (2023-08-10)
|
|
55
|
+
|
|
56
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# [1.16.0](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.4...v1.16.0) (2023-08-03)
|
|
63
|
+
|
|
64
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# [1.16.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.3...v1.16.0-rc.4) (2023-08-03)
|
|
71
|
+
|
|
72
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# [1.16.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.2...v1.16.0-rc.3) (2023-07-27)
|
|
79
|
+
|
|
80
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
# [1.16.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.1...v1.16.0-rc.2) (2023-07-20)
|
|
87
|
+
|
|
88
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# [1.16.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.0...v1.16.0-rc.1) (2023-07-13)
|
|
95
|
+
|
|
96
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# [1.16.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.15.1...v1.16.0-rc.0) (2023-07-06)
|
|
103
|
+
|
|
104
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
## [1.15.1](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0...v1.15.1) (2023-06-30)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Bug Fixes
|
|
114
|
+
|
|
115
|
+
* **framework:** fix links in starting page of new pkg [ci skip] ([475fed5](https://github.com/SAP/ui5-webcomponents/commit/475fed55504f4a15e8b26aaf3c9e4d73b55976ec))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
# [1.15.0](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0-rc.2...v1.15.0) (2023-06-30)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Bug Fixes
|
|
125
|
+
|
|
126
|
+
* fix image in `create-webcomponent-package` ([#7253](https://github.com/SAP/ui5-webcomponents/issues/7253)) ([3317e64](https://github.com/SAP/ui5-webcomponents/commit/3317e64b911f992abf34b88a48e6003a723f7b9e))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
# [1.15.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0-rc.1...v1.15.0-rc.2) (2023-06-22)
|
|
133
|
+
|
|
134
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# [1.15.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0-rc.0...v1.15.0-rc.1) (2023-06-15)
|
|
141
|
+
|
|
142
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
# [1.15.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0...v1.15.0-rc.0) (2023-06-08)
|
|
153
|
+
|
|
154
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
# [1.14.0](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0-rc.2...v1.14.0) (2023-06-01)
|
|
161
|
+
|
|
162
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
# [1.14.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0-rc.1...v1.14.0-rc.2) (2023-06-01)
|
|
169
|
+
|
|
170
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# [1.14.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0-rc.0...v1.14.0-rc.1) (2023-05-25)
|
|
177
|
+
|
|
178
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
# [1.14.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.13.2...v1.14.0-rc.0) (2023-05-18)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
### Features
|
|
188
|
+
|
|
189
|
+
* users can provide a JSDoc namespeace when creating a package ([#7034](https://github.com/SAP/ui5-webcomponents/issues/7034)) ([0af8d23](https://github.com/SAP/ui5-webcomponents/commit/0af8d2376e25e5abe6d940c72286ab7c682eea56))
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
## [1.13.1](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.5...v1.13.1) (2023-05-11)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
### Bug Fixes
|
|
199
|
+
|
|
200
|
+
* **create-package:** revert `moduleResolution` setting to `node` ([#7020](https://github.com/SAP/ui5-webcomponents/issues/7020)) ([9fc84e2](https://github.com/SAP/ui5-webcomponents/commit/9fc84e288452616ee72f3a2b6fc31d9752f05f6f))
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
# [1.13.0-rc.5](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.4...v1.13.0-rc.5) (2023-05-11)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
### Bug Fixes
|
|
210
|
+
|
|
211
|
+
* **create-webcomponents-package:** fix package creation issues with test and lint ([#6976](https://github.com/SAP/ui5-webcomponents/issues/6976)) ([dd70f3a](https://github.com/SAP/ui5-webcomponents/commit/dd70f3aa8ef70b592f1d4e0f3f9894c6280fb1bf))
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
# [1.13.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.3...v1.13.0-rc.4) (2023-05-04)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
### Features
|
|
221
|
+
|
|
222
|
+
* generate TS from HBS templates ([#6558](https://github.com/SAP/ui5-webcomponents/issues/6558)) ([02611b2](https://github.com/SAP/ui5-webcomponents/commit/02611b2e24b2c2a06129b8e60a8bc680d9501e39))
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
6
228
|
# [1.13.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.13.0-rc.2...v1.13.0-rc.3) (2023-04-27)
|
|
7
229
|
|
|
8
230
|
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
package/README.md
CHANGED
|
@@ -18,7 +18,8 @@ Usage:
|
|
|
18
18
|
|
|
19
19
|
Options:
|
|
20
20
|
--name <string> - defines the package name
|
|
21
|
-
--
|
|
21
|
+
--component-name <string> - defines the component class name that will be created in your new package
|
|
22
|
+
--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.
|
|
22
23
|
--enable-typescript - enables TypeScript support for the package
|
|
23
24
|
--skip - skips configuration and generates package with a default value for each parameter that wasn't passed
|
|
24
25
|
```
|
|
@@ -33,6 +34,7 @@ Usage:
|
|
|
33
34
|
yarn create @ui5/webcomponents-package [OPTIONS]
|
|
34
35
|
Options:
|
|
35
36
|
--name <string> - defines the package name
|
|
37
|
+
--component-name <string> - defines the component class name that will be created in your new package
|
|
36
38
|
--tag <string> - defines the tag name of the sample web component that will be created in your new package
|
|
37
39
|
--enable-typescript - enables TypeScript support for the package
|
|
38
40
|
--skip - skips configuration and generates package with a default value for each parameter that wasn't passed
|
package/create-package.js
CHANGED
|
@@ -16,13 +16,6 @@ const version = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"))
|
|
|
16
16
|
const TEMPLATE_DIR = path.join(`${__dirname}`, `template/`);
|
|
17
17
|
|
|
18
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
19
|
const isTSRelatedFile = sourcePath => {
|
|
27
20
|
return ["Assets.ts", "MyFirstComponent.ts", "tsconfig.json", "global.d.ts"].some(fileName => sourcePath.includes(fileName));
|
|
28
21
|
};
|
|
@@ -32,14 +25,19 @@ const isJSRelatedFile = sourcePath => {
|
|
|
32
25
|
const isGitIgnore = sourcePath => {
|
|
33
26
|
return sourcePath.includes("gitignore");
|
|
34
27
|
};
|
|
28
|
+
const isLogo = sourcePath => {
|
|
29
|
+
return sourcePath.includes("logo");
|
|
30
|
+
};
|
|
35
31
|
const isNPMRC = sourcePath => {
|
|
36
32
|
return sourcePath.includes("npmrc");
|
|
37
33
|
};
|
|
38
34
|
|
|
39
35
|
// Validation of user input
|
|
40
36
|
const ComponentNamePattern = /^[A-Z][A-Za-z0-9]+$/;
|
|
41
|
-
const
|
|
37
|
+
const NamespacePattern = /^[a-z][a-z0-9\.\-]+$/;
|
|
38
|
+
const isPackageNameValid = name => typeof name === "string" && name.match(/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/);
|
|
42
39
|
const isComponentNameValid = name => typeof name === "string" && ComponentNamePattern.test(name);
|
|
40
|
+
const isNamespaceValid = name => typeof name === "string" && NamespacePattern.test(name);
|
|
43
41
|
const isTagValid = tag => typeof tag === "string" && tag.match(/^[a-z0-9]+?-[a-zA-Z0-9\-_]+?[a-z0-9]$/);
|
|
44
42
|
|
|
45
43
|
/**
|
|
@@ -74,6 +72,11 @@ const copyFile = (vars, sourcePath, destPath) => {
|
|
|
74
72
|
return;
|
|
75
73
|
}
|
|
76
74
|
|
|
75
|
+
if (isLogo(sourcePath)) {
|
|
76
|
+
fs.copyFileSync(sourcePath, destPath);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
77
80
|
let content = fs.readFileSync(sourcePath, { encoding: "UTF-8" });
|
|
78
81
|
content = replaceVarsInFileContent(vars, content);
|
|
79
82
|
destPath = replaceVarsInFileName(vars, destPath);
|
|
@@ -105,17 +108,20 @@ const copyFiles = (vars, sourcePath, destPath) => {
|
|
|
105
108
|
}
|
|
106
109
|
};
|
|
107
110
|
|
|
108
|
-
const generateFilesContent = (
|
|
111
|
+
const generateFilesContent = (packageName, componentName, namespace, typescript, skipSubfolder) => {
|
|
112
|
+
const tagName = argv.tag || hyphaneteComponentName(componentName);
|
|
113
|
+
|
|
109
114
|
// All variables that will be replaced in the content of the resources/
|
|
110
115
|
const vars = {
|
|
111
|
-
|
|
116
|
+
INIT_PACKAGE_VAR_NAMESPACE: namespace, // namespace must be replaced before name
|
|
117
|
+
INIT_PACKAGE_VAR_NAME: packageName,
|
|
112
118
|
INIT_PACKAGE_VAR_TAG: tagName,
|
|
113
119
|
INIT_PACKAGE_VAR_CLASS_NAME: componentName,
|
|
114
120
|
INIT_PACKAGE_VAR_TYPESCRIPT: typescript,
|
|
115
121
|
};
|
|
116
122
|
|
|
117
123
|
const packageContent = {
|
|
118
|
-
name,
|
|
124
|
+
name: packageName,
|
|
119
125
|
version: "0.0.1",
|
|
120
126
|
ui5: {
|
|
121
127
|
webComponentsPackage: true,
|
|
@@ -152,14 +158,16 @@ const generateFilesContent = (name, componentName, tagName, typescript, skipSubf
|
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
// Update package.json
|
|
155
|
-
|
|
161
|
+
let destDir = packageName.includes("@") ? packageName.slice(packageName.lastIndexOf("/") + 1) : packageName;
|
|
162
|
+
|
|
163
|
+
destDir = skipSubfolder ? path.join("./") : path.join("./", destDir);
|
|
156
164
|
mkdirp.sync(destDir);
|
|
157
165
|
fs.writeFileSync(path.join(destDir, "package.json"), JSON.stringify(packageContent, null, 2));
|
|
158
166
|
// Copy files
|
|
159
167
|
copyFiles(vars, TEMPLATE_DIR, destDir);
|
|
160
168
|
|
|
161
169
|
console.log("\nPackage successfully created!\nNext steps:\n");
|
|
162
|
-
console.log(`$ cd ${
|
|
170
|
+
console.log(`$ cd ${destDir}`);
|
|
163
171
|
|
|
164
172
|
let userAgentInfo;
|
|
165
173
|
try {
|
|
@@ -180,26 +188,30 @@ const generateFilesContent = (name, componentName, tagName, typescript, skipSubf
|
|
|
180
188
|
// Main function
|
|
181
189
|
const createWebcomponentsPackage = async () => {
|
|
182
190
|
let response;
|
|
183
|
-
if (argv.name && !
|
|
184
|
-
throw new Error("The package name should be a string
|
|
191
|
+
if (argv.name && !isPackageNameValid(argv.name)) {
|
|
192
|
+
throw new Error("The package name should be a string, starting with letter and containing the following symbols [a-z, A-Z, 0-9].");
|
|
185
193
|
}
|
|
186
194
|
|
|
187
195
|
if (argv.componentName && !isComponentNameValid(argv.componentName)) {
|
|
188
196
|
throw new Error("The component name should be a string, starting with a capital letter [A-Z][a-z], for example: Button, MyButton, etc.");
|
|
189
197
|
}
|
|
190
198
|
|
|
199
|
+
if (argv.namespace && !isNamespaceValid(argv.namespace)) {
|
|
200
|
+
throw new Error("The JSDoc namespace must start with a letter and can only contain small-case letters, numbers, dots and dashes.");
|
|
201
|
+
}
|
|
202
|
+
|
|
191
203
|
if (argv.tag && !isTagValid(argv.tag) ) {
|
|
192
204
|
throw new Error("The tag should be in kebab-case (f.e my-component) and it can't be a single word.");
|
|
193
205
|
}
|
|
194
206
|
|
|
195
|
-
let
|
|
207
|
+
let packageName = argv.name || "my-package";
|
|
196
208
|
let componentName = argv.componentName || "MyComponent";
|
|
209
|
+
let namespace = argv.namespace || "demo.components";
|
|
197
210
|
let typescriptSupport = !!argv.enableTypescript;
|
|
198
|
-
const tagName = argv.tag || hyphaneteComponentName(componentName);
|
|
199
211
|
const skipSubfolder = !!argv.skipSubfolder;
|
|
200
212
|
|
|
201
213
|
if (argv.skip) {
|
|
202
|
-
return generateFilesContent(
|
|
214
|
+
return generateFilesContent(packageName, componentName, namespace, typescriptSupport, skipSubfolder);
|
|
203
215
|
}
|
|
204
216
|
|
|
205
217
|
if (!argv.name) {
|
|
@@ -207,9 +219,9 @@ const createWebcomponentsPackage = async () => {
|
|
|
207
219
|
type: "text",
|
|
208
220
|
name: "name",
|
|
209
221
|
message: "Package name:",
|
|
210
|
-
validate: (value) =>
|
|
222
|
+
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, _, -].",
|
|
211
223
|
});
|
|
212
|
-
|
|
224
|
+
packageName = response.name;
|
|
213
225
|
}
|
|
214
226
|
|
|
215
227
|
if (!typescriptSupport) {
|
|
@@ -237,12 +249,23 @@ const createWebcomponentsPackage = async () => {
|
|
|
237
249
|
name: "componentName",
|
|
238
250
|
message: "Component name:",
|
|
239
251
|
initial: "MyComponent",
|
|
240
|
-
validate: (value) => isComponentNameValid(value) ? true : "Component name should follow PascalCase
|
|
252
|
+
validate: (value) => isComponentNameValid(value) ? true : "Component name should follow PascalCase naming convention (f.e. Button, MyButton, etc.).",
|
|
241
253
|
});
|
|
242
254
|
componentName = response.componentName;
|
|
243
255
|
}
|
|
244
256
|
|
|
245
|
-
|
|
257
|
+
if (!argv.namespace) {
|
|
258
|
+
response = await prompts({
|
|
259
|
+
type: "text",
|
|
260
|
+
name: "namespace",
|
|
261
|
+
message: "JSDoc namespace:",
|
|
262
|
+
initial: "demo.components",
|
|
263
|
+
validate: (value) => isNamespaceValid(value) ? true : "The JSDoc namespace must start with a letter and can only contain small-case letters, numbers, dots and dashes.",
|
|
264
|
+
});
|
|
265
|
+
namespace = response.namespace;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return generateFilesContent(packageName, componentName, namespace, typescriptSupport, skipSubfolder);
|
|
246
269
|
};
|
|
247
270
|
|
|
248
271
|
createWebcomponentsPackage();
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<div>
|
|
1
|
+
<div @click="{{onClick}}">{{counterText}} :: {{count}}</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
|
2
2
|
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
|
|
3
3
|
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
4
|
+
import Integer from "@ui5/webcomponents-base/dist/types/Integer.js";
|
|
4
5
|
|
|
5
6
|
// Template
|
|
6
7
|
import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./generated/templates/INIT_PACKAGE_VAR_CLASS_NAMETemplate.lit.js";
|
|
@@ -8,14 +9,24 @@ import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./generated/templates/INIT_PACK
|
|
|
8
9
|
// Styles
|
|
9
10
|
import INIT_PACKAGE_VAR_CLASS_NAMECss from "./generated/themes/INIT_PACKAGE_VAR_CLASS_NAME.css.js";
|
|
10
11
|
|
|
11
|
-
import {
|
|
12
|
+
import { COUNT } from "./generated/i18n/i18n-defaults.js";
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @public
|
|
15
16
|
*/
|
|
16
17
|
const metadata = {
|
|
17
18
|
tag: "INIT_PACKAGE_VAR_TAG",
|
|
18
|
-
properties: {
|
|
19
|
+
properties: /** @lends INIT_PACKAGE_VAR_NAMESPACE.INIT_PACKAGE_VAR_CLASS_NAME.prototype */ {
|
|
20
|
+
/**
|
|
21
|
+
* Defines the count of the component.
|
|
22
|
+
* @type { sap.ui.webc.base.types.Integer }
|
|
23
|
+
* @defaultvalue 0
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
count: {
|
|
27
|
+
type: Integer,
|
|
28
|
+
defaultValue: 0,
|
|
29
|
+
},
|
|
19
30
|
},
|
|
20
31
|
slots: {
|
|
21
32
|
},
|
|
@@ -31,7 +42,7 @@ const metadata = {
|
|
|
31
42
|
* The <code>INIT_PACKAGE_VAR_TAG</code> component is a demo component that displays some text.
|
|
32
43
|
*
|
|
33
44
|
* @constructor
|
|
34
|
-
* @alias
|
|
45
|
+
* @alias INIT_PACKAGE_VAR_NAMESPACE.INIT_PACKAGE_VAR_CLASS_NAME
|
|
35
46
|
* @extends sap.ui.webc.base.UI5Element
|
|
36
47
|
* @tagname INIT_PACKAGE_VAR_TAG
|
|
37
48
|
* @public
|
|
@@ -57,8 +68,12 @@ class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
|
|
|
57
68
|
INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle = await getI18nBundle("INIT_PACKAGE_VAR_NAME");
|
|
58
69
|
}
|
|
59
70
|
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
onClick() {
|
|
72
|
+
this.count++;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get counterText() {
|
|
76
|
+
return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(COUNT);
|
|
62
77
|
}
|
|
63
78
|
}
|
|
64
79
|
|
|
@@ -1,8 +1,10 @@
|
|
|
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 property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
|
3
4
|
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
|
|
4
5
|
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
5
6
|
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
|
7
|
+
import Integer from "@ui5/webcomponents-base/dist/types/Integer.js";
|
|
6
8
|
|
|
7
9
|
// Template
|
|
8
10
|
import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./generated/templates/INIT_PACKAGE_VAR_CLASS_NAMETemplate.lit.js";
|
|
@@ -10,7 +12,7 @@ import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./generated/templates/INIT_PACK
|
|
|
10
12
|
// Styles
|
|
11
13
|
import INIT_PACKAGE_VAR_CLASS_NAMECss from "./generated/themes/INIT_PACKAGE_VAR_CLASS_NAME.css.js";
|
|
12
14
|
|
|
13
|
-
import {
|
|
15
|
+
import { COUNT } from "./generated/i18n/i18n-defaults.js";
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* @class
|
|
@@ -20,7 +22,7 @@ import { PLEASE_WAIT } from "./generated/i18n/i18n-defaults.js";
|
|
|
20
22
|
* The <code>INIT_PACKAGE_VAR_TAG</code> component is a demo component that displays some text.
|
|
21
23
|
*
|
|
22
24
|
* @constructor
|
|
23
|
-
* @alias
|
|
25
|
+
* @alias INIT_PACKAGE_VAR_NAMESPACE.INIT_PACKAGE_VAR_CLASS_NAME
|
|
24
26
|
* @extends sap.ui.webc.base.UI5Element
|
|
25
27
|
* @tagname INIT_PACKAGE_VAR_TAG
|
|
26
28
|
* @public
|
|
@@ -38,8 +40,21 @@ class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
|
|
|
38
40
|
INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle = await getI18nBundle("INIT_PACKAGE_VAR_NAME");
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Defines the component count.
|
|
45
|
+
* @name INIT_PACKAGE_VAR_NAMESPACE.INIT_PACKAGE_VAR_CLASS_NAME.prototype.count
|
|
46
|
+
* @public
|
|
47
|
+
* @type { sap.ui.webc.base.types.Integer }
|
|
48
|
+
*/
|
|
49
|
+
@property({ validator: Integer, defaultValue: 0 })
|
|
50
|
+
count!: number;
|
|
51
|
+
|
|
52
|
+
onClick() {
|
|
53
|
+
this.count++;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
get counterText() {
|
|
57
|
+
return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(COUNT);
|
|
43
58
|
}
|
|
44
59
|
}
|
|
45
60
|
|
|
@@ -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,16 @@
|
|
|
1
1
|
:host {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
|
11
16
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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-first-component {
|
|
26
|
+
margin-bottom: 3rem;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.app-docs {
|
|
30
|
+
margin-top: 3rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
a {
|
|
34
|
+
margin: 0.25rem;
|
|
35
|
+
color: var(--sapLinkColor);
|
|
36
|
+
}
|
|
Binary file
|
|
@@ -10,44 +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
|
-
|
|
50
|
-
|
|
23
|
+
<div class="app">
|
|
24
|
+
<a href="https://sap.github.io/ui5-webcomponents/playground/?path=/docs/docs-getting-started-first-steps--docs" target="_blank"><img src="./img/logo.png" 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/playground/?path=/docs/docs-development-custom-ui5-web-components-packages--docs">Custom Component Development</a>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
51
56
|
</body>
|
|
52
|
-
|
|
53
57
|
</html>
|
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
|
-
}
|