@sap-ux/ui5-library-writer 0.1.0

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 (53) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +48 -0
  3. package/dist/data/index.d.ts +9 -0
  4. package/dist/data/index.js +23 -0
  5. package/dist/data/validators.d.ts +36 -0
  6. package/dist/data/validators.js +101 -0
  7. package/dist/i18n.d.ts +14 -0
  8. package/dist/i18n.js +52 -0
  9. package/dist/index.d.ts +14 -0
  10. package/dist/index.js +54 -0
  11. package/dist/options/index.d.ts +2 -0
  12. package/dist/options/index.js +18 -0
  13. package/dist/options/typescript.d.ts +12 -0
  14. package/dist/options/typescript.js +92 -0
  15. package/dist/translations/ui5-library-writer.i18n.json +16 -0
  16. package/dist/types.d.ts +19 -0
  17. package/dist/types.js +3 -0
  18. package/package.json +59 -0
  19. package/templates/common/gitignore.tmpl +9 -0
  20. package/templates/common/karma.conf.tmpl +7 -0
  21. package/templates/common/package.json +19 -0
  22. package/templates/common/src/baselibrary/.library +14 -0
  23. package/templates/common/src/baselibrary/Example.gen.d.ts +33 -0
  24. package/templates/common/src/baselibrary/Example.js +68 -0
  25. package/templates/common/src/baselibrary/Example.ts +65 -0
  26. package/templates/common/src/baselibrary/ExampleRenderer.js +47 -0
  27. package/templates/common/src/baselibrary/ExampleRenderer.ts +41 -0
  28. package/templates/common/src/baselibrary/library.js +67 -0
  29. package/templates/common/src/baselibrary/library.ts +56 -0
  30. package/templates/common/src/baselibrary/messagebundle.properties +2 -0
  31. package/templates/common/src/baselibrary/themes/base/Example.less +19 -0
  32. package/templates/common/src/baselibrary/themes/base/library.source.less +4 -0
  33. package/templates/common/src/baselibrary/themes/sap_belize/library.source.less +3 -0
  34. package/templates/common/src/baselibrary/themes/sap_belize_hcb/library.source.less +3 -0
  35. package/templates/common/src/baselibrary/themes/sap_belize_hcw/library.source.less +3 -0
  36. package/templates/common/src/baselibrary/themes/sap_belize_plus/library.source.less +3 -0
  37. package/templates/common/src/baselibrary/themes/sap_fiori_3/library.source.less +3 -0
  38. package/templates/common/src/baselibrary/themes/sap_fiori_3_dark/library.source.less +3 -0
  39. package/templates/common/src/baselibrary/themes/sap_fiori_3_hcb/library.source.less +3 -0
  40. package/templates/common/src/baselibrary/themes/sap_fiori_3_hcw/library.source.less +3 -0
  41. package/templates/common/test/baselibrary/Example.html +20 -0
  42. package/templates/common/test/baselibrary/Example.js +18 -0
  43. package/templates/common/test/baselibrary/Example.ts +9 -0
  44. package/templates/common/test/baselibrary/qunit/Example.qunit.js +65 -0
  45. package/templates/common/test/baselibrary/qunit/Example.qunit.ts +68 -0
  46. package/templates/common/test/baselibrary/qunit/testsuite.qunit.html +13 -0
  47. package/templates/common/test/baselibrary/qunit/testsuite.qunit.js +35 -0
  48. package/templates/common/test/baselibrary/qunit/testsuite.qunit.ts +35 -0
  49. package/templates/common/ui5.yaml +19 -0
  50. package/templates/optional/typescript/.eslintrc +4 -0
  51. package/templates/optional/typescript/package.json +37 -0
  52. package/templates/optional/typescript/src/.babelrc.json +25 -0
  53. package/templates/optional/typescript/tsconfig.json +26 -0
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.enableTypescript = void 0;
13
+ const ejs_1 = require("ejs");
14
+ const project_access_1 = require("@sap-ux/project-access");
15
+ const ui5_config_1 = require("@sap-ux/ui5-config");
16
+ const path_1 = require("path");
17
+ const semver_1 = require("semver");
18
+ /**
19
+ * Enable typescript for the given input.
20
+ *
21
+ * @param libInput Input required to enable the optional typescript features
22
+ * @param basePath - the base path
23
+ * @param tmplPath - the template path
24
+ * @param fs - the memfs editor instance
25
+ */
26
+ function enableTypescript(libInput, basePath, tmplPath, fs) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const tsTmplDirPath = (0, path_1.join)(tmplPath, 'optional', 'typescript');
29
+ const tsTmplFilePaths = yield (0, project_access_1.getFilePaths)(tsTmplDirPath);
30
+ const tsLibInput = Object.assign(Object.assign({}, libInput), { tsTypes: getTypePackageFor(libInput.framework, libInput.frameworkVersion), tsTypesVersion: libInput.frameworkVersion });
31
+ tsTmplFilePaths.forEach((tsTmplFilePath) => {
32
+ const relPath = tsTmplFilePath.replace(tsTmplDirPath, '');
33
+ const outPath = (0, path_1.join)(basePath, relPath);
34
+ // Extend or add
35
+ if (!fs.exists(outPath)) {
36
+ fs.copyTpl(tsTmplFilePath, outPath, tsLibInput, undefined, {
37
+ globOptions: { dot: true }
38
+ });
39
+ }
40
+ else {
41
+ const add = JSON.parse((0, ejs_1.render)(fs.read(tsTmplFilePath), tsLibInput, {}));
42
+ const existingFile = JSON.parse(fs.read(outPath));
43
+ const merged = (0, ui5_config_1.mergeObjects)(existingFile, add);
44
+ fs.writeJSON(outPath, merged);
45
+ }
46
+ });
47
+ // ui5 yaml
48
+ const ui5ConfigPath = (0, path_1.join)(basePath, 'ui5.yaml');
49
+ const ui5Config = yield ui5_config_1.UI5Config.newInstance(fs.read(ui5ConfigPath));
50
+ ui5Config.updateCustomMiddleware({
51
+ name: 'fiori-tools-appreload',
52
+ afterMiddleware: 'compression',
53
+ configuration: {
54
+ path: 'src',
55
+ port: 35729,
56
+ delay: 300
57
+ }
58
+ });
59
+ ui5Config.updateCustomMiddleware({
60
+ name: 'ui5-tooling-transpile-middleware',
61
+ afterMiddleware: 'compression',
62
+ configuration: {
63
+ debug: true,
64
+ excludePatterns: ['/Component-preload.js']
65
+ }
66
+ });
67
+ ui5Config.addCustomTasks([
68
+ {
69
+ name: 'ui5-tooling-transpile-task',
70
+ afterTask: 'replaceVersion',
71
+ configuration: {
72
+ debug: true
73
+ }
74
+ }
75
+ ]);
76
+ // write ts ui5 yaml
77
+ fs.write(ui5ConfigPath, ui5Config.toString());
78
+ });
79
+ }
80
+ exports.enableTypescript = enableTypescript;
81
+ /**
82
+ * Returns the types package depending on ui5 version.
83
+ *
84
+ * @param framework SAPUI5 or OpenUI5
85
+ * @param version ui5 version
86
+ * @returns types package
87
+ */
88
+ function getTypePackageFor(framework, version) {
89
+ const typesName = (0, semver_1.gte)(version, '1.113.0') ? 'types' : 'ts-types-esm';
90
+ return `@${framework.toLowerCase()}/${typesName}`;
91
+ }
92
+ //# sourceMappingURL=typescript.js.map
@@ -0,0 +1,16 @@
1
+ {
2
+ "error": {
3
+ "missingRequiredProperty": "The property: {{ propertyName }} must have a value",
4
+ "useAlphaNumeric": "Please use lowercase alpha numeric characters only for the property {{ propertyName }}",
5
+ "invalidUI5Version": "The specified UI5 version is invalid: {{ version }}",
6
+ "invalidNamespace": {
7
+ "mustStartWithLetter": "The namespace must start with a letter",
8
+ "endsInPeriod": "The namespace cannot end with a period",
9
+ "isSap": "The namespace cannot be {{ str }}",
10
+ "startsWithNew": "The namespace cannot start with {{ str }}",
11
+ "numAfterPeriod": "A number cannot follow a period in the namespace",
12
+ "specialCharacter": "The namespace can only contain letters, digits, dots, and underscores",
13
+ "tooLong": "The combined length of the application namespace and module name must not exceed {{ length }} characters"
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,19 @@
1
+ export interface UI5LibConfig {
2
+ libraryName: string;
3
+ namespace: string;
4
+ framework: 'SAPUI5' | 'OpenUI5';
5
+ frameworkVersion: string;
6
+ author?: string;
7
+ typescript?: boolean;
8
+ }
9
+ export interface UI5LibInput extends UI5LibConfig {
10
+ namespaceURI: string;
11
+ libraryNamespace: string;
12
+ libraryNamespaceURI: string;
13
+ libraryBasepath: string;
14
+ }
15
+ export interface UI5LibInputTS extends UI5LibInput {
16
+ tsTypes: string;
17
+ tsTypesVersion: string;
18
+ }
19
+ //# sourceMappingURL=types.d.ts.map
package/dist/types.js ADDED
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@sap-ux/ui5-library-writer",
3
+ "description": "Writer module to generate a new ui5 library",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/SAP/open-ux-tools.git",
7
+ "directory": "packages/ui5-library-writer"
8
+ },
9
+ "bugs": {
10
+ "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Aui5-library-writer"
11
+ },
12
+ "version": "0.1.0",
13
+ "license": "Apache-2.0",
14
+ "main": "dist/index.js",
15
+ "files": [
16
+ "LICENSE",
17
+ "dist",
18
+ "templates",
19
+ "!dist/*.map",
20
+ "!dist/**/*.map"
21
+ ],
22
+ "engines": {
23
+ "pnpm": ">=6.26.1 < 7.0.0 || >=7.1.0",
24
+ "node": ">= 14.16.0 < 15.0.0 || >=16.1.0 < 17.0.0 || >=18.0.0 < 19.0.0"
25
+ },
26
+ "dependencies": {
27
+ "ejs": "3.1.7",
28
+ "i18next": "20.3.2",
29
+ "lodash": "4.17.21",
30
+ "mem-fs": "2.1.0",
31
+ "mem-fs-editor": "9.4.0",
32
+ "semver": "7.3.5",
33
+ "@sap-ux/project-access": "1.8.1",
34
+ "@sap-ux/ui5-application-writer": "0.23.1",
35
+ "@sap-ux/ui5-config": "0.17.1"
36
+ },
37
+ "devDependencies": {
38
+ "@types/ejs": "3.1.0",
39
+ "@types/fs-extra": "9.0.13",
40
+ "@types/lodash": "4.14.176",
41
+ "@types/mem-fs-editor": "7.0.1",
42
+ "@types/mem-fs": "1.1.2",
43
+ "fs-extra": "10.0.0",
44
+ "@types/semver": "7.3.9",
45
+ "@sap-ux/eslint-plugin-fiori-tools": "0.2.0"
46
+ },
47
+ "scripts": {
48
+ "build": "tsc --build",
49
+ "watch": "tsc --watch",
50
+ "clean": "rimraf dist test/test-output coverage *.tsbuildinfo",
51
+ "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
52
+ "lint": "eslint . --ext .ts",
53
+ "lint:fix": "eslint . --ext .ts --fix",
54
+ "test": "jest --ci --forceExit --detectOpenHandles --colors",
55
+ "test-u": "jest --ci --forceExit --detectOpenHandles --colors -u",
56
+ "link": "pnpm link --global",
57
+ "unlink": "pnpm unlink --global"
58
+ }
59
+ }
@@ -0,0 +1,9 @@
1
+ node_modules/
2
+ dist/
3
+ .scp/
4
+ Makefile*.mta
5
+ mta_archives
6
+ mta-*
7
+ resources
8
+ archive.zip
9
+ .*_mta_build_tmp
@@ -0,0 +1,7 @@
1
+ // karma-ui5 usage: https://github.com/SAP/karma-ui5
2
+ module.exports = function (config) {
3
+ config.set({
4
+ frameworks: ["ui5"],
5
+ browsers: ["Chrome"]
6
+ });
7
+ };
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "<%= libraryName %>",
3
+ "version": "1.0.0",
4
+ "private": true,
5
+ "devDependencies": {
6
+ "@ui5/cli": "^3.0.0",
7
+ "karma": "6.3.17",
8
+ "karma-chrome-launcher": "^3.1.1",
9
+ "karma-cli": "^2.0.0",
10
+ "karma-ui5": "^3.0.3",
11
+ "@sap/ux-ui5-tooling": "1"
12
+ },
13
+ "scripts": {
14
+ "build": "ui5 build --clean-dest",
15
+ "start": "fiori run --open test-resources/<%= libraryNamespaceURI %>/Example.html",
16
+ "testsuite": "fiori run --open test-resources/<%= libraryNamespaceURI %>/qunit/testsuite.qunit.html",
17
+ "test": "karma start --browsers=ChromeHeadless --singleRun=true"
18
+ }
19
+ }
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" ?>
2
+ <library xmlns="http://www.sap.com/sap.ui.library.xsd">
3
+ <name><%= libraryNamespace %></name>
4
+ <vendor><%= author %></vendor>
5
+ <version>${version}</version>
6
+ <copyright>${copyright}</copyright>
7
+ <title><%= libraryName %></title>
8
+ <documentation>Some description about <%= libraryName %></documentation>
9
+ <dependencies>
10
+ <dependency>
11
+ <libraryName>sap.ui.core</libraryName>
12
+ </dependency>
13
+ </dependencies>
14
+ </library>
@@ -0,0 +1,33 @@
1
+ import { ExampleColor } from "./library";
2
+ import Event from "sap/ui/base/Event";
3
+ import { PropertyBindingInfo } from "sap/ui/base/ManagedObject";
4
+ import { $ControlSettings } from "sap/ui/core/Control";
5
+
6
+ declare module "./Example" {
7
+
8
+ /**
9
+ * Interface defining the settings object used in constructor calls
10
+ */
11
+ interface $ExampleSettings extends $ControlSettings {
12
+ text?: string | PropertyBindingInfo;
13
+ color?: ExampleColor | PropertyBindingInfo | `{${string}}`;
14
+ press?: (event: Event) => void;
15
+ }
16
+
17
+ export default interface Example {
18
+
19
+ // property: text
20
+ getText(): string;
21
+ setText(text: string): this;
22
+
23
+ // property: color
24
+ getColor(): ExampleColor;
25
+ setColor(color: ExampleColor): this;
26
+
27
+ // event: press
28
+ attachPress(fn: (event: Event) => void, listener?: object): this;
29
+ attachPress<CustomDataType extends object>(data: CustomDataType, fn: (event: Event, data: CustomDataType) => void, listener?: object): this;
30
+ detachPress(fn: (event: Event) => void, listener?: object): this;
31
+ firePress(parameters?: object): this;
32
+ }
33
+ }
@@ -0,0 +1,68 @@
1
+ /*!
2
+ * ${copyright}
3
+ */
4
+
5
+ // Provides control <%= libraryNamespace %>.Example.
6
+ sap.ui.define([
7
+ "./library",
8
+ "sap/ui/core/Control",
9
+ "./ExampleRenderer"
10
+ ], function (library, Control, ExampleRenderer) {
11
+ "use strict";
12
+
13
+ // refer to library types
14
+ var ExampleColor = library.ExampleColor;
15
+
16
+ /**
17
+ * Constructor for a new <code><%= libraryNamespace %>.Example</code> control.
18
+ *
19
+ * @param {string} [sId] id for the new control, generated automatically if no id is given
20
+ * @param {object} [mSettings] initial settings for the new control
21
+ *
22
+ * @class
23
+ * Some class description goes here.
24
+ * @extends sap.ui.core.Control
25
+ *
26
+ * @author <%= author %>
27
+ * @version ${version}
28
+ *
29
+ * @constructor
30
+ * @public
31
+ * @alias <%= libraryNamespace %>.Example
32
+ */
33
+ var Example = Control.extend("<%= libraryNamespace %>.Example", /** @lends <%= libraryNamespace %>.Example.prototype */ {
34
+ metadata: {
35
+ library: "<%= libraryNamespace %>",
36
+ properties: {
37
+ /**
38
+ * The text to display.
39
+ */
40
+ text: {
41
+ type: "string",
42
+ group: "Data",
43
+ defaultValue: null
44
+ },
45
+ /**
46
+ * The color to use (default to "Default" color).
47
+ */
48
+ color: {
49
+ type: "<%= libraryNamespace %>.ExampleColor",
50
+ group: "Appearance",
51
+ defaultValue: ExampleColor.Default
52
+ }
53
+ },
54
+ events: {
55
+ /**
56
+ * Event is fired when the user clicks the control.
57
+ */
58
+ press: {}
59
+ }
60
+ },
61
+ renderer: ExampleRenderer,
62
+ onclick: function() {
63
+ this.firePress();
64
+ }
65
+ });
66
+ return Example;
67
+
68
+ });
@@ -0,0 +1,65 @@
1
+ /*!
2
+ * ${copyright}
3
+ */
4
+
5
+ // Provides control <%= libraryNamespace %>.Example.
6
+ import Control from "sap/ui/core/Control";
7
+ import ExampleRenderer from "./ExampleRenderer";
8
+ import { ExampleColor } from "./library";
9
+
10
+
11
+
12
+ /**
13
+ * Constructor for a new <code><%= libraryNamespace %>.Example</code> control.
14
+ *
15
+ * Some class description goes here.
16
+ * @extends Control
17
+ *
18
+ * @author OpenUI5 Team
19
+ * @version ${version}
20
+ *
21
+ * @constructor
22
+ * @public
23
+ * @name <%= libraryNamespace %>.Example
24
+ */
25
+ export default class Example extends Control {
26
+
27
+ // The following three lines were generated and should remain as-is to make TypeScript aware of the constructor signatures
28
+ constructor(id?: string | $ExampleSettings);
29
+ constructor(id?: string, settings?: $ExampleSettings);
30
+ constructor(id?: string, settings?: $ExampleSettings) { super(id, settings); }
31
+
32
+ static readonly metadata = {
33
+ library: "<%= libraryNamespace %>",
34
+ properties: {
35
+ /**
36
+ * The text to display.
37
+ */
38
+ text: {
39
+ type: "string",
40
+ group: "Data",
41
+ defaultValue: null
42
+ },
43
+ /**
44
+ * The color to use (default to "Default" color).
45
+ */
46
+ color: {
47
+ type: "<%= libraryNamespace %>.ExampleColor",
48
+ group: "Appearance",
49
+ defaultValue: ExampleColor.Default
50
+ }
51
+ },
52
+ events: {
53
+ /**
54
+ * Event is fired when the user clicks the control.
55
+ */
56
+ press: {}
57
+ }
58
+ };
59
+
60
+ static renderer = ExampleRenderer;
61
+
62
+ onclick = () => {
63
+ this.firePress();
64
+ }
65
+ }
@@ -0,0 +1,47 @@
1
+ /*!
2
+ * ${copyright}
3
+ */
4
+
5
+ sap.ui.define([
6
+ "sap/ui/core/Core",
7
+ "./library"
8
+ ], function (Core, library) {
9
+ "use strict";
10
+
11
+ // refer to library types
12
+ var ExampleColor = library.ExampleColor;
13
+
14
+ /**
15
+ * Example renderer.
16
+ * @namespace
17
+ */
18
+ var ExampleRenderer = {
19
+ apiVersion: 2 // usage of DOM Patcher
20
+ };
21
+
22
+ /**
23
+ * Renders the HTML for the given control, using the provided
24
+ * {@link sap.ui.core.RenderManager}.
25
+ *
26
+ * @param {sap.ui.core.RenderManager} rm The reference to the <code>sap.ui.core.RenderManager</code>
27
+ * @param {sap.ui.core.Control} control The control instance to be rendered
28
+ */
29
+ ExampleRenderer.render = function (rm, control) {
30
+
31
+ var i18n = Core.getLibraryResourceBundle("<%= libraryNamespace %>");
32
+
33
+ rm.openStart("div", control);
34
+ if (control.getColor() === ExampleColor.Highlight) {
35
+ rm.class("myLibPrefixExampleHighlight");
36
+ } else {
37
+ rm.class("myLibPrefixExample");
38
+ }
39
+ rm.openEnd( );
40
+ rm.text(i18n.getText("ANY_TEXT") + ": " + control.getText());
41
+ rm.close("div");
42
+
43
+ };
44
+
45
+ return ExampleRenderer;
46
+
47
+ });
@@ -0,0 +1,41 @@
1
+ /*!
2
+ * ${copyright}
3
+ */
4
+
5
+ import ResourceBundle from "sap/base/i18n/ResourceBundle";
6
+ import Core from "sap/ui/core/Core";
7
+ import RenderManager from "sap/ui/core/RenderManager";
8
+ import Example from "./Example";
9
+ import { ExampleColor } from "./library";
10
+
11
+ /**
12
+ * Example renderer.
13
+ * @namespace
14
+ */
15
+ const ExampleRenderer = {
16
+ apiVersion: 2, // usage of DOM Patcher
17
+
18
+ /**
19
+ * Renders the HTML for the given control, using the provided {@link RenderManager}.
20
+ *
21
+ * @param {RenderManager} rm The reference to the <code>sap.ui.core.RenderManager</code>
22
+ * @param {Example} control The control instance to be rendered
23
+ */
24
+ render: function (rm: RenderManager, control: Example) {
25
+
26
+ const i18n = Core.getLibraryResourceBundle("<%= libraryNamespace %>") as ResourceBundle;
27
+
28
+ rm.openStart("div", control);
29
+ if (control.getColor() === ExampleColor.Highlight) {
30
+ rm.class("myLibPrefixExampleHighlight");
31
+ } else {
32
+ rm.class("myLibPrefixExample");
33
+ }
34
+ rm.openEnd( );
35
+ rm.text(i18n.getText("ANY_TEXT") + ": " + control.getText());
36
+ rm.close("div");
37
+ }
38
+
39
+ };
40
+
41
+ export default ExampleRenderer;
@@ -0,0 +1,67 @@
1
+ /*!
2
+ * ${copyright}
3
+ */
4
+
5
+ /**
6
+ * Initialization Code and shared classes of library <%= libraryNamespace %>.
7
+ */
8
+ sap.ui.define([
9
+ "sap/ui/core/library"
10
+ ], function () {
11
+ "use strict";
12
+
13
+ // delegate further initialization of this library to the Core
14
+ // Hint: sap.ui.getCore() must still be used to support preload with sync bootstrap!
15
+ sap.ui.getCore().initLibrary({
16
+ name: "<%= libraryNamespace %>",
17
+ version: "${version}",
18
+ dependencies: [ // keep in sync with the ui5.yaml and .library files
19
+ "sap.ui.core"
20
+ ],
21
+ types: [
22
+ "<%= libraryNamespace %>.ExampleColor"
23
+ ],
24
+ interfaces: [],
25
+ controls: [
26
+ "<%= libraryNamespace %>.Example"
27
+ ],
28
+ elements: [],
29
+ noLibraryCSS: false // if no CSS is provided, you can disable the library.css load here
30
+ });
31
+
32
+ /**
33
+ * Some description about <code><%= libraryName %></code>
34
+ *
35
+ * @namespace
36
+ * @name <%= libraryNamespace %>
37
+ * @author <%= author %>
38
+ * @version ${version}
39
+ * @public
40
+ */
41
+ var thisLib = <%= libraryNamespace %>;
42
+
43
+ /**
44
+ * Semantic Colors of the <code><%= libraryNamespace %>.Example</code>.
45
+ *
46
+ * @enum {string}
47
+ * @public
48
+ */
49
+ thisLib.ExampleColor = {
50
+
51
+ /**
52
+ * Default color (brand color)
53
+ * @public
54
+ */
55
+ Default : "Default",
56
+
57
+ /**
58
+ * Highlight color
59
+ * @public
60
+ */
61
+ Highlight : "Highlight"
62
+
63
+ };
64
+
65
+ return thisLib;
66
+
67
+ });
@@ -0,0 +1,56 @@
1
+ /*!
2
+ * ${copyright}
3
+ */
4
+
5
+ import ObjectPath from "sap/base/util/ObjectPath";
6
+
7
+ /**
8
+ * Initialization Code and shared classes of library <%= libraryNamespace %>.
9
+ */
10
+
11
+ // delegate further initialization of this library to the Core
12
+ // Hint: sap.ui.getCore() must still be used here to support preload with sync bootstrap!
13
+ sap.ui.getCore().initLibrary({
14
+ name: "<%= libraryNamespace %>",
15
+ version: "${version}",
16
+ dependencies: [ // keep in sync with the ui5.yaml and .library files
17
+ "sap.ui.core"
18
+ ],
19
+ types: [
20
+ "<%= libraryNamespace %>.ExampleColor"
21
+ ],
22
+ interfaces: [],
23
+ controls: [
24
+ "<%= libraryNamespace %>.Example"
25
+ ],
26
+ elements: [],
27
+ noLibraryCSS: false // if no CSS is provided, you can disable the library.css load here
28
+ });
29
+
30
+ // get the library object from global object space because all enums must be attached to it to be usable as UI5 types
31
+ // FIXME: this line is planned to become obsolete and may need to be removed later
32
+ const thisLib : {[key: string]: unknown} = ObjectPath.get("<%= libraryNamespace %>") as {[key: string]: unknown};
33
+
34
+ /**
35
+ * Semantic Colors of the com.myorg.myUI5Library.Example control.
36
+ *
37
+ * @enum {string}
38
+ * @public
39
+ */
40
+ export enum ExampleColor {
41
+
42
+ /**
43
+ * Default color (brand color)
44
+ * @public
45
+ */
46
+ Default = "Default",
47
+
48
+ /**
49
+ * Highlight color
50
+ * @public
51
+ */
52
+ Highlight = "Highlight"
53
+
54
+ }
55
+ // FIXME: this line is planned to become obsolete and may need to be removed later
56
+ thisLib.ExampleColor = ExampleColor; // add the enum to the library; this is important because UI5 otherwise cannot identify the type and will skip type checking for properties of this type
@@ -0,0 +1,2 @@
1
+ # Translation file of library <%= libraryNamespace %>.
2
+ ANY_TEXT=AnyText
@@ -0,0 +1,19 @@
1
+ /* Theme Parameter Toolbox: https://openui5.hana.ondemand.com/test-resources/sap/m/demokit/theming/webapp/index.html */
2
+
3
+ .myLibPrefixExample,
4
+ .myLibPrefixExampleHighlight {
5
+ color: @sapUiText;
6
+ background-color: @sapUiNeutralBG;
7
+ border: 1rem solid @sapUiContentForegroundBorderColor;
8
+ border-radius: 1rem;
9
+ opacity: 0.8;
10
+ padding: 2rem;
11
+ margin: 2rem 8rem;
12
+ text-align: center;
13
+ font-size: 2em;
14
+ line-height: 3em;
15
+ }
16
+
17
+ .myLibPrefixExampleHighlight {
18
+ background-color: @sapUiSuccessBG;
19
+ }
@@ -0,0 +1,4 @@
1
+ @import "/resources/sap/ui/core/themes/base/base.less";
2
+ @import "/resources/sap/ui/core/themes/base/global.less";
3
+
4
+ @import "Example.less";
@@ -0,0 +1,3 @@
1
+ @import "../base/library.source.less";
2
+ @import "/resources/sap/ui/core/themes/sap_belize/base.less";
3
+ @import "/resources/sap/ui/core/themes/sap_belize/global.less";
@@ -0,0 +1,3 @@
1
+ @import "../base/library.source.less";
2
+ @import "/resources/sap/ui/core/themes/sap_belize_hcb/base.less";
3
+ @import "/resources/sap/ui/core/themes/sap_belize_hcb/global.less";
@@ -0,0 +1,3 @@
1
+ @import "../base/library.source.less";
2
+ @import "/resources/sap/ui/core/themes/sap_belize_hcw/base.less";
3
+ @import "/resources/sap/ui/core/themes/sap_belize_hcw/global.less";