@ui5/webcomponents-ngx 0.1.0 → 0.1.1-rc.1
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/package.json +1 -1
- package/schematics/add-dependencies/index.js +6 -4
- package/schematics/add-styles/index.js +2 -4
- package/schematics/add-theming/index.js +3 -0
- package/schematics/{ng-add/available-themes.d.ts → config.d.ts} +4 -0
- package/schematics/{ng-add/common-css-parts.js → config.js} +35 -1
- package/schematics/get-config.d.ts +2 -0
- package/schematics/get-config.js +69 -0
- package/schematics/ng-add/index.js +2 -59
- package/ui5-webcomponents-ngx-v0.1.1-rc.1.tgz +0 -0
- package/schematics/ng-add/available-themes.js +0 -37
- package/schematics/ng-add/common-css-parts.d.ts +0 -4
- package/ui5-webcomponents-ngx-v0.1.0.tgz +0 -0
package/package.json
CHANGED
|
@@ -17,16 +17,18 @@ const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
|
17
17
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
18
18
|
const package_config_1 = require("../utils/package-config");
|
|
19
19
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
20
|
+
const commonCssPackageName = '@fundamental-styles/common-css';
|
|
21
|
+
const themingNgxPackageName = '@ui5/theming-ngx';
|
|
20
22
|
function addDependencies(options) {
|
|
21
23
|
return (tree, context) => (0, workspace_1.updateWorkspace)(() => __awaiter(this, void 0, void 0, function* () {
|
|
22
24
|
if (!options.theming && options.commonCss.length === 0) {
|
|
23
25
|
return;
|
|
24
26
|
}
|
|
25
|
-
if (options.commonCss.length && !(0, package_config_1.getPackageVersionFromPackageJson)(tree,
|
|
26
|
-
(0, package_config_1.addPackageToPackageJson)(tree,
|
|
27
|
+
if (options.commonCss.length && !(0, package_config_1.getPackageVersionFromPackageJson)(tree, commonCssPackageName)) {
|
|
28
|
+
(0, package_config_1.addPackageToPackageJson)(tree, commonCssPackageName, 'latest');
|
|
27
29
|
}
|
|
28
|
-
if (options.theming && !(0, package_config_1.getPackageVersionFromPackageJson)(tree,
|
|
29
|
-
(0, package_config_1.addPackageToPackageJson)(tree,
|
|
30
|
+
if (options.theming && !(0, package_config_1.getPackageVersionFromPackageJson)(tree, themingNgxPackageName)) {
|
|
31
|
+
(0, package_config_1.addPackageToPackageJson)(tree, themingNgxPackageName, package_json_1.default.version);
|
|
30
32
|
}
|
|
31
33
|
const peerDependencies = Object.keys(package_json_1.default.peerDependencies).map((peerDependency) => ([peerDependency, package_json_1.default.peerDependencies[peerDependency]]));
|
|
32
34
|
for (const [peerDependency, version] of peerDependencies) {
|
|
@@ -12,9 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.addStyles = void 0;
|
|
13
13
|
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
14
14
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
15
|
-
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
16
15
|
function addStyles(options) {
|
|
17
|
-
return (
|
|
16
|
+
return () => (0, workspace_1.updateWorkspace)((workspace) => __awaiter(this, void 0, void 0, function* () {
|
|
18
17
|
var _a;
|
|
19
18
|
const currentWorkspace = workspace.projects.get(options.project);
|
|
20
19
|
if (!currentWorkspace) {
|
|
@@ -24,14 +23,13 @@ function addStyles(options) {
|
|
|
24
23
|
if (!buildTargetOptions) {
|
|
25
24
|
throw new schematics_1.SchematicsException('Could not find build target options for defined project.');
|
|
26
25
|
}
|
|
27
|
-
let styles = buildTargetOptions['styles'];
|
|
26
|
+
let styles = (buildTargetOptions['styles'] || []);
|
|
28
27
|
styles = styles.filter(style => (typeof style === 'string' && !style.startsWith('node_modules/@fundamental-styles/common-css') ||
|
|
29
28
|
typeof style !== 'string' && !style.input.startsWith('node_modules/@fundamental-styles/common-css')));
|
|
30
29
|
options.commonCss.forEach((style) => {
|
|
31
30
|
styles.push(`node_modules/@fundamental-styles/common-css/dist/${style}.css`);
|
|
32
31
|
});
|
|
33
32
|
buildTargetOptions['styles'] = styles;
|
|
34
|
-
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
35
33
|
}));
|
|
36
34
|
}
|
|
37
35
|
exports.addStyles = addStyles;
|
|
@@ -53,6 +53,9 @@ function addTheming(options) {
|
|
|
53
53
|
if (!buildTargetOptions) {
|
|
54
54
|
throw new schematics_1.SchematicsException('Could not find build target options for defined project.');
|
|
55
55
|
}
|
|
56
|
+
if (!buildTargetOptions['main']) {
|
|
57
|
+
throw new schematics_1.SchematicsException('Could not find main entry file for defined project.');
|
|
58
|
+
}
|
|
56
59
|
const rootModule = (0, ng_ast_utils_1.getAppModulePath)(tree, buildTargetOptions['main']);
|
|
57
60
|
if (!rootModule) {
|
|
58
61
|
throw new schematics_1.SchematicsException('Could not find root module for defined project.');
|
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CommonCssParts = void 0;
|
|
3
|
+
exports.CommonCssParts = exports.AvailableThemes = void 0;
|
|
4
|
+
exports.AvailableThemes = [
|
|
5
|
+
{
|
|
6
|
+
value: 'sap_horizon',
|
|
7
|
+
name: 'Morning Horizon (Light)'
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
value: 'sap_horizon_dark',
|
|
11
|
+
name: 'Evening Horizon (Dark)'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
value: 'sap_horizon_hcb',
|
|
15
|
+
name: 'Horizon High Contrast Black'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
value: 'sap_horizon_hcw',
|
|
19
|
+
name: 'Horizon High Contrast White'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: 'sap_fiori_3',
|
|
23
|
+
name: 'Quartz Light'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: 'sap_fiori_3_dark',
|
|
27
|
+
name: 'Quartz Dark'
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
value: 'sap_fiori_3_hcb',
|
|
31
|
+
name: 'Quartz High Contrast Black'
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
value: 'sap_fiori_3_hcw',
|
|
35
|
+
name: 'Quartz High Contrast White'
|
|
36
|
+
}
|
|
37
|
+
];
|
|
4
38
|
exports.CommonCssParts = [
|
|
5
39
|
{
|
|
6
40
|
value: 'sap-normalize',
|
|
@@ -0,0 +1,69 @@
|
|
|
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.collectConfig = void 0;
|
|
13
|
+
const config_1 = require("./config");
|
|
14
|
+
const promt_1 = require("./utils/promt");
|
|
15
|
+
function collectConfig() {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const schema = {
|
|
18
|
+
commonCss: [],
|
|
19
|
+
defaultTheme: 'sap_horizon'
|
|
20
|
+
};
|
|
21
|
+
const includeCommonCss = yield askCommonCssDependency();
|
|
22
|
+
if (includeCommonCss) {
|
|
23
|
+
schema.commonCss = yield askCommonCssParts();
|
|
24
|
+
}
|
|
25
|
+
schema.theming = yield askThemingDependency();
|
|
26
|
+
if (schema.theming) {
|
|
27
|
+
schema.defaultTheme = yield askDefaultTheme();
|
|
28
|
+
}
|
|
29
|
+
return schema;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
exports.collectConfig = collectConfig;
|
|
33
|
+
function askCommonCssDependency() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
return yield (0, promt_1.askQuestion)({
|
|
36
|
+
type: 'confirm',
|
|
37
|
+
message: 'Would you like to add Common CSS into your application?',
|
|
38
|
+
default: false,
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function askCommonCssParts() {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
return yield (0, promt_1.askQuestion)({
|
|
45
|
+
type: 'checkbox',
|
|
46
|
+
message: 'Please select desired Common CSS features',
|
|
47
|
+
choices: config_1.CommonCssParts,
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function askThemingDependency() {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
return yield (0, promt_1.askQuestion)({
|
|
54
|
+
type: 'confirm',
|
|
55
|
+
message: 'Would you like to add Theming capabilities into your application?',
|
|
56
|
+
default: true,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function askDefaultTheme() {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
return yield (0, promt_1.askQuestion)({
|
|
63
|
+
type: 'list',
|
|
64
|
+
message: 'Please select desired Common CSS features',
|
|
65
|
+
default: 'sap_horizon',
|
|
66
|
+
choices: config_1.AvailableThemes,
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -12,76 +12,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.proceedWithSchematics = exports.ngAdd = void 0;
|
|
13
13
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
14
14
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
15
|
-
const
|
|
16
|
-
const available_themes_1 = require("./available-themes");
|
|
17
|
-
const common_css_parts_1 = require("./common-css-parts");
|
|
15
|
+
const get_config_1 = require("../get-config");
|
|
18
16
|
function ngAdd(options) {
|
|
19
17
|
return (_, context) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const userConfig = yield collectConfig();
|
|
18
|
+
const userConfig = yield (0, get_config_1.collectConfig)();
|
|
21
19
|
options = Object.assign(Object.assign({}, options), userConfig);
|
|
22
20
|
// First, queue dependency installation task.
|
|
23
21
|
const dependenciesTaskId = context.addTask(new tasks_1.RunSchematicTask('add-dependencies', options));
|
|
24
22
|
// Wait for dependencies to be installed and proceed with main schematics.
|
|
25
23
|
context.addTask(new tasks_1.RunSchematicTask('proceed-with-schematics', options), [dependenciesTaskId]);
|
|
26
24
|
return (0, schematics_1.chain)([]);
|
|
27
|
-
// return tree;
|
|
28
25
|
});
|
|
29
26
|
}
|
|
30
27
|
exports.ngAdd = ngAdd;
|
|
31
|
-
function collectConfig() {
|
|
32
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
-
const schema = {
|
|
34
|
-
commonCss: [],
|
|
35
|
-
defaultTheme: 'sap_horizon'
|
|
36
|
-
};
|
|
37
|
-
const includeCommonCss = yield askCommonCssDependency();
|
|
38
|
-
if (includeCommonCss) {
|
|
39
|
-
schema.commonCss = yield askCommonCssParts();
|
|
40
|
-
}
|
|
41
|
-
schema.theming = yield askThemingDependency();
|
|
42
|
-
if (schema.theming) {
|
|
43
|
-
schema.defaultTheme = yield askDefaultTheme();
|
|
44
|
-
}
|
|
45
|
-
return schema;
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
function askCommonCssDependency() {
|
|
49
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
-
return yield (0, promt_1.askQuestion)({
|
|
51
|
-
type: 'confirm',
|
|
52
|
-
message: 'Would you like to add Common CSS into your application?',
|
|
53
|
-
default: false,
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function askCommonCssParts() {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
return yield (0, promt_1.askQuestion)({
|
|
60
|
-
type: 'checkbox',
|
|
61
|
-
message: 'Please select desired Common CSS features',
|
|
62
|
-
choices: common_css_parts_1.CommonCssParts,
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
function askThemingDependency() {
|
|
67
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
return yield (0, promt_1.askQuestion)({
|
|
69
|
-
type: 'confirm',
|
|
70
|
-
message: 'Would you like to add Theming capabilities into your application?',
|
|
71
|
-
default: true,
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
function askDefaultTheme() {
|
|
76
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
return yield (0, promt_1.askQuestion)({
|
|
78
|
-
type: 'list',
|
|
79
|
-
message: 'Please select desired default theme',
|
|
80
|
-
default: 'sap_horizon',
|
|
81
|
-
choices: available_themes_1.AvailableThemes,
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
28
|
function proceedWithSchematics(options) {
|
|
86
29
|
return (0, schematics_1.chain)([
|
|
87
30
|
(0, schematics_1.schematic)('add-styles', options),
|
|
Binary file
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AvailableThemes = void 0;
|
|
4
|
-
exports.AvailableThemes = [
|
|
5
|
-
{
|
|
6
|
-
value: 'sap_horizon',
|
|
7
|
-
name: 'Morning Horizon (Light)'
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
value: 'sap_horizon_dark',
|
|
11
|
-
name: 'Evening Horizon (Dark)'
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
value: 'sap_horizon_hcb',
|
|
15
|
-
name: 'Horizon High Contrast Black'
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
value: 'sap_horizon_hcw',
|
|
19
|
-
name: 'Horizon High Contrast White'
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
value: 'sap_fiori_3',
|
|
23
|
-
name: 'Quartz Light'
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
value: 'sap_fiori_3_dark',
|
|
27
|
-
name: 'Quartz Dark'
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
value: 'sap_fiori_3_hcb',
|
|
31
|
-
name: 'Quartz High Contrast Black'
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
value: 'sap_fiori_3_hcw',
|
|
35
|
-
name: 'Quartz High Contrast White'
|
|
36
|
-
}
|
|
37
|
-
];
|
|
Binary file
|