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.
Files changed (178) hide show
  1. package/data/bootstrap-metadata/bootstrap3-metadata.js +53 -53
  2. package/data/bootstrap-metadata/bootstrap4-metadata.js +47 -47
  3. package/data/bootstrap-metadata/bootstrap5-metadata.js +47 -47
  4. package/data/clean-css-options.json +27 -27
  5. package/data/metadata/dx-theme-builder-metadata.js +7 -7
  6. package/data/migration-metadata/migration-metadata.js +120 -120
  7. package/data/scss/widgets/base/_contextMenu.scss +1 -1
  8. package/data/scss/widgets/base/_drawer.scss +6 -0
  9. package/data/scss/widgets/base/_fileUploader.scss +6 -0
  10. package/data/scss/widgets/base/_form.scss +3 -2
  11. package/data/scss/widgets/base/_gridBase.scss +7 -0
  12. package/data/scss/widgets/base/_icons.scss +15 -2
  13. package/data/scss/widgets/base/_menuBase.scss +20 -0
  14. package/data/scss/widgets/base/{_splitter.scss → _splitterBar.scss} +1 -1
  15. package/data/scss/widgets/base/_validation.scss +5 -6
  16. package/data/scss/widgets/base/calendar/_mixins.scss +1 -2
  17. package/data/scss/widgets/base/{_checkBox.scss → checkBox/_index.scss} +1 -0
  18. package/data/scss/widgets/base/checkBox/_mixins.scss +42 -0
  19. package/data/scss/widgets/base/fileManager/_index.scss +2 -2
  20. package/data/scss/widgets/base/gantt/_index.scss +1 -1
  21. package/data/scss/widgets/base/scheduler/_index.scss +0 -4
  22. package/data/scss/widgets/base/scheduler/views/_index.scss +0 -1
  23. package/data/scss/widgets/base/splitter/_index.scss +61 -0
  24. package/data/scss/widgets/base/splitter/_mixins.scss +24 -0
  25. package/data/scss/widgets/base/textEditor/_mixins.scss +38 -39
  26. package/data/scss/widgets/base/treeView/_common.scss +0 -1
  27. package/data/scss/widgets/fluent/_colors.scss +19 -1
  28. package/data/scss/widgets/fluent/_index.scss +1 -0
  29. package/data/scss/widgets/fluent/_sizes.scss +9 -0
  30. package/data/scss/widgets/fluent/accordion/_sizes.scss +0 -1
  31. package/data/scss/widgets/fluent/button/_colors.scss +1 -2
  32. package/data/scss/widgets/fluent/button/_mixins.scss +4 -10
  33. package/data/scss/widgets/fluent/button/_sizes.scss +4 -0
  34. package/data/scss/widgets/fluent/calendar/_index.scss +0 -1
  35. package/data/scss/widgets/fluent/checkBox/_index.scss +18 -22
  36. package/data/scss/widgets/fluent/checkBox/_sizes.scss +10 -19
  37. package/data/scss/widgets/fluent/common/_mixins.scss +1 -1
  38. package/data/scss/widgets/fluent/common/_sizes.scss +4 -0
  39. package/data/scss/widgets/fluent/fieldset/_index.scss +1 -1
  40. package/data/scss/widgets/fluent/fileManager/_colors.scss +0 -1
  41. package/data/scss/widgets/fluent/fileManager/_index.scss +1 -1
  42. package/data/scss/widgets/fluent/form/_index.scss +9 -0
  43. package/data/scss/widgets/fluent/form/_sizes.scss +3 -0
  44. package/data/scss/widgets/fluent/gantt/_index.scss +1 -1
  45. package/data/scss/widgets/fluent/gridBase/_colors.scss +2 -6
  46. package/data/scss/widgets/fluent/gridBase/_index.scss +5 -2
  47. package/data/scss/widgets/fluent/gridBase/_sizes.scss +2 -1
  48. package/data/scss/widgets/fluent/list/_sizes.scss +5 -0
  49. package/data/scss/widgets/fluent/loadPanel/_colors.scss +0 -2
  50. package/data/scss/widgets/fluent/lookup/_colors.scss +0 -2
  51. package/data/scss/widgets/fluent/menu/_colors.scss +1 -0
  52. package/data/scss/widgets/fluent/menuBase/_index.scss +1 -1
  53. package/data/scss/widgets/fluent/overlay/_colors.scss +0 -2
  54. package/data/scss/widgets/fluent/pager/_sizes.scss +0 -4
  55. package/data/scss/widgets/fluent/popup/_sizes.scss +4 -0
  56. package/data/scss/widgets/fluent/progressBar/_sizes.scss +0 -1
  57. package/data/scss/widgets/fluent/radioGroup/_colors.scss +0 -1
  58. package/data/scss/widgets/fluent/scheduler/_colors.scss +4 -7
  59. package/data/scss/widgets/fluent/scheduler/_sizes.scss +0 -4
  60. package/data/scss/widgets/fluent/slider/_index.scss +0 -5
  61. package/data/scss/widgets/fluent/slider/_sizes.scss +0 -3
  62. package/data/scss/widgets/fluent/splitter/_colors.scss +36 -2
  63. package/data/scss/widgets/fluent/splitter/_index.scss +15 -7
  64. package/data/scss/widgets/fluent/splitter/_sizes.scss +1 -0
  65. package/data/scss/widgets/fluent/splitterBar/_colors.scss +8 -0
  66. package/data/scss/widgets/fluent/splitterBar/_index.scss +19 -0
  67. package/data/scss/widgets/fluent/splitterBar/_sizes.scss +3 -0
  68. package/data/scss/widgets/fluent/switch/_colors.scss +0 -1
  69. package/data/scss/widgets/fluent/switch/_sizes.scss +0 -1
  70. package/data/scss/widgets/fluent/tagBox/_sizes.scss +0 -1
  71. package/data/scss/widgets/fluent/textBox/_colors.scss +0 -6
  72. package/data/scss/widgets/fluent/textBox/_index.scss +3 -9
  73. package/data/scss/widgets/fluent/textEditor/_colors.scss +6 -0
  74. package/data/scss/widgets/fluent/textEditor/_index.scss +5 -6
  75. package/data/scss/widgets/fluent/textEditor/_sizes.scss +0 -7
  76. package/data/scss/widgets/fluent/toolbar/_sizes.scss +4 -0
  77. package/data/scss/widgets/fluent/treeList/_colors.scss +0 -1
  78. package/data/scss/widgets/fluent/typography/_sizes.scss +14 -0
  79. package/data/scss/widgets/fluent/validation/_index.scss +5 -6
  80. package/data/scss/widgets/generic/_colors.scss +19 -29
  81. package/data/scss/widgets/generic/_index.scss +1 -0
  82. package/data/scss/widgets/generic/_sizes.scss +8 -0
  83. package/data/scss/widgets/generic/button/_colors.scss +0 -1
  84. package/data/scss/widgets/generic/button/_sizes.scss +4 -4
  85. package/data/scss/widgets/generic/calendar/_index.scss +0 -1
  86. package/data/scss/widgets/generic/checkBox/_colors.scss +0 -9
  87. package/data/scss/widgets/generic/checkBox/_index.scss +21 -26
  88. package/data/scss/widgets/generic/checkBox/_sizes.scss +14 -16
  89. package/data/scss/widgets/generic/dropDownEditor/_colors.scss +1 -1
  90. package/data/scss/widgets/generic/fieldset/_index.scss +1 -1
  91. package/data/scss/widgets/generic/fileManager/_index.scss +1 -1
  92. package/data/scss/widgets/generic/form/_index.scss +9 -0
  93. package/data/scss/widgets/generic/gantt/_index.scss +1 -1
  94. package/data/scss/widgets/generic/gridBase/_index.scss +18 -6
  95. package/data/scss/widgets/generic/gridBase/_sizes.scss +5 -2
  96. package/data/scss/widgets/generic/htmlEditor/_sizes.scss +0 -1
  97. package/data/scss/widgets/generic/list/_sizes.scss +5 -0
  98. package/data/scss/widgets/generic/menu/_colors.scss +1 -0
  99. package/data/scss/widgets/generic/menuBase/_colors.scss +0 -1
  100. package/data/scss/widgets/generic/menuBase/_index.scss +1 -1
  101. package/data/scss/widgets/generic/overlay/_colors.scss +1 -1
  102. package/data/scss/widgets/generic/popup/_sizes.scss +4 -0
  103. package/data/scss/widgets/generic/scheduler/_index.scss +0 -3
  104. package/data/scss/widgets/generic/scheduler/_sizes.scss +0 -1
  105. package/data/scss/widgets/generic/speedDialAction/_index.scss +0 -1
  106. package/data/scss/widgets/generic/splitter/_colors.scss +22 -38
  107. package/data/scss/widgets/generic/splitter/_index.scss +15 -7
  108. package/data/scss/widgets/generic/splitter/_sizes.scss +1 -0
  109. package/data/scss/widgets/generic/splitterBar/_colors.scss +43 -0
  110. package/data/scss/widgets/generic/splitterBar/_index.scss +19 -0
  111. package/data/scss/widgets/generic/splitterBar/_sizes.scss +4 -0
  112. package/data/scss/widgets/generic/tabs/variables/_colors.scss +0 -1
  113. package/data/scss/widgets/generic/textEditor/_colors.scss +5 -1
  114. package/data/scss/widgets/generic/timeView/_sizes.scss +0 -1
  115. package/data/scss/widgets/generic/toolbar/_sizes.scss +4 -0
  116. package/data/scss/widgets/generic/treeList/_colors.scss +0 -1
  117. package/data/scss/widgets/generic/treeList/_index.scss +16 -0
  118. package/data/scss/widgets/generic/treeList/_sizes.scss +10 -0
  119. package/data/scss/widgets/generic/treeView/_sizes.scss +0 -1
  120. package/data/scss/widgets/generic/typography/_index.scss +29 -13
  121. package/data/scss/widgets/generic/typography/_sizes.scss +26 -0
  122. package/data/scss/widgets/material/_colors.scss +19 -8
  123. package/data/scss/widgets/material/_index.scss +1 -0
  124. package/data/scss/widgets/material/_sizes.scss +8 -0
  125. package/data/scss/widgets/material/accordion/_sizes.scss +0 -1
  126. package/data/scss/widgets/material/button/_colors.scss +0 -2
  127. package/data/scss/widgets/material/button/_mixins.scss +2 -12
  128. package/data/scss/widgets/material/button/_sizes.scss +4 -0
  129. package/data/scss/widgets/material/calendar/_index.scss +0 -1
  130. package/data/scss/widgets/material/checkBox/_colors.scss +0 -1
  131. package/data/scss/widgets/material/checkBox/_index.scss +21 -13
  132. package/data/scss/widgets/material/checkBox/_sizes.scss +26 -19
  133. package/data/scss/widgets/material/fieldset/_index.scss +1 -1
  134. package/data/scss/widgets/material/fileManager/_colors.scss +0 -1
  135. package/data/scss/widgets/material/fileManager/_index.scss +1 -1
  136. package/data/scss/widgets/material/form/_index.scss +9 -0
  137. package/data/scss/widgets/material/gantt/_index.scss +1 -1
  138. package/data/scss/widgets/material/gridBase/_index.scss +5 -2
  139. package/data/scss/widgets/material/gridBase/_sizes.scss +2 -1
  140. package/data/scss/widgets/material/htmlEditor/_colors.scss +0 -4
  141. package/data/scss/widgets/material/htmlEditor/_sizes.scss +0 -1
  142. package/data/scss/widgets/material/list/_sizes.scss +5 -0
  143. package/data/scss/widgets/material/menu/_colors.scss +1 -0
  144. package/data/scss/widgets/material/menuBase/_index.scss +1 -1
  145. package/data/scss/widgets/material/pager/_sizes.scss +0 -4
  146. package/data/scss/widgets/material/popup/_sizes.scss +4 -0
  147. package/data/scss/widgets/material/scheduler/_index.scss +5 -2
  148. package/data/scss/widgets/material/scheduler/_sizes.scss +0 -3
  149. package/data/scss/widgets/material/slider/_index.scss +0 -3
  150. package/data/scss/widgets/material/splitter/_colors.scss +34 -2
  151. package/data/scss/widgets/material/splitter/_index.scss +15 -7
  152. package/data/scss/widgets/material/splitter/_sizes.scss +1 -0
  153. package/data/scss/widgets/material/splitterBar/_colors.scss +8 -0
  154. package/data/scss/widgets/material/splitterBar/_index.scss +19 -0
  155. package/data/scss/widgets/material/splitterBar/_sizes.scss +4 -0
  156. package/data/scss/widgets/material/switch/_colors.scss +0 -1
  157. package/data/scss/widgets/material/tagBox/_sizes.scss +0 -3
  158. package/data/scss/widgets/material/textEditor/_colors.scss +5 -0
  159. package/data/scss/widgets/material/textEditor/_index.scss +2 -3
  160. package/data/scss/widgets/material/toolbar/_sizes.scss +4 -0
  161. package/data/scss/widgets/material/treeList/_colors.scss +0 -1
  162. package/data/scss/widgets/material/typography/_sizes.scss +14 -0
  163. package/data/scss/widgets/material/validation/_index.scss +2 -3
  164. package/modules/base-parameters.js +2 -2
  165. package/modules/bootstrap-extractor.js +164 -164
  166. package/modules/builder.js +25 -25
  167. package/modules/bundle-resolver.js +16 -16
  168. package/modules/commands.js +7 -7
  169. package/modules/compile-manager.js +78 -78
  170. package/modules/compiler.js +114 -114
  171. package/modules/config-normalizer.js +150 -150
  172. package/modules/logger.js +16 -16
  173. package/modules/parse-value.js +83 -83
  174. package/modules/post-compiler.js +81 -81
  175. package/modules/pre-compiler.js +24 -24
  176. package/modules/themes.js +137 -137
  177. package/modules/widgets-handler.js +72 -72
  178. package/package.json +4 -4
@@ -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;