devextreme-themebuilder 23.2.6 → 24.1.2-beta
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/data/bootstrap-metadata/bootstrap3-metadata.js +53 -53
- package/data/bootstrap-metadata/bootstrap4-metadata.js +47 -47
- package/data/bootstrap-metadata/bootstrap5-metadata.js +47 -47
- package/data/clean-css-options.json +27 -27
- package/data/metadata/dx-theme-builder-metadata.js +7 -7
- package/data/migration-metadata/migration-metadata.js +120 -120
- package/data/scss/widgets/base/_contextMenu.scss +1 -1
- package/data/scss/widgets/base/_drawer.scss +6 -0
- package/data/scss/widgets/base/_fileUploader.scss +6 -0
- package/data/scss/widgets/base/_form.scss +3 -2
- package/data/scss/widgets/base/_gridBase.scss +7 -0
- package/data/scss/widgets/base/_icons.scss +15 -2
- package/data/scss/widgets/base/_menuBase.scss +20 -0
- package/data/scss/widgets/base/{_splitter.scss → _splitterBar.scss} +1 -1
- package/data/scss/widgets/base/_validation.scss +5 -6
- package/data/scss/widgets/base/calendar/_mixins.scss +1 -2
- package/data/scss/widgets/base/{_checkBox.scss → checkBox/_index.scss} +1 -0
- package/data/scss/widgets/base/checkBox/_mixins.scss +42 -0
- package/data/scss/widgets/base/fileManager/_index.scss +2 -2
- package/data/scss/widgets/base/gantt/_index.scss +1 -1
- package/data/scss/widgets/base/scheduler/_index.scss +0 -4
- package/data/scss/widgets/base/scheduler/views/_index.scss +0 -1
- package/data/scss/widgets/base/splitter/_index.scss +61 -0
- package/data/scss/widgets/base/splitter/_mixins.scss +24 -0
- package/data/scss/widgets/base/textEditor/_mixins.scss +38 -39
- package/data/scss/widgets/base/treeView/_common.scss +0 -1
- package/data/scss/widgets/fluent/_colors.scss +19 -1
- package/data/scss/widgets/fluent/_index.scss +1 -0
- package/data/scss/widgets/fluent/_sizes.scss +9 -0
- package/data/scss/widgets/fluent/accordion/_sizes.scss +0 -1
- package/data/scss/widgets/fluent/button/_colors.scss +1 -2
- package/data/scss/widgets/fluent/button/_mixins.scss +4 -10
- package/data/scss/widgets/fluent/button/_sizes.scss +4 -0
- package/data/scss/widgets/fluent/calendar/_index.scss +0 -1
- package/data/scss/widgets/fluent/checkBox/_index.scss +18 -22
- package/data/scss/widgets/fluent/checkBox/_sizes.scss +10 -19
- package/data/scss/widgets/fluent/common/_mixins.scss +1 -1
- package/data/scss/widgets/fluent/common/_sizes.scss +4 -0
- package/data/scss/widgets/fluent/fieldset/_index.scss +1 -1
- package/data/scss/widgets/fluent/fileManager/_colors.scss +0 -1
- package/data/scss/widgets/fluent/fileManager/_index.scss +1 -1
- package/data/scss/widgets/fluent/form/_index.scss +9 -0
- package/data/scss/widgets/fluent/form/_sizes.scss +3 -0
- package/data/scss/widgets/fluent/gantt/_index.scss +1 -1
- package/data/scss/widgets/fluent/gridBase/_colors.scss +2 -6
- package/data/scss/widgets/fluent/gridBase/_index.scss +5 -2
- package/data/scss/widgets/fluent/gridBase/_sizes.scss +2 -1
- package/data/scss/widgets/fluent/list/_sizes.scss +5 -0
- package/data/scss/widgets/fluent/loadPanel/_colors.scss +0 -2
- package/data/scss/widgets/fluent/lookup/_colors.scss +0 -2
- package/data/scss/widgets/fluent/menu/_colors.scss +1 -0
- package/data/scss/widgets/fluent/menuBase/_index.scss +1 -1
- package/data/scss/widgets/fluent/overlay/_colors.scss +0 -2
- package/data/scss/widgets/fluent/pager/_sizes.scss +0 -4
- package/data/scss/widgets/fluent/popup/_sizes.scss +4 -0
- package/data/scss/widgets/fluent/progressBar/_sizes.scss +0 -1
- package/data/scss/widgets/fluent/radioGroup/_colors.scss +0 -1
- package/data/scss/widgets/fluent/scheduler/_colors.scss +4 -7
- package/data/scss/widgets/fluent/scheduler/_sizes.scss +0 -4
- package/data/scss/widgets/fluent/slider/_index.scss +0 -5
- package/data/scss/widgets/fluent/slider/_sizes.scss +0 -3
- package/data/scss/widgets/fluent/splitter/_colors.scss +36 -2
- package/data/scss/widgets/fluent/splitter/_index.scss +15 -7
- package/data/scss/widgets/fluent/splitter/_sizes.scss +1 -0
- package/data/scss/widgets/fluent/splitterBar/_colors.scss +8 -0
- package/data/scss/widgets/fluent/splitterBar/_index.scss +19 -0
- package/data/scss/widgets/fluent/splitterBar/_sizes.scss +3 -0
- package/data/scss/widgets/fluent/switch/_colors.scss +0 -1
- package/data/scss/widgets/fluent/switch/_sizes.scss +0 -1
- package/data/scss/widgets/fluent/tagBox/_sizes.scss +0 -1
- package/data/scss/widgets/fluent/textBox/_colors.scss +0 -6
- package/data/scss/widgets/fluent/textBox/_index.scss +3 -9
- package/data/scss/widgets/fluent/textEditor/_colors.scss +6 -0
- package/data/scss/widgets/fluent/textEditor/_index.scss +5 -6
- package/data/scss/widgets/fluent/textEditor/_sizes.scss +0 -7
- package/data/scss/widgets/fluent/toolbar/_sizes.scss +4 -0
- package/data/scss/widgets/fluent/treeList/_colors.scss +0 -1
- package/data/scss/widgets/fluent/typography/_sizes.scss +14 -0
- package/data/scss/widgets/fluent/validation/_index.scss +5 -6
- package/data/scss/widgets/generic/_colors.scss +19 -29
- package/data/scss/widgets/generic/_index.scss +1 -0
- package/data/scss/widgets/generic/_sizes.scss +8 -0
- package/data/scss/widgets/generic/button/_colors.scss +0 -1
- package/data/scss/widgets/generic/button/_sizes.scss +4 -4
- package/data/scss/widgets/generic/calendar/_index.scss +0 -1
- package/data/scss/widgets/generic/checkBox/_colors.scss +0 -9
- package/data/scss/widgets/generic/checkBox/_index.scss +21 -26
- package/data/scss/widgets/generic/checkBox/_sizes.scss +14 -16
- package/data/scss/widgets/generic/dropDownEditor/_colors.scss +1 -1
- package/data/scss/widgets/generic/fieldset/_index.scss +1 -1
- package/data/scss/widgets/generic/fileManager/_index.scss +1 -1
- package/data/scss/widgets/generic/form/_index.scss +9 -0
- package/data/scss/widgets/generic/gantt/_index.scss +1 -1
- package/data/scss/widgets/generic/gridBase/_index.scss +18 -6
- package/data/scss/widgets/generic/gridBase/_sizes.scss +5 -2
- package/data/scss/widgets/generic/htmlEditor/_sizes.scss +0 -1
- package/data/scss/widgets/generic/list/_sizes.scss +5 -0
- package/data/scss/widgets/generic/menu/_colors.scss +1 -0
- package/data/scss/widgets/generic/menuBase/_colors.scss +0 -1
- package/data/scss/widgets/generic/menuBase/_index.scss +1 -1
- package/data/scss/widgets/generic/overlay/_colors.scss +1 -1
- package/data/scss/widgets/generic/popup/_sizes.scss +4 -0
- package/data/scss/widgets/generic/scheduler/_index.scss +0 -3
- package/data/scss/widgets/generic/scheduler/_sizes.scss +0 -1
- package/data/scss/widgets/generic/speedDialAction/_index.scss +0 -1
- package/data/scss/widgets/generic/splitter/_colors.scss +22 -38
- package/data/scss/widgets/generic/splitter/_index.scss +15 -7
- package/data/scss/widgets/generic/splitter/_sizes.scss +1 -0
- package/data/scss/widgets/generic/splitterBar/_colors.scss +43 -0
- package/data/scss/widgets/generic/splitterBar/_index.scss +19 -0
- package/data/scss/widgets/generic/splitterBar/_sizes.scss +4 -0
- package/data/scss/widgets/generic/tabs/variables/_colors.scss +0 -1
- package/data/scss/widgets/generic/textEditor/_colors.scss +5 -1
- package/data/scss/widgets/generic/timeView/_sizes.scss +0 -1
- package/data/scss/widgets/generic/toolbar/_sizes.scss +4 -0
- package/data/scss/widgets/generic/treeList/_colors.scss +0 -1
- package/data/scss/widgets/generic/treeList/_index.scss +16 -0
- package/data/scss/widgets/generic/treeList/_sizes.scss +10 -0
- package/data/scss/widgets/generic/treeView/_sizes.scss +0 -1
- package/data/scss/widgets/generic/typography/_index.scss +29 -13
- package/data/scss/widgets/generic/typography/_sizes.scss +26 -0
- package/data/scss/widgets/material/_colors.scss +19 -8
- package/data/scss/widgets/material/_index.scss +1 -0
- package/data/scss/widgets/material/_sizes.scss +8 -0
- package/data/scss/widgets/material/accordion/_sizes.scss +0 -1
- package/data/scss/widgets/material/button/_colors.scss +0 -2
- package/data/scss/widgets/material/button/_mixins.scss +2 -12
- package/data/scss/widgets/material/button/_sizes.scss +4 -0
- package/data/scss/widgets/material/calendar/_index.scss +0 -1
- package/data/scss/widgets/material/checkBox/_colors.scss +0 -1
- package/data/scss/widgets/material/checkBox/_index.scss +21 -13
- package/data/scss/widgets/material/checkBox/_sizes.scss +26 -19
- package/data/scss/widgets/material/fieldset/_index.scss +1 -1
- package/data/scss/widgets/material/fileManager/_colors.scss +0 -1
- package/data/scss/widgets/material/fileManager/_index.scss +1 -1
- package/data/scss/widgets/material/form/_index.scss +9 -0
- package/data/scss/widgets/material/gantt/_index.scss +1 -1
- package/data/scss/widgets/material/gridBase/_index.scss +5 -2
- package/data/scss/widgets/material/gridBase/_sizes.scss +2 -1
- package/data/scss/widgets/material/htmlEditor/_colors.scss +0 -4
- package/data/scss/widgets/material/htmlEditor/_sizes.scss +0 -1
- package/data/scss/widgets/material/list/_sizes.scss +5 -0
- package/data/scss/widgets/material/menu/_colors.scss +1 -0
- package/data/scss/widgets/material/menuBase/_index.scss +1 -1
- package/data/scss/widgets/material/pager/_sizes.scss +0 -4
- package/data/scss/widgets/material/popup/_sizes.scss +4 -0
- package/data/scss/widgets/material/scheduler/_index.scss +5 -2
- package/data/scss/widgets/material/scheduler/_sizes.scss +0 -3
- package/data/scss/widgets/material/slider/_index.scss +0 -3
- package/data/scss/widgets/material/splitter/_colors.scss +34 -2
- package/data/scss/widgets/material/splitter/_index.scss +15 -7
- package/data/scss/widgets/material/splitter/_sizes.scss +1 -0
- package/data/scss/widgets/material/splitterBar/_colors.scss +8 -0
- package/data/scss/widgets/material/splitterBar/_index.scss +19 -0
- package/data/scss/widgets/material/splitterBar/_sizes.scss +4 -0
- package/data/scss/widgets/material/switch/_colors.scss +0 -1
- package/data/scss/widgets/material/tagBox/_sizes.scss +0 -3
- package/data/scss/widgets/material/textEditor/_colors.scss +5 -0
- package/data/scss/widgets/material/textEditor/_index.scss +2 -3
- package/data/scss/widgets/material/toolbar/_sizes.scss +4 -0
- package/data/scss/widgets/material/treeList/_colors.scss +0 -1
- package/data/scss/widgets/material/typography/_sizes.scss +14 -0
- package/data/scss/widgets/material/validation/_index.scss +2 -3
- package/modules/base-parameters.js +2 -2
- package/modules/bootstrap-extractor.js +164 -164
- package/modules/builder.js +25 -25
- package/modules/bundle-resolver.js +16 -16
- package/modules/commands.js +7 -7
- package/modules/compile-manager.js +78 -78
- package/modules/compiler.js +114 -114
- package/modules/config-normalizer.js +150 -150
- package/modules/logger.js +16 -16
- package/modules/parse-value.js +83 -83
- package/modules/post-compiler.js +81 -81
- package/modules/pre-compiler.js +24 -24
- package/modules/themes.js +137 -137
- package/modules/widgets-handler.js +72 -72
- package/package.json +4 -4
package/modules/compiler.js
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
const sass = __importStar(require("sass-embedded"));
|
|
36
|
-
// eslint-disable-next-line import/extensions
|
|
37
|
-
const dx_theme_builder_metadata_1 = require("../data/metadata/dx-theme-builder-metadata");
|
|
38
|
-
const parse_value_1 = require("./parse-value");
|
|
39
|
-
const post_compiler_1 = require("./post-compiler");
|
|
40
|
-
class Compiler {
|
|
41
|
-
constructor() {
|
|
42
|
-
this.changedVariables = {};
|
|
43
|
-
this.importerCache = {};
|
|
44
|
-
this.meta = dx_theme_builder_metadata_1.metadata;
|
|
45
|
-
this.userItems = {};
|
|
46
|
-
this.compile = (file, items, options) => __awaiter(this, void 0, void 0, function* () { return this.sassCompile(file, items, options, sass.compileAsync); });
|
|
47
|
-
this.compileString = (content, items, options) => __awaiter(this, void 0, void 0, function* () { return this.sassCompile(content, items, options, sass.compileStringAsync); });
|
|
48
|
-
this.sassCompile = (source, items, options, compile) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
-
this.changedVariables = {};
|
|
50
|
-
if (items) {
|
|
51
|
-
this.userItems = items.reduce((acc, item) => {
|
|
52
|
-
acc[item.key] = item;
|
|
53
|
-
return acc;
|
|
54
|
-
}, {});
|
|
55
|
-
}
|
|
56
|
-
let compilerOptions = {
|
|
57
|
-
importers: [{
|
|
58
|
-
// eslint-disable-next-line spellcheck/spell-checker
|
|
59
|
-
canonicalize: this.canonicalize,
|
|
60
|
-
load: this.load,
|
|
61
|
-
}],
|
|
62
|
-
functions: {
|
|
63
|
-
'collector($map)': this.collector,
|
|
64
|
-
'getCustomVar($value)': this.getCustomVar,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
compilerOptions = Object.assign(Object.assign({}, compilerOptions), options);
|
|
68
|
-
return new Promise((resolve, reject) => {
|
|
69
|
-
compile(source, compilerOptions)
|
|
70
|
-
.then((data) => {
|
|
71
|
-
resolve({
|
|
72
|
-
result: Object.assign(Object.assign({}, data), { css: (0, post_compiler_1.optimizeCss)(data.css) }),
|
|
73
|
-
changedVariables: this.changedVariables,
|
|
74
|
-
});
|
|
75
|
-
})
|
|
76
|
-
.catch((error) => reject(error));
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
// eslint-disable-next-line spellcheck/spell-checker
|
|
80
|
-
this.canonicalize = (url) => (url.includes('tb_index') ? new URL(`db:${url}`) : null);
|
|
81
|
-
this.load = () => ({
|
|
82
|
-
contents: this.indexFileContent,
|
|
83
|
-
syntax: 'scss',
|
|
84
|
-
});
|
|
85
|
-
this.getCustomVar = (values) => {
|
|
86
|
-
const customVariable = values[0].get(0);
|
|
87
|
-
const nameVariable = customVariable.get(0);
|
|
88
|
-
let result = sass.sassNull;
|
|
89
|
-
const customerVariable = this.userItems[nameVariable.text];
|
|
90
|
-
if (customerVariable) {
|
|
91
|
-
result = (0, parse_value_1.parseString)(customerVariable.value);
|
|
92
|
-
}
|
|
93
|
-
return result;
|
|
94
|
-
};
|
|
95
|
-
this.collector = (maps) => {
|
|
96
|
-
maps.forEach((map) => {
|
|
97
|
-
map.asList.forEach((value) => {
|
|
98
|
-
if (value.get(1) === sass.sassNull) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
const key = value.get(0);
|
|
102
|
-
if (!(key instanceof sass.SassString)) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
const variableKey = key.text;
|
|
106
|
-
const variableValue = (0, parse_value_1.parse)(value.get(1));
|
|
107
|
-
this.changedVariables[variableKey] = variableValue;
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
return sass.sassNull;
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
exports.default = Compiler;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
const sass = __importStar(require("sass-embedded"));
|
|
36
|
+
// eslint-disable-next-line import/extensions
|
|
37
|
+
const dx_theme_builder_metadata_1 = require("../data/metadata/dx-theme-builder-metadata");
|
|
38
|
+
const parse_value_1 = require("./parse-value");
|
|
39
|
+
const post_compiler_1 = require("./post-compiler");
|
|
40
|
+
class Compiler {
|
|
41
|
+
constructor() {
|
|
42
|
+
this.changedVariables = {};
|
|
43
|
+
this.importerCache = {};
|
|
44
|
+
this.meta = dx_theme_builder_metadata_1.metadata;
|
|
45
|
+
this.userItems = {};
|
|
46
|
+
this.compile = (file, items, options) => __awaiter(this, void 0, void 0, function* () { return this.sassCompile(file, items, options, sass.compileAsync); });
|
|
47
|
+
this.compileString = (content, items, options) => __awaiter(this, void 0, void 0, function* () { return this.sassCompile(content, items, options, sass.compileStringAsync); });
|
|
48
|
+
this.sassCompile = (source, items, options, compile) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
this.changedVariables = {};
|
|
50
|
+
if (items) {
|
|
51
|
+
this.userItems = items.reduce((acc, item) => {
|
|
52
|
+
acc[item.key] = item;
|
|
53
|
+
return acc;
|
|
54
|
+
}, {});
|
|
55
|
+
}
|
|
56
|
+
let compilerOptions = {
|
|
57
|
+
importers: [{
|
|
58
|
+
// eslint-disable-next-line spellcheck/spell-checker
|
|
59
|
+
canonicalize: this.canonicalize,
|
|
60
|
+
load: this.load,
|
|
61
|
+
}],
|
|
62
|
+
functions: {
|
|
63
|
+
'collector($map)': this.collector,
|
|
64
|
+
'getCustomVar($value)': this.getCustomVar,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
compilerOptions = Object.assign(Object.assign({}, compilerOptions), options);
|
|
68
|
+
return new Promise((resolve, reject) => {
|
|
69
|
+
compile(source, compilerOptions)
|
|
70
|
+
.then((data) => {
|
|
71
|
+
resolve({
|
|
72
|
+
result: Object.assign(Object.assign({}, data), { css: (0, post_compiler_1.optimizeCss)(data.css) }),
|
|
73
|
+
changedVariables: this.changedVariables,
|
|
74
|
+
});
|
|
75
|
+
})
|
|
76
|
+
.catch((error) => reject(error));
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
// eslint-disable-next-line spellcheck/spell-checker
|
|
80
|
+
this.canonicalize = (url) => (url.includes('tb_index') ? new URL(`db:${url}`) : null);
|
|
81
|
+
this.load = () => ({
|
|
82
|
+
contents: this.indexFileContent,
|
|
83
|
+
syntax: 'scss',
|
|
84
|
+
});
|
|
85
|
+
this.getCustomVar = (values) => {
|
|
86
|
+
const customVariable = values[0].get(0);
|
|
87
|
+
const nameVariable = customVariable.get(0);
|
|
88
|
+
let result = sass.sassNull;
|
|
89
|
+
const customerVariable = this.userItems[nameVariable.text];
|
|
90
|
+
if (customerVariable) {
|
|
91
|
+
result = (0, parse_value_1.parseString)(customerVariable.value);
|
|
92
|
+
}
|
|
93
|
+
return result;
|
|
94
|
+
};
|
|
95
|
+
this.collector = (maps) => {
|
|
96
|
+
maps.forEach((map) => {
|
|
97
|
+
map.asList.forEach((value) => {
|
|
98
|
+
if (value.get(1) === sass.sassNull) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const key = value.get(0);
|
|
102
|
+
if (!(key instanceof sass.SassString)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const variableKey = key.text;
|
|
106
|
+
const variableValue = (0, parse_value_1.parse)(value.get(1));
|
|
107
|
+
this.changedVariables[variableKey] = variableValue;
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
return sass.sassNull;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.default = Compiler;
|
|
@@ -1,150 +1,150 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint no-param-reassign: ["error", { "props": false }] */
|
|
3
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
-
};
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
const commands_1 = __importDefault(require("./commands"));
|
|
8
|
-
const themes_1 = __importDefault(require("./themes"));
|
|
9
|
-
const logger_1 = require("./logger");
|
|
10
|
-
const DEFAULT_OUT_COLOR_SCHEME = 'custom-scheme';
|
|
11
|
-
const extname = (filename) => filename.substring(filename.lastIndexOf('.'));
|
|
12
|
-
const getBootstrapConfig = (fileName, configVersion) => {
|
|
13
|
-
const extension = extname(fileName);
|
|
14
|
-
let bootstrap = false;
|
|
15
|
-
let version = 0;
|
|
16
|
-
if (extension === '.scss') {
|
|
17
|
-
bootstrap = true;
|
|
18
|
-
version = 4;
|
|
19
|
-
}
|
|
20
|
-
else if (extension === '.less') {
|
|
21
|
-
bootstrap = true;
|
|
22
|
-
version = 3;
|
|
23
|
-
}
|
|
24
|
-
if (version === 4 && (configVersion === 4 || configVersion === 5)) {
|
|
25
|
-
version = configVersion;
|
|
26
|
-
}
|
|
27
|
-
return { isBootstrap: bootstrap, bootstrapVersion: version };
|
|
28
|
-
};
|
|
29
|
-
const getOutParameters = (command, themeName, config) => {
|
|
30
|
-
var _a, _b, _c;
|
|
31
|
-
let outputFile = (_a = config.outputFile) !== null && _a !== void 0 ? _a : '';
|
|
32
|
-
let outColorScheme = (_b = config.outputColorScheme) !== null && _b !== void 0 ? _b : '';
|
|
33
|
-
let fileFormat = ((_c = config.outputFormat) !== null && _c !== void 0 ? _c : '') || extname(outputFile).substr(1);
|
|
34
|
-
const makeSwatch = !!config.makeSwatch;
|
|
35
|
-
const base = !!config.base;
|
|
36
|
-
const isColorSchemeValid = outColorScheme && /^[\w\-.]+$/.test(outColorScheme);
|
|
37
|
-
if (!isColorSchemeValid) {
|
|
38
|
-
(0, logger_1.log)(`'--output-color-scheme' is not valid. '${DEFAULT_OUT_COLOR_SCHEME}' will be used.`);
|
|
39
|
-
}
|
|
40
|
-
if (!outColorScheme || !isColorSchemeValid) {
|
|
41
|
-
outColorScheme = DEFAULT_OUT_COLOR_SCHEME;
|
|
42
|
-
}
|
|
43
|
-
if (!fileFormat) {
|
|
44
|
-
switch (command) {
|
|
45
|
-
case commands_1.default.BUILD_THEME:
|
|
46
|
-
fileFormat = 'css';
|
|
47
|
-
break;
|
|
48
|
-
case commands_1.default.BUILD_VARS:
|
|
49
|
-
fileFormat = 'less';
|
|
50
|
-
break;
|
|
51
|
-
case commands_1.default.BUILD_META:
|
|
52
|
-
fileFormat = 'json';
|
|
53
|
-
break;
|
|
54
|
-
default:
|
|
55
|
-
fileFormat = 'css';
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (!outputFile) {
|
|
60
|
-
outputFile = `dx.${themeName}.${outColorScheme}.${fileFormat}`;
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
outputFile,
|
|
64
|
-
fileFormat,
|
|
65
|
-
outColorScheme,
|
|
66
|
-
makeSwatch,
|
|
67
|
-
base,
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
const getThemeAndColorScheme = (config) => {
|
|
71
|
-
let themeName = 'generic';
|
|
72
|
-
let colorScheme = 'light';
|
|
73
|
-
let foundTheme = null;
|
|
74
|
-
if (config.baseTheme) {
|
|
75
|
-
const dotIndex = config.baseTheme.indexOf('.');
|
|
76
|
-
const passedThemeName = config.baseTheme.substr(0, dotIndex);
|
|
77
|
-
const passedColorScheme = config.baseTheme.substr(dotIndex + 1).replace(/\./g, '-');
|
|
78
|
-
foundTheme = themes_1.default.find((t) => t.name === passedThemeName
|
|
79
|
-
&& t.colorScheme === passedColorScheme);
|
|
80
|
-
if (!foundTheme) {
|
|
81
|
-
(0, logger_1.log)(`The base theme with name ${config.baseTheme} does not exist.`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
else if (config.themeId) {
|
|
85
|
-
foundTheme = themes_1.default.find((t) => t.themeId === parseInt(config.themeId.toString(), 10));
|
|
86
|
-
if (!foundTheme) {
|
|
87
|
-
(0, logger_1.log)(`The theme with ID ${config.themeId} does not exist.`);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (foundTheme) {
|
|
91
|
-
themeName = foundTheme.name;
|
|
92
|
-
colorScheme = foundTheme.colorScheme;
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
themeName,
|
|
96
|
-
colorScheme,
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
const processItemKeys = (config, processor) => {
|
|
100
|
-
var _a;
|
|
101
|
-
if ((_a = config.items) === null || _a === void 0 ? void 0 : _a.length) {
|
|
102
|
-
config.items.forEach((item) => {
|
|
103
|
-
item.key = processor(item.key);
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
const normalizePath = (path) => path + (!path.endsWith('/') ? '/' : '');
|
|
108
|
-
const parseConfig = (config) => {
|
|
109
|
-
var _a;
|
|
110
|
-
const { command } = config;
|
|
111
|
-
const metadataFilePath = (_a = config.inputFile) !== null && _a !== void 0 ? _a : '';
|
|
112
|
-
const themeInfo = getThemeAndColorScheme(config);
|
|
113
|
-
const bootstrapConfig = getBootstrapConfig(metadataFilePath, config.bootstrapVersion);
|
|
114
|
-
const output = getOutParameters(command, themeInfo.themeName, config);
|
|
115
|
-
delete config.baseTheme;
|
|
116
|
-
delete config.outputColorScheme;
|
|
117
|
-
delete config.outputFormat;
|
|
118
|
-
delete config.outputFile;
|
|
119
|
-
delete config.inputFile;
|
|
120
|
-
delete config.themeId;
|
|
121
|
-
if (config.lessPath) {
|
|
122
|
-
config.lessPath = normalizePath(config.lessPath);
|
|
123
|
-
}
|
|
124
|
-
if (config.scssPath) {
|
|
125
|
-
config.scssPath = normalizePath(config.scssPath);
|
|
126
|
-
}
|
|
127
|
-
if (config.widgets) {
|
|
128
|
-
config.widgets = config.widgets.map((w) => w.toLowerCase());
|
|
129
|
-
}
|
|
130
|
-
[
|
|
131
|
-
(key) => key.replace(/@treelist/, '@datagrid'),
|
|
132
|
-
(key) => key.replace(/@/, '$'),
|
|
133
|
-
(key) => key.toLowerCase().replace(/_/g, '-'),
|
|
134
|
-
].forEach((processor) => {
|
|
135
|
-
processItemKeys(config, processor);
|
|
136
|
-
});
|
|
137
|
-
Object.assign(config, {
|
|
138
|
-
data: config.data !== undefined ? config.data : {},
|
|
139
|
-
fileFormat: output.fileFormat,
|
|
140
|
-
themeName: themeInfo.themeName,
|
|
141
|
-
colorScheme: themeInfo.colorScheme,
|
|
142
|
-
outColorScheme: output.outColorScheme,
|
|
143
|
-
isBootstrap: bootstrapConfig.isBootstrap,
|
|
144
|
-
bootstrapVersion: bootstrapConfig.bootstrapVersion,
|
|
145
|
-
out: output.outputFile,
|
|
146
|
-
makeSwatch: output.makeSwatch,
|
|
147
|
-
base: output.base,
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
exports.default = parseConfig;
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint no-param-reassign: ["error", { "props": false }] */
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const commands_1 = __importDefault(require("./commands"));
|
|
8
|
+
const themes_1 = __importDefault(require("./themes"));
|
|
9
|
+
const logger_1 = require("./logger");
|
|
10
|
+
const DEFAULT_OUT_COLOR_SCHEME = 'custom-scheme';
|
|
11
|
+
const extname = (filename) => filename.substring(filename.lastIndexOf('.'));
|
|
12
|
+
const getBootstrapConfig = (fileName, configVersion) => {
|
|
13
|
+
const extension = extname(fileName);
|
|
14
|
+
let bootstrap = false;
|
|
15
|
+
let version = 0;
|
|
16
|
+
if (extension === '.scss') {
|
|
17
|
+
bootstrap = true;
|
|
18
|
+
version = 4;
|
|
19
|
+
}
|
|
20
|
+
else if (extension === '.less') {
|
|
21
|
+
bootstrap = true;
|
|
22
|
+
version = 3;
|
|
23
|
+
}
|
|
24
|
+
if (version === 4 && (configVersion === 4 || configVersion === 5)) {
|
|
25
|
+
version = configVersion;
|
|
26
|
+
}
|
|
27
|
+
return { isBootstrap: bootstrap, bootstrapVersion: version };
|
|
28
|
+
};
|
|
29
|
+
const getOutParameters = (command, themeName, config) => {
|
|
30
|
+
var _a, _b, _c;
|
|
31
|
+
let outputFile = (_a = config.outputFile) !== null && _a !== void 0 ? _a : '';
|
|
32
|
+
let outColorScheme = (_b = config.outputColorScheme) !== null && _b !== void 0 ? _b : '';
|
|
33
|
+
let fileFormat = ((_c = config.outputFormat) !== null && _c !== void 0 ? _c : '') || extname(outputFile).substr(1);
|
|
34
|
+
const makeSwatch = !!config.makeSwatch;
|
|
35
|
+
const base = !!config.base;
|
|
36
|
+
const isColorSchemeValid = outColorScheme && /^[\w\-.]+$/.test(outColorScheme);
|
|
37
|
+
if (!isColorSchemeValid) {
|
|
38
|
+
(0, logger_1.log)(`'--output-color-scheme' is not valid. '${DEFAULT_OUT_COLOR_SCHEME}' will be used.`);
|
|
39
|
+
}
|
|
40
|
+
if (!outColorScheme || !isColorSchemeValid) {
|
|
41
|
+
outColorScheme = DEFAULT_OUT_COLOR_SCHEME;
|
|
42
|
+
}
|
|
43
|
+
if (!fileFormat) {
|
|
44
|
+
switch (command) {
|
|
45
|
+
case commands_1.default.BUILD_THEME:
|
|
46
|
+
fileFormat = 'css';
|
|
47
|
+
break;
|
|
48
|
+
case commands_1.default.BUILD_VARS:
|
|
49
|
+
fileFormat = 'less';
|
|
50
|
+
break;
|
|
51
|
+
case commands_1.default.BUILD_META:
|
|
52
|
+
fileFormat = 'json';
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
fileFormat = 'css';
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (!outputFile) {
|
|
60
|
+
outputFile = `dx.${themeName}.${outColorScheme}.${fileFormat}`;
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
outputFile,
|
|
64
|
+
fileFormat,
|
|
65
|
+
outColorScheme,
|
|
66
|
+
makeSwatch,
|
|
67
|
+
base,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
const getThemeAndColorScheme = (config) => {
|
|
71
|
+
let themeName = 'generic';
|
|
72
|
+
let colorScheme = 'light';
|
|
73
|
+
let foundTheme = null;
|
|
74
|
+
if (config.baseTheme) {
|
|
75
|
+
const dotIndex = config.baseTheme.indexOf('.');
|
|
76
|
+
const passedThemeName = config.baseTheme.substr(0, dotIndex);
|
|
77
|
+
const passedColorScheme = config.baseTheme.substr(dotIndex + 1).replace(/\./g, '-');
|
|
78
|
+
foundTheme = themes_1.default.find((t) => t.name === passedThemeName
|
|
79
|
+
&& t.colorScheme === passedColorScheme);
|
|
80
|
+
if (!foundTheme) {
|
|
81
|
+
(0, logger_1.log)(`The base theme with name ${config.baseTheme} does not exist.`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else if (config.themeId) {
|
|
85
|
+
foundTheme = themes_1.default.find((t) => t.themeId === parseInt(config.themeId.toString(), 10));
|
|
86
|
+
if (!foundTheme) {
|
|
87
|
+
(0, logger_1.log)(`The theme with ID ${config.themeId} does not exist.`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (foundTheme) {
|
|
91
|
+
themeName = foundTheme.name;
|
|
92
|
+
colorScheme = foundTheme.colorScheme;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
themeName,
|
|
96
|
+
colorScheme,
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
const processItemKeys = (config, processor) => {
|
|
100
|
+
var _a;
|
|
101
|
+
if ((_a = config.items) === null || _a === void 0 ? void 0 : _a.length) {
|
|
102
|
+
config.items.forEach((item) => {
|
|
103
|
+
item.key = processor(item.key);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const normalizePath = (path) => path + (!path.endsWith('/') ? '/' : '');
|
|
108
|
+
const parseConfig = (config) => {
|
|
109
|
+
var _a;
|
|
110
|
+
const { command } = config;
|
|
111
|
+
const metadataFilePath = (_a = config.inputFile) !== null && _a !== void 0 ? _a : '';
|
|
112
|
+
const themeInfo = getThemeAndColorScheme(config);
|
|
113
|
+
const bootstrapConfig = getBootstrapConfig(metadataFilePath, config.bootstrapVersion);
|
|
114
|
+
const output = getOutParameters(command, themeInfo.themeName, config);
|
|
115
|
+
delete config.baseTheme;
|
|
116
|
+
delete config.outputColorScheme;
|
|
117
|
+
delete config.outputFormat;
|
|
118
|
+
delete config.outputFile;
|
|
119
|
+
delete config.inputFile;
|
|
120
|
+
delete config.themeId;
|
|
121
|
+
if (config.lessPath) {
|
|
122
|
+
config.lessPath = normalizePath(config.lessPath);
|
|
123
|
+
}
|
|
124
|
+
if (config.scssPath) {
|
|
125
|
+
config.scssPath = normalizePath(config.scssPath);
|
|
126
|
+
}
|
|
127
|
+
if (config.widgets) {
|
|
128
|
+
config.widgets = config.widgets.map((w) => w.toLowerCase());
|
|
129
|
+
}
|
|
130
|
+
[
|
|
131
|
+
(key) => key.replace(/@treelist/, '@datagrid'),
|
|
132
|
+
(key) => key.replace(/@/, '$'),
|
|
133
|
+
(key) => key.toLowerCase().replace(/_/g, '-'),
|
|
134
|
+
].forEach((processor) => {
|
|
135
|
+
processItemKeys(config, processor);
|
|
136
|
+
});
|
|
137
|
+
Object.assign(config, {
|
|
138
|
+
data: config.data !== undefined ? config.data : {},
|
|
139
|
+
fileFormat: output.fileFormat,
|
|
140
|
+
themeName: themeInfo.themeName,
|
|
141
|
+
colorScheme: themeInfo.colorScheme,
|
|
142
|
+
outColorScheme: output.outColorScheme,
|
|
143
|
+
isBootstrap: bootstrapConfig.isBootstrap,
|
|
144
|
+
bootstrapVersion: bootstrapConfig.bootstrapVersion,
|
|
145
|
+
out: output.outputFile,
|
|
146
|
+
makeSwatch: output.makeSwatch,
|
|
147
|
+
base: output.base,
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
exports.default = parseConfig;
|
package/modules/logger.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.log = void 0;
|
|
4
|
-
/* eslint no-console: 0 */
|
|
5
|
-
function log(message, data = undefined) {
|
|
6
|
-
const debugEnvVariableName = 'THEMEBUILDER_DEBUG';
|
|
7
|
-
const needLog = typeof process !== 'undefined' && process.env && process.env[debugEnvVariableName] !== undefined;
|
|
8
|
-
if (!needLog)
|
|
9
|
-
return;
|
|
10
|
-
let timedMessage = `${new Date().toISOString()}: ${message}`;
|
|
11
|
-
if (data !== undefined) {
|
|
12
|
-
timedMessage += `: ${JSON.stringify(data, null, 2).substr(0, 50)}`;
|
|
13
|
-
}
|
|
14
|
-
console.log(timedMessage);
|
|
15
|
-
}
|
|
16
|
-
exports.log = log;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.log = void 0;
|
|
4
|
+
/* eslint no-console: 0 */
|
|
5
|
+
function log(message, data = undefined) {
|
|
6
|
+
const debugEnvVariableName = 'THEMEBUILDER_DEBUG';
|
|
7
|
+
const needLog = typeof process !== 'undefined' && process.env && process.env[debugEnvVariableName] !== undefined;
|
|
8
|
+
if (!needLog)
|
|
9
|
+
return;
|
|
10
|
+
let timedMessage = `${new Date().toISOString()}: ${message}`;
|
|
11
|
+
if (data !== undefined) {
|
|
12
|
+
timedMessage += `: ${JSON.stringify(data, null, 2).substr(0, 50)}`;
|
|
13
|
+
}
|
|
14
|
+
console.log(timedMessage);
|
|
15
|
+
}
|
|
16
|
+
exports.log = log;
|