@ui5/create-webcomponents-package 0.0.0-037d08c67
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 +2094 -0
- package/LICENSE.txt +201 -0
- package/README.md +53 -0
- package/create-package.js +297 -0
- package/package.json +26 -0
- package/template/cypress/component/MyFirstComponent.cy.tsx +13 -0
- package/template/cypress/fixtures/example.json +5 -0
- package/template/cypress/support/commands.ts +37 -0
- package/template/cypress/support/component-index.html +12 -0
- package/template/cypress/support/component.ts +36 -0
- package/template/cypress/tsconfig.template.json +19 -0
- package/template/cypress.config.ts +10 -0
- package/template/env +1 -0
- package/template/eslintignore +7 -0
- package/template/eslintrc.cjs +5 -0
- package/template/gitignore +4 -0
- package/template/npmignore +6 -0
- package/template/npmrc +2 -0
- package/template/npsrc.json +3 -0
- package/template/package-scripts.cjs +11 -0
- package/template/package.json +35 -0
- package/template/src/Assets.ts +5 -0
- package/template/src/MyFirstComponent.ts +56 -0
- package/template/src/MyFirstComponentTemplate.tsx +9 -0
- package/template/src/bundle.esm.ts +30 -0
- package/template/src/i18n/messagebundle.properties +3 -0
- package/template/src/i18n/messagebundle_de.properties +1 -0
- package/template/src/i18n/messagebundle_en.properties +1 -0
- package/template/src/i18n/messagebundle_es.properties +1 -0
- package/template/src/i18n/messagebundle_fr.properties +1 -0
- package/template/src/themes/MyFirstComponent.css +17 -0
- package/template/src/themes/sap_horizon/parameters-bundle.css +3 -0
- 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/src/themes/sap_horizon_hcw/parameters-bundle.css +3 -0
- package/template/test/pages/css/index.css +89 -0
- package/template/test/pages/img/logo.png +0 -0
- package/template/test/pages/index.html +53 -0
- package/template/tsconfig.template.json +14 -0
- package/template/vite.config.js +14 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// ***********************************************************
|
|
2
|
+
// This example support/component.ts is processed and
|
|
3
|
+
// loaded automatically before your test files.
|
|
4
|
+
//
|
|
5
|
+
// This is a great place to put global configuration and
|
|
6
|
+
// behavior that modifies Cypress.
|
|
7
|
+
//
|
|
8
|
+
// You can change the location of this file or turn off
|
|
9
|
+
// automatically serving support files with the
|
|
10
|
+
// 'supportFile' configuration option.
|
|
11
|
+
//
|
|
12
|
+
// You can read more here:
|
|
13
|
+
// https://on.cypress.io/configuration
|
|
14
|
+
// ***********************************************************
|
|
15
|
+
|
|
16
|
+
// Import commands.js using ES2015 syntax:
|
|
17
|
+
import './commands'
|
|
18
|
+
|
|
19
|
+
import { mount } from '@ui5/cypress-ct-ui5-webc'
|
|
20
|
+
|
|
21
|
+
// Augment the Cypress namespace to include type definitions for
|
|
22
|
+
// your custom command.
|
|
23
|
+
// Alternatively, can be defined in cypress/support/component.d.ts
|
|
24
|
+
// with a <reference path="./component" /> at the top of your spec.
|
|
25
|
+
declare global {
|
|
26
|
+
namespace Cypress {
|
|
27
|
+
interface Chainable {
|
|
28
|
+
mount: typeof mount
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Cypress.Commands.add('mount', mount)
|
|
34
|
+
|
|
35
|
+
// Example use:
|
|
36
|
+
// cy.mount(MyComponent)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": [
|
|
3
|
+
"./**/*"
|
|
4
|
+
],
|
|
5
|
+
"compilerOptions": {
|
|
6
|
+
"module": "NodeNext",
|
|
7
|
+
"moduleResolution": "nodenext",
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"jsxImportSource": "@ui5/webcomponents-base",
|
|
10
|
+
"types": [
|
|
11
|
+
"cypress"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"references": [
|
|
15
|
+
{
|
|
16
|
+
"path": "../"
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
package/template/env
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VITE_BUNDLE_PATH="../../dist/bundle.esm.js"
|
|
@@ -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/npmrc
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{INIT_PACKAGE_VAR_NAME}}",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"ui5": {
|
|
5
|
+
"webComponentsPackage": true
|
|
6
|
+
},
|
|
7
|
+
"type": "module",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"clean": "wc-dev clean",
|
|
10
|
+
"lint": "wc-dev lint",
|
|
11
|
+
"start": "wc-dev start",
|
|
12
|
+
"watch": "wc-dev watch",
|
|
13
|
+
"build": "wc-dev build",
|
|
14
|
+
{{INIT_PACKAGE_CYPRESS_TEST_COMMANDS}}
|
|
15
|
+
"create-ui5-element": "wc-create-ui5-element",
|
|
16
|
+
"prepublishOnly": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
"./src/*": "./src/*",
|
|
20
|
+
"./dist/*": "./dist/*",
|
|
21
|
+
"./package.json": "./package.json",
|
|
22
|
+
"./bundle.js": "./bundle.js",
|
|
23
|
+
"./*": "./dist/*"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@ui5/webcomponents-base": "{{INIT_PACKAGE_VERSION}}",
|
|
27
|
+
"@ui5/webcomponents-theming": "{{INIT_PACKAGE_VERSION}}"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
{{INIT_PACKAGE_CYPRESS_DEV_DEPS}}
|
|
31
|
+
"@ui5/webcomponents-tools": "{{INIT_PACKAGE_VERSION}}",
|
|
32
|
+
"chromedriver": "*",
|
|
33
|
+
"typescript": "^5.6.2"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -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_NAME}}Template from "./{{INIT_PACKAGE_VAR_CLASS_NAME}}Template.js";
|
|
10
|
+
|
|
11
|
+
// Styles
|
|
12
|
+
import {{INIT_PACKAGE_VAR_CLASS_NAME}}Css 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_NAME}}Css,
|
|
31
|
+
template: {{INIT_PACKAGE_VAR_CLASS_NAME}}Template,
|
|
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_NAME}}Template(this: {{INIT_PACKAGE_VAR_CLASS_NAME}}) {
|
|
4
|
+
return (
|
|
5
|
+
<div class="root" onClick={this.onClick}>
|
|
6
|
+
{this.counterText} :: {this.count}
|
|
7
|
+
</div>
|
|
8
|
+
);
|
|
9
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { getFirstDayOfWeek } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
|
|
10
|
+
|
|
11
|
+
// Enable additional themes and i18n texts
|
|
12
|
+
import "./Assets.js";
|
|
13
|
+
|
|
14
|
+
// Import your web components here from the src/ directory
|
|
15
|
+
import "./{{INIT_PACKAGE_VAR_CLASS_NAME}}.js";
|
|
16
|
+
|
|
17
|
+
// @ts-expect-error
|
|
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
|
+
getFirstDayOfWeek,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
COUNT=Zählung
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
COUNT=Count
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
COUNT=Cuenta
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
COUNT=Comte
|
|
@@ -0,0 +1,17 @@
|
|
|
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;
|
|
17
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
body {
|
|
2
|
+
color: var(--sapTextColor);
|
|
3
|
+
background-color: var(--sapBackgroundColor);
|
|
4
|
+
font-size: var(--sapFontSize);
|
|
5
|
+
font-family: var(--sapFontFamily);
|
|
6
|
+
padding: 2rem;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
h1 {
|
|
10
|
+
font-size: var(--sapFontHeader2Size);
|
|
11
|
+
margin-bottom: 0.5rem;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
h2 {
|
|
15
|
+
font-size: var(--sapFontHeader4Size);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
a {
|
|
19
|
+
margin: 0.25rem;
|
|
20
|
+
padding: 0.5rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
a.link {
|
|
24
|
+
color: var(--sapLinkColor);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
a.theme-link {
|
|
28
|
+
color: var(--sapButton_Emphasized_TextColor);
|
|
29
|
+
background-color: var(--sapButton_Emphasized_Background);
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
border-radius: 0.25rem;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
a.lang-link {
|
|
35
|
+
color: var(--sapButton_Attention_TextColor);
|
|
36
|
+
background-color: var(--sapButton_Attention_Background);
|
|
37
|
+
text-decoration: none;
|
|
38
|
+
border-radius: 0.25rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.app {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.app-nav {
|
|
48
|
+
display: flex;
|
|
49
|
+
width: 100%;
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
justify-content: flex-end;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.app-logo {
|
|
55
|
+
height: 5rem;
|
|
56
|
+
width: 5rem;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.app-header {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: row;
|
|
62
|
+
align-items: center;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.app-main {
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: row;
|
|
68
|
+
align-items: flex-start;
|
|
69
|
+
padding-top: 2rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.app-main-demo {
|
|
73
|
+
padding: 2rem;
|
|
74
|
+
border-radius: 0.5rem;
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
background-color: var(--sapTile_Background);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.app-main-settings {
|
|
80
|
+
display: flex;
|
|
81
|
+
flex-direction: column;
|
|
82
|
+
padding: 0 2rem;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@media (max-width: 768px) {
|
|
86
|
+
.app-main {
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>UI5 Web Components</title>
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8
|
+
<meta charset="utf-8">
|
|
9
|
+
<link rel="stylesheet" type="text/css" href="./css/index.css">
|
|
10
|
+
<script src="%VITE_BUNDLE_PATH%" type="module"></script>
|
|
11
|
+
</head>
|
|
12
|
+
|
|
13
|
+
<body>
|
|
14
|
+
<div class="app">
|
|
15
|
+
<nav class="app-nav">
|
|
16
|
+
<a class="link" href="https://ui5.github.io/webcomponents/">Website</a>
|
|
17
|
+
<a class="link" href="https://ui5.github.io/webcomponents/components/">Components</a>
|
|
18
|
+
<a class="link" href="https://ui5.github.io/webcomponents/docs/development/package/">Development</a>
|
|
19
|
+
</nav>
|
|
20
|
+
|
|
21
|
+
<header class="app-header">
|
|
22
|
+
<a href="https://ui5.github.io/webcomponents/" target="_blank"><img src="./img/logo.png" class="app-logo" alt="logo"/></a>
|
|
23
|
+
<h1>UI5 Web Components</h1>
|
|
24
|
+
</header>
|
|
25
|
+
|
|
26
|
+
<main class="app-main">
|
|
27
|
+
<div class="app-main-demo">
|
|
28
|
+
<h2>Congrats! It's your First Web Component 🎉</h2>
|
|
29
|
+
<div> <pre><{{INIT_PACKAGE_VAR_TAG}}></{{INIT_PACKAGE_VAR_TAG}}> </pre></div>
|
|
30
|
+
<{{INIT_PACKAGE_VAR_TAG}} id="myFirstComponent"></{{INIT_PACKAGE_VAR_TAG}}>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div class="app-main-settings">
|
|
34
|
+
<h3>Switch theme</h3>
|
|
35
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr;">
|
|
36
|
+
<a class="link theme-link" href="?sap-ui-theme=sap_horizon">Horizon Morning</a>
|
|
37
|
+
<a class="link theme-link" href="?sap-ui-theme=sap_horizon_dark">Horizon Evening</a>
|
|
38
|
+
<a class="link theme-link" href="?sap-ui-theme=sap_horizon_hcb">High Contrast Black</a>
|
|
39
|
+
<a class="link theme-link" href="?sap-ui-theme=sap_horizon_hcw">High Contrast White</a>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<h3>Switch language</h3>
|
|
43
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr;">
|
|
44
|
+
<a class="link lang-link" href="?sap-ui-language=en">English</a>
|
|
45
|
+
<a class="link lang-link" href="?sap-ui-language=de">German</a>
|
|
46
|
+
<a class="link lang-link" href="?sap-ui-language=es">Spanish</a>
|
|
47
|
+
<a class="link lang-link" href="?sap-ui-language=fr">French</a>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</main>
|
|
51
|
+
</div>
|
|
52
|
+
</body>
|
|
53
|
+
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@ui5/webcomponents-tools/tsconfig.json",
|
|
3
|
+
"include": [
|
|
4
|
+
"src/**/*",
|
|
5
|
+
"global.d.ts"
|
|
6
|
+
],
|
|
7
|
+
"compilerOptions": {
|
|
8
|
+
{{INIT_PACKAGE_CYPRESS_ROOT_TSCONFIG}}
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"experimentalDecorators": true,
|
|
11
|
+
"module": "NodeNext",
|
|
12
|
+
"moduleResolution": "NodeNext"
|
|
13
|
+
},
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import viteConfig from "@ui5/webcomponents-tools/components-package/vite.config.js"; //eslint-disable-line
|
|
2
|
+
|
|
3
|
+
// Modifying the default Vite configuration provided by the @ui5/webcomponents-tools package.
|
|
4
|
+
// You can directly access and update the properties you need to change.
|
|
5
|
+
// Ensure that the property exists before modifying it to avoid unintended errors.
|
|
6
|
+
// For available configuration options, refer to: https://vite.dev/config/#configuring-vite
|
|
7
|
+
//
|
|
8
|
+
// Ensure the plugins array exists
|
|
9
|
+
// viteConfig.plugins = viteConfig.plugins || [];
|
|
10
|
+
//
|
|
11
|
+
// Push a new fake plugin
|
|
12
|
+
// viteConfig.plugins.push({ name: 'my-custom-plugin' });
|
|
13
|
+
|
|
14
|
+
export default viteConfig;
|