devextreme-themebuilder 24.1.2-beta → 24.1.3

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.
@@ -1,120 +1,120 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = {
4
- generic: [
5
- '@radiogroup-checked-bg',
6
- '@radiogroup-border-color',
7
- '@radiogroup-bg',
8
- '@radiobutton-active-bg',
9
- '@radiogroup-hover-border-color',
10
- '@radiobutton-focused-border-color',
11
- '@accordion-color',
12
- '@accordion-item-focused-border-color',
13
- '@accordion-background-color',
14
- '@accordion-title-active-color',
15
- '@accordion-item-hover-bg',
16
- '@accordion-title-active-bg',
17
- '@checkbox-border-color',
18
- '@checkbox-focused-borderd-color',
19
- '@checkbox-bg',
20
- '@checkbox-hover-border-color',
21
- '@checkbox-active-icon-bg',
22
- '@base-invalid-color',
23
- '@base-invalid-faded-border-color',
24
- '@list-border-color',
25
- '@list-normal-color',
26
- '@list-item-hover-bg',
27
- '@list-item-focused-selected-bg',
28
- '@list-focused-bg',
29
- '@dropdowneditor-button-hover-bg',
30
- '@dropdowneditor-button-active-bg',
31
- '@tabs-border-color',
32
- '@tabs-focused-border-color',
33
- '@tabs-tab-hover-bg',
34
- '@switch-border-color',
35
- '@switch-handle-active-bg',
36
- '@switch-hover-border-color',
37
- '@switch-focused-border-color',
38
- '@switch-container-active-bg',
39
- '@switch-active-border-color',
40
- '@datagrid-base-color',
41
- '@datagrid-base-background-color',
42
- '@datagrid-border-color',
43
- '@datagrid-hover-bg',
44
- '@datagrid-row-hovered-color',
45
- '@datagrid-nodata-color',
46
- '@datagrid-link-color',
47
- '@datagrid-columnchooser-bg',
48
- '@PIVOTGRID_BORDER_COLOR',
49
- '@PIVOTGRID_DATA_AREA_COLOR',
50
- '@scheduler-cell-hover-bg',
51
- '@SCHEDULER_PANEL_TEXT_COLOR',
52
- '@SCHEDULER_WORKSPACE_BACKGROUND_COLOR',
53
- '@SCHEDULER_WORKSPACE_ACCENT_COLOR',
54
- '@menu-popup-bg',
55
- '@menu-item-hover-bg',
56
- '@menu-color',
57
- '@menu-item-hovered-color',
58
- '@menu-popup-border-color',
59
- '@calendar-color',
60
- '@calendar-hover-bg',
61
- '@calendar-border-color',
62
- '@calendar-cell-active-bg',
63
- '@treeview-hover-bg',
64
- '@treeview-border-color',
65
- '@form-field-item-color',
66
- '@filterbuilder-bg',
67
- ],
68
- material: [
69
- '@radiogroup-checked-bg',
70
- '@radiogroup-border-color',
71
- '@radiogroup-bg',
72
- '@accordion-color',
73
- '@accordion-background-color',
74
- '@accordion-title-active-color',
75
- '@accordion-item-hover-bg',
76
- '@accordion-title-active-bg',
77
- '@checkbox-border-color',
78
- '@checkbox-bg',
79
- '@checkbox-hover-border-color',
80
- '@base-invalid-color',
81
- '@base-invalid-faded-border-color',
82
- '@list-border-color',
83
- '@list-normal-color',
84
- '@list-item-hover-bg',
85
- '@list-item-focused-selected-bg',
86
- '@datagrid-base-color',
87
- '@datagrid-base-background-color',
88
- '@datagrid-border-color',
89
- '@datagrid-hover-bg',
90
- '@datagrid-row-hovered-color',
91
- '@datagrid-nodata-color',
92
- '@datagrid-link-color',
93
- '@datagrid-columnchooser-bg',
94
- '@PIVOTGRID_BORDER_COLOR',
95
- '@PIVOTGRID_DATA_AREA_COLOR',
96
- '@scheduler-cell-hover-bg',
97
- '@SCHEDULER_PANEL_TEXT_COLOR',
98
- '@SCHEDULER_WORKSPACE_BACKGROUND_COLOR',
99
- '@SCHEDULER_WORKSPACE_ACCENT_COLOR',
100
- '@menu-popup-bg',
101
- '@menu-item-hover-bg',
102
- '@menu-color',
103
- '@menu-popup-border-color',
104
- '@calendar-color',
105
- '@calendar-hover-bg',
106
- '@calendar-cell-active-bg',
107
- '@treeview-hover-bg',
108
- '@treeview-border-color',
109
- '@form-field-item-color',
110
- '@filterbuilder-bg',
111
- '@datagrid-chevron-icon-color',
112
- '@datagrid-filter-row-background-color',
113
- '@datagrid-active-header-filter-icon-color',
114
- '@datagrid-filter-panel-color',
115
- '@pivotgrid-chevron-icon-color',
116
- '@menu-item-expanded-color',
117
- '@numberbox-spin-icon-color',
118
- '@treeview-spin-icon-color',
119
- ],
120
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ generic: [
5
+ '@radiogroup-checked-bg',
6
+ '@radiogroup-border-color',
7
+ '@radiogroup-bg',
8
+ '@radiobutton-active-bg',
9
+ '@radiogroup-hover-border-color',
10
+ '@radiobutton-focused-border-color',
11
+ '@accordion-color',
12
+ '@accordion-item-focused-border-color',
13
+ '@accordion-background-color',
14
+ '@accordion-title-active-color',
15
+ '@accordion-item-hover-bg',
16
+ '@accordion-title-active-bg',
17
+ '@checkbox-border-color',
18
+ '@checkbox-focused-borderd-color',
19
+ '@checkbox-bg',
20
+ '@checkbox-hover-border-color',
21
+ '@checkbox-active-icon-bg',
22
+ '@base-invalid-color',
23
+ '@base-invalid-faded-border-color',
24
+ '@list-border-color',
25
+ '@list-normal-color',
26
+ '@list-item-hover-bg',
27
+ '@list-item-focused-selected-bg',
28
+ '@list-focused-bg',
29
+ '@dropdowneditor-button-hover-bg',
30
+ '@dropdowneditor-button-active-bg',
31
+ '@tabs-border-color',
32
+ '@tabs-focused-border-color',
33
+ '@tabs-tab-hover-bg',
34
+ '@switch-border-color',
35
+ '@switch-handle-active-bg',
36
+ '@switch-hover-border-color',
37
+ '@switch-focused-border-color',
38
+ '@switch-container-active-bg',
39
+ '@switch-active-border-color',
40
+ '@datagrid-base-color',
41
+ '@datagrid-base-background-color',
42
+ '@datagrid-border-color',
43
+ '@datagrid-hover-bg',
44
+ '@datagrid-row-hovered-color',
45
+ '@datagrid-nodata-color',
46
+ '@datagrid-link-color',
47
+ '@datagrid-columnchooser-bg',
48
+ '@PIVOTGRID_BORDER_COLOR',
49
+ '@PIVOTGRID_DATA_AREA_COLOR',
50
+ '@scheduler-cell-hover-bg',
51
+ '@SCHEDULER_PANEL_TEXT_COLOR',
52
+ '@SCHEDULER_WORKSPACE_BACKGROUND_COLOR',
53
+ '@SCHEDULER_WORKSPACE_ACCENT_COLOR',
54
+ '@menu-popup-bg',
55
+ '@menu-item-hover-bg',
56
+ '@menu-color',
57
+ '@menu-item-hovered-color',
58
+ '@menu-popup-border-color',
59
+ '@calendar-color',
60
+ '@calendar-hover-bg',
61
+ '@calendar-border-color',
62
+ '@calendar-cell-active-bg',
63
+ '@treeview-hover-bg',
64
+ '@treeview-border-color',
65
+ '@form-field-item-color',
66
+ '@filterbuilder-bg',
67
+ ],
68
+ material: [
69
+ '@radiogroup-checked-bg',
70
+ '@radiogroup-border-color',
71
+ '@radiogroup-bg',
72
+ '@accordion-color',
73
+ '@accordion-background-color',
74
+ '@accordion-title-active-color',
75
+ '@accordion-item-hover-bg',
76
+ '@accordion-title-active-bg',
77
+ '@checkbox-border-color',
78
+ '@checkbox-bg',
79
+ '@checkbox-hover-border-color',
80
+ '@base-invalid-color',
81
+ '@base-invalid-faded-border-color',
82
+ '@list-border-color',
83
+ '@list-normal-color',
84
+ '@list-item-hover-bg',
85
+ '@list-item-focused-selected-bg',
86
+ '@datagrid-base-color',
87
+ '@datagrid-base-background-color',
88
+ '@datagrid-border-color',
89
+ '@datagrid-hover-bg',
90
+ '@datagrid-row-hovered-color',
91
+ '@datagrid-nodata-color',
92
+ '@datagrid-link-color',
93
+ '@datagrid-columnchooser-bg',
94
+ '@PIVOTGRID_BORDER_COLOR',
95
+ '@PIVOTGRID_DATA_AREA_COLOR',
96
+ '@scheduler-cell-hover-bg',
97
+ '@SCHEDULER_PANEL_TEXT_COLOR',
98
+ '@SCHEDULER_WORKSPACE_BACKGROUND_COLOR',
99
+ '@SCHEDULER_WORKSPACE_ACCENT_COLOR',
100
+ '@menu-popup-bg',
101
+ '@menu-item-hover-bg',
102
+ '@menu-color',
103
+ '@menu-popup-border-color',
104
+ '@calendar-color',
105
+ '@calendar-hover-bg',
106
+ '@calendar-cell-active-bg',
107
+ '@treeview-hover-bg',
108
+ '@treeview-border-color',
109
+ '@form-field-item-color',
110
+ '@filterbuilder-bg',
111
+ '@datagrid-chevron-icon-color',
112
+ '@datagrid-filter-row-background-color',
113
+ '@datagrid-active-header-filter-icon-color',
114
+ '@datagrid-filter-panel-color',
115
+ '@pivotgrid-chevron-icon-color',
116
+ '@menu-item-expanded-color',
117
+ '@numberbox-spin-icon-color',
118
+ '@treeview-spin-icon-color',
119
+ ],
120
+ };
@@ -6,8 +6,8 @@
6
6
  height: 100%;
7
7
  width: 100%;
8
8
 
9
- &:not(.dx-drawer-opened) > {
10
- .dx-drawer-wrapper > .dx-drawer-panel-content:not(.dx-drawer-panel-content-has-min-size) {
9
+ .dx-drawer-wrapper > .dx-drawer-panel-content {
10
+ &.dx-drawer-panel-content-hidden {
11
11
  visibility: hidden;
12
12
  }
13
13
  }
@@ -465,8 +465,14 @@
465
465
 
466
466
  .dx-editor-cell {
467
467
  max-width: 0;
468
- padding: 0;
469
468
  vertical-align: middle;
469
+ padding-top: 0;
470
+ padding-right: 0;
471
+ padding-bottom: 0;
472
+
473
+ &:not(.dx-#{$widget-name}-cell-expandable) {
474
+ padding-left: 0;
475
+ }
470
476
 
471
477
  .dx-texteditor,
472
478
  .dx-texteditor-container {
@@ -331,7 +331,10 @@ $fluent-grid-base-group-panel-message-line-height: $fluent-button-text-line-heig
331
331
 
332
332
  &.dx-editor-cell:not(.dx-command-select) {
333
333
  padding-right: 0;
334
- padding-left: 0;
334
+
335
+ &:not(.dx-#{$widget-name}-cell-expandable) {
336
+ padding-left: 0;
337
+ }
335
338
  }
336
339
  }
337
340
  }
@@ -309,7 +309,10 @@ $material-grid-base-group-panel-message-line-height: $material-button-text-line-
309
309
 
310
310
  &.dx-editor-cell:not(.dx-command-select) {
311
311
  padding-right: 0;
312
- padding-left: 0;
312
+
313
+ &:not(.dx-#{$widget-name}-cell-expandable) {
314
+ padding-left: 0;
315
+ }
313
316
  }
314
317
  }
315
318
  }
@@ -1,2 +1,2 @@
1
- "use strict";
2
- module.exports = ['@base-accent', '@base-text-color', '@base-bg', '@base-border-color', '@base-border-radius'];
1
+ "use strict";
2
+ module.exports = ['@base-accent', '@base-text-color', '@base-bg', '@base-border-color', '@base-border-radius'];
@@ -1,168 +1,174 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- const sass = __importStar(require("sass-embedded"));
39
- const less_1 = __importDefault(require("less"));
40
- const fs_1 = require("fs");
41
- const bootstrap3_metadata_1 = __importDefault(require("../data/bootstrap-metadata/bootstrap3-metadata"));
42
- const bootstrap4_metadata_1 = __importDefault(require("../data/bootstrap-metadata/bootstrap4-metadata"));
43
- const bootstrap5_metadata_1 = __importDefault(require("../data/bootstrap-metadata/bootstrap5-metadata"));
44
- class BootstrapExtractor {
45
- constructor(source, version) {
46
- this.input = source;
47
- this.version = version;
48
- if (version === 3) {
49
- this.compiler = BootstrapExtractor.lessRender;
50
- this.sourceProcessor = this.lessProcessor;
51
- this.meta = bootstrap3_metadata_1.default;
52
- }
53
- else {
54
- this.compiler = BootstrapExtractor.sassRender;
55
- this.sourceProcessor = this.sassProcessor;
56
- this.meta = version === 4
57
- ? bootstrap4_metadata_1.default
58
- : bootstrap5_metadata_1.default;
59
- }
60
- }
61
- getRootVariablesSass() {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- const result = [];
64
- if (this.version === 3 || this.version === 4) {
65
- return result;
66
- }
67
- const path = require.resolve(`bootstrap${this.version}/dist/css/bootstrap.css`);
68
- const content = yield fs_1.promises.readFile(path, 'utf8');
69
- const rootVariables = new RegExp(':root(,.+?])? {.+?}', 's').exec(content)[0];
70
- const ruleRegex = /(--.+): (.+);/gm;
71
- let match = ruleRegex.exec(rootVariables);
72
- while (match !== null) {
73
- const key = match[1];
74
- const value = match[2];
75
- result.push({ key, value });
76
- match = ruleRegex.exec(rootVariables);
77
- }
78
- return result;
79
- });
80
- }
81
- static sassRender(input) {
82
- return __awaiter(this, void 0, void 0, function* () {
83
- return new Promise((resolve, reject) => {
84
- sass.compileStringAsync(input)
85
- .then((data) => resolve(data.css.toString()))
86
- .catch((error) => reject(error.message));
87
- });
88
- });
89
- }
90
- static lessRender(input) {
91
- return __awaiter(this, void 0, void 0, function* () {
92
- return new Promise((resolve, reject) => {
93
- less_1.default.render(input, (error, result) => (error ? reject(error.message) : resolve(result.css)));
94
- });
95
- });
96
- }
97
- static convertRemToPx(cssValue) {
98
- const remValueRegex = /(\d*?\.?\d+?)rem([;\s])?/g;
99
- const replaceHandler = (_match, value, separator) => {
100
- const pixelsInRem = 16;
101
- const pxValue = Math.round(parseFloat(value) * pixelsInRem);
102
- return `${pxValue}px${separator || ''}`;
103
- };
104
- return cssValue.replace(remValueRegex, replaceHandler);
105
- }
106
- readSassFile(fileName) {
107
- return __awaiter(this, void 0, void 0, function* () {
108
- const path = require.resolve(`bootstrap${this.version}/scss/${fileName}`);
109
- return fs_1.promises.readFile(path, 'utf8');
110
- });
111
- }
112
- sassProcessor() {
113
- return __awaiter(this, void 0, void 0, function* () {
114
- const functions = yield this.readSassFile('_functions.scss');
115
- const variables = yield this.readSassFile('_variables.scss');
116
- const result = `${functions}
117
- ${variables}
118
- ${this.input}
119
- ${this.getSetterServiceCode('!default')}
120
- ${this.getCollectorServiceCode()}`;
121
- return result;
122
- });
123
- }
124
- lessProcessor() {
125
- return __awaiter(this, void 0, void 0, function* () {
126
- return Promise.resolve(this.getSetterServiceCode()
127
- + this.input
128
- + this.getCollectorServiceCode());
129
- });
130
- }
131
- getSetterServiceCode(postfix = '') {
132
- return Object.keys(this.meta)
133
- .map((key) => `${this.meta[key]}: dx-empty ${postfix};\n`)
134
- .join('');
135
- }
136
- getCollectorServiceCode() {
137
- const variables = Object.keys(this.meta)
138
- .map((key) => `${key}: ${this.meta[key]};`)
139
- .join('');
140
- return `dx-varibles-collector {${variables}}`;
141
- }
142
- extract() {
143
- return __awaiter(this, void 0, void 0, function* () {
144
- const css = yield this.compiler(yield this.sourceProcessor());
145
- const serviceCodeRegex = /dx-varibles-collector\s{([\s\S]*)}/;
146
- const ruleRegex = /([\w-]*):\s(.*);/g;
147
- const serviceCode = serviceCodeRegex.exec(css)[1];
148
- const rootVariables = yield this.getRootVariablesSass();
149
- const result = [];
150
- let match = ruleRegex.exec(serviceCode);
151
- while (match !== null) {
152
- const key = `$${match[1]}`;
153
- let valueMatch = match[2];
154
- if (valueMatch !== 'dx-empty') {
155
- if (valueMatch.startsWith('var')) {
156
- const cssVariableName = valueMatch.replace('var(', '').replace(')', '');
157
- valueMatch = rootVariables.find((item) => item.key === cssVariableName).value;
158
- }
159
- const value = BootstrapExtractor.convertRemToPx(valueMatch);
160
- result.push({ key, value });
161
- }
162
- match = ruleRegex.exec(serviceCode);
163
- }
164
- return result;
165
- });
166
- }
167
- }
168
- exports.default = BootstrapExtractor;
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
35
+ return (mod && mod.__esModule) ? mod : { "default": mod };
36
+ };
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ const sass = __importStar(require("sass-embedded"));
39
+ const less_1 = __importDefault(require("less"));
40
+ const fs_1 = require("fs");
41
+ const bootstrap3_metadata_1 = __importDefault(require("../data/bootstrap-metadata/bootstrap3-metadata"));
42
+ const bootstrap4_metadata_1 = __importDefault(require("../data/bootstrap-metadata/bootstrap4-metadata"));
43
+ const bootstrap5_metadata_1 = __importDefault(require("../data/bootstrap-metadata/bootstrap5-metadata"));
44
+ class BootstrapExtractor {
45
+ constructor(source, version) {
46
+ this.input = source;
47
+ this.version = version;
48
+ if (version === 3) {
49
+ this.compiler = BootstrapExtractor.lessRender;
50
+ this.sourceProcessor = this.lessProcessor;
51
+ this.meta = bootstrap3_metadata_1.default;
52
+ }
53
+ else {
54
+ this.compiler = BootstrapExtractor.sassRender;
55
+ this.sourceProcessor = this.sassProcessor;
56
+ this.meta = version === 4
57
+ ? bootstrap4_metadata_1.default
58
+ : bootstrap5_metadata_1.default;
59
+ }
60
+ }
61
+ getRootVariablesSass() {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const result = [];
64
+ if (this.version === 3 || this.version === 4) {
65
+ return result;
66
+ }
67
+ const path = require.resolve(`bootstrap${this.version}/dist/css/bootstrap.css`);
68
+ const content = yield fs_1.promises.readFile(path, 'utf8');
69
+ const rootVariables = new RegExp(':root(,.+?])? {.+?}', 's').exec(content)[0];
70
+ const ruleRegex = /(--.+): (.+);/gm;
71
+ let match = ruleRegex.exec(rootVariables);
72
+ while (match !== null) {
73
+ const key = match[1];
74
+ const value = match[2];
75
+ result.push({ key, value });
76
+ match = ruleRegex.exec(rootVariables);
77
+ }
78
+ return result;
79
+ });
80
+ }
81
+ static sassRender(input) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ return new Promise((resolve, reject) => {
84
+ sass.compileStringAsync(input)
85
+ .then((data) => resolve(data.css.toString()))
86
+ .catch((error) => reject(error.message));
87
+ });
88
+ });
89
+ }
90
+ static lessRender(input) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ return new Promise((resolve, reject) => {
93
+ less_1.default.render(input, (error, result) => (error ? reject(error.message) : resolve(result.css)));
94
+ });
95
+ });
96
+ }
97
+ static convertRemToPx(cssValue) {
98
+ const remValueRegex = /(\d*?\.?\d+?)rem([;\s])?/g;
99
+ const replaceHandler = (_match, value, separator) => {
100
+ const pixelsInRem = 16;
101
+ const pxValue = Math.round(parseFloat(value) * pixelsInRem);
102
+ return `${pxValue}px${separator || ''}`;
103
+ };
104
+ return cssValue.replace(remValueRegex, replaceHandler);
105
+ }
106
+ readSassFile(fileName) {
107
+ return __awaiter(this, void 0, void 0, function* () {
108
+ const path = this.getFilePath(fileName);
109
+ return fs_1.promises.readFile(path, 'utf8');
110
+ });
111
+ }
112
+ sassProcessor() {
113
+ return __awaiter(this, void 0, void 0, function* () {
114
+ const functions = yield this.readSassFile('_functions.scss');
115
+ const variables = yield this.readSassFile('_variables.scss');
116
+ const variablesDarkFile = '_variables-dark.scss';
117
+ const variablesDark = this.version === 5 && (0, fs_1.existsSync)(this.getFilePath(variablesDarkFile)) ? yield this.readSassFile(variablesDarkFile) : ''; // TODO: can be removed safely in bootstrap@6
118
+ const result = `${functions}
119
+ ${variables.replace('@import "variables-dark";', '')}
120
+ ${variablesDark}
121
+ ${this.input}
122
+ ${this.getSetterServiceCode('!default')}
123
+ ${this.getCollectorServiceCode()}`;
124
+ return result;
125
+ });
126
+ }
127
+ lessProcessor() {
128
+ return __awaiter(this, void 0, void 0, function* () {
129
+ return Promise.resolve(this.getSetterServiceCode()
130
+ + this.input
131
+ + this.getCollectorServiceCode());
132
+ });
133
+ }
134
+ getFilePath(fileName) {
135
+ return require.resolve(`bootstrap${this.version}/scss/${fileName}`);
136
+ }
137
+ getSetterServiceCode(postfix = '') {
138
+ return Object.keys(this.meta)
139
+ .map((key) => `${this.meta[key]}: dx-empty ${postfix};\n`)
140
+ .join('');
141
+ }
142
+ getCollectorServiceCode() {
143
+ const variables = Object.keys(this.meta)
144
+ .map((key) => `${key}: ${this.meta[key]};`)
145
+ .join('');
146
+ return `dx-varibles-collector {${variables}}`;
147
+ }
148
+ extract() {
149
+ return __awaiter(this, void 0, void 0, function* () {
150
+ const css = yield this.compiler(yield this.sourceProcessor());
151
+ const serviceCodeRegex = /dx-varibles-collector\s{([\s\S]*)}/;
152
+ const ruleRegex = /([\w-]*):\s(.*);/g;
153
+ const serviceCode = serviceCodeRegex.exec(css)[1];
154
+ const rootVariables = yield this.getRootVariablesSass();
155
+ const result = [];
156
+ let match = ruleRegex.exec(serviceCode);
157
+ while (match !== null) {
158
+ const key = `$${match[1]}`;
159
+ let valueMatch = match[2];
160
+ if (valueMatch !== 'dx-empty') {
161
+ if (valueMatch.startsWith('var')) {
162
+ const cssVariableName = valueMatch.replace('var(', '').replace(')', '');
163
+ valueMatch = rootVariables.find((item) => item.key === cssVariableName).value;
164
+ }
165
+ const value = BootstrapExtractor.convertRemToPx(valueMatch);
166
+ result.push({ key, value });
167
+ }
168
+ match = ruleRegex.exec(serviceCode);
169
+ }
170
+ return result;
171
+ });
172
+ }
173
+ }
174
+ exports.default = BootstrapExtractor;