@mlut/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -0
- package/_index.scss +1 -0
- package/_tools.scss +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/jit/JitEngine.d.ts +19 -0
- package/dist/jit/JitEngine.js +124 -0
- package/dist/jit/index.d.ts +1 -0
- package/dist/jit/index.js +1 -0
- package/dist/sass/addons/demo-theme.scss +112 -0
- package/dist/sass/css/_base-setup.scss +3 -0
- package/dist/sass/css/_index.scss +2 -0
- package/dist/sass/css/helpers/_index.scss +3 -0
- package/dist/sass/css/helpers/btn.scss +28 -0
- package/dist/sass/css/helpers/gs-debug.scss +28 -0
- package/dist/sass/css/helpers/ratio-box.scss +47 -0
- package/dist/sass/css/helpers/row.scss +98 -0
- package/dist/sass/css/helpers/wrapper.scss +21 -0
- package/dist/sass/css/styles/_index.scss +2 -0
- package/dist/sass/css/styles/generic.scss +296 -0
- package/dist/sass/css/styles/variables.scss +32 -0
- package/dist/sass/css/utils/_bg-bd.scss +27 -0
- package/dist/sass/css/utils/_grid.scss +37 -0
- package/dist/sass/css/utils/_index.scss +2 -0
- package/dist/sass/css/utils/_load.scss +9 -0
- package/dist/sass/css/utils/_transition.scss +16 -0
- package/dist/sass/css/utils/box-alignment.scss +29 -0
- package/dist/sass/css/utils/box-model.scss +48 -0
- package/dist/sass/css/utils/grid-system.scss +17 -0
- package/dist/sass/css/utils/init.scss +107 -0
- package/dist/sass/css/utils/other.scss +35 -0
- package/dist/sass/css/utils/text.scss +33 -0
- package/dist/sass/css/utils/visual.scss +32 -0
- package/dist/sass/index.scss +4 -0
- package/dist/sass/tools/_index.scss +4 -0
- package/dist/sass/tools/functions/_index.import.scss +3 -0
- package/dist/sass/tools/functions/_index.scss +9 -0
- package/dist/sass/tools/functions/base/_error.scss +9 -0
- package/dist/sass/tools/functions/base/_getters.scss +124 -0
- package/dist/sass/tools/functions/base/_index.scss +11 -0
- package/dist/sass/tools/functions/base/_list.scss +56 -0
- package/dist/sass/tools/functions/base/_math.scss +149 -0
- package/dist/sass/tools/functions/base/_string.scss +300 -0
- package/dist/sass/tools/functions/common/_custom-units.scss +231 -0
- package/dist/sass/tools/functions/common/_forward-tools.scss +2 -0
- package/dist/sass/tools/functions/common/_helpers.scss +57 -0
- package/dist/sass/tools/functions/common/_index.scss +9 -0
- package/dist/sass/tools/functions/common/_utils.scss +211 -0
- package/dist/sass/tools/functions/high/_at-rules.scss +296 -0
- package/dist/sass/tools/functions/high/_forward-tools.scss +3 -0
- package/dist/sass/tools/functions/high/_index.scss +8 -0
- package/dist/sass/tools/functions/high/utils/_index.scss +288 -0
- package/dist/sass/tools/functions/high/utils/_parse-util.scss +107 -0
- package/dist/sass/tools/functions/high/utils/_range-generators.scss +355 -0
- package/dist/sass/tools/functions/high/utils/_util-apply-selector.scss +134 -0
- package/dist/sass/tools/functions/high/utils/_value-converters.scss +294 -0
- package/dist/sass/tools/functions/high/utils/_value-transformers.scss +65 -0
- package/dist/sass/tools/mixins/_index.import.scss +2 -0
- package/dist/sass/tools/mixins/_index.scss +8 -0
- package/dist/sass/tools/mixins/base/_forward-tools.scss +2 -0
- package/dist/sass/tools/mixins/base/_index.scss +93 -0
- package/dist/sass/tools/mixins/base/_mk-ar.scss +96 -0
- package/dist/sass/tools/mixins/base/_mk-state.scss +175 -0
- package/dist/sass/tools/mixins/high/_forward-tools.scss +3 -0
- package/dist/sass/tools/mixins/high/_index.scss +1 -0
- package/dist/sass/tools/mixins/high/utils/_index.scss +188 -0
- package/dist/sass/tools/mixins/high/utils/_mk-util.scss +366 -0
- package/dist/sass/tools/settings/_index.import.scss +3 -0
- package/dist/sass/tools/settings/_index.scss +3 -0
- package/dist/sass/tools/settings/base/_general.scss +175 -0
- package/dist/sass/tools/settings/base/_index.scss +2 -0
- package/dist/sass/tools/settings/base/_utils.scss +578 -0
- package/dist/sass/tools/settings/common/_at-rules.scss +213 -0
- package/dist/sass/tools/settings/common/_index.scss +2 -0
- package/dist/sass/tools/settings/common/_utils.scss +1926 -0
- package/dist/sass/tools/settings/high/_forward-tools.scss +2 -0
- package/dist/sass/tools/settings/high/_grid.scss +55 -0
- package/dist/sass/tools/settings/high/_index.scss +2 -0
- package/dist/sass/tools/settings/high/_utils.scss +104 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.js +13 -0
- package/package.json +48 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:list';
|
|
3
|
+
@use 'sass:map';
|
|
4
|
+
@use 'sass:math';
|
|
5
|
+
@use 'sass:string';
|
|
6
|
+
@use 'sass:selector';
|
|
7
|
+
|
|
8
|
+
@use '../forward-tools' as ml;
|
|
9
|
+
|
|
10
|
+
// mk-util
|
|
11
|
+
//
|
|
12
|
+
// Creates utilities based on a map or a list with values. Simple examples you can see [here](section-how_to.html#kssref-how_to-mk_utils).
|
|
13
|
+
//
|
|
14
|
+
// Even if you started using a map, you can still use the conversion of values. To do this, specify `null` instead of CSS values. And if you want that CSS value corresponds to the value of the utility, use `false`:
|
|
15
|
+
// ```scss
|
|
16
|
+
// @include ml.mk-util(
|
|
17
|
+
// 'Mxw', (
|
|
18
|
+
// 500: false,
|
|
19
|
+
// 'sm0': 560px,
|
|
20
|
+
// 'n': null,
|
|
21
|
+
// [5e, 7]: null,
|
|
22
|
+
// ));
|
|
23
|
+
//
|
|
24
|
+
// // CSS
|
|
25
|
+
// .Mxw500 {
|
|
26
|
+
// max-width: 500;
|
|
27
|
+
// }
|
|
28
|
+
//
|
|
29
|
+
// .Mxw-sm0 {
|
|
30
|
+
// max-width: 560px;
|
|
31
|
+
// }
|
|
32
|
+
//
|
|
33
|
+
// .Mxw-n {
|
|
34
|
+
// max-width: none;
|
|
35
|
+
// }
|
|
36
|
+
//
|
|
37
|
+
// .Mxw5e {
|
|
38
|
+
// max-width: 5em;
|
|
39
|
+
// }
|
|
40
|
+
//
|
|
41
|
+
// // etc
|
|
42
|
+
// ```
|
|
43
|
+
// Do not forget that you can use Generation Syntax for any utility value. This is available, both in a map of values and in the list.
|
|
44
|
+
// ```scss
|
|
45
|
+
// @include ml.mk-util(
|
|
46
|
+
// 'Mxw', (
|
|
47
|
+
// 'sm0_ af bf': 560px,
|
|
48
|
+
// ));
|
|
49
|
+
//
|
|
50
|
+
// @include ml.mk-util(
|
|
51
|
+
// 'Mxw', (
|
|
52
|
+
// ':f _100_ +:h',
|
|
53
|
+
// '@:pr _10p',
|
|
54
|
+
// ));
|
|
55
|
+
// ```
|
|
56
|
+
//
|
|
57
|
+
// $raw-name - `string` <div> name of the utility. You can use [generation syntax](section-concepts.html#kssref-concepts-util-components-syntax) here </div>
|
|
58
|
+
// $values - <div class="Mt3u"> `list | map` </div> You can specify a map with utility values and CSS properties values. Or you can pass a list with only utility values. It will be converted to CSS values depends on conversion type of utility
|
|
59
|
+
// $components = () - <div class="Mt3u"> `map` </div> Contains utility [components](section-concepts.html#kssref-concepts-util-components) in longhand format
|
|
60
|
+
// $options = () - <div class="Mt3u"> `map` </div> Options of utilities, similarly to [those](section-settings.html#kssref-settings-utils-data-options) that are in the utility registry. Here you can change the options for a specific set of values without changing the main utility options. Also, you can create a new utility in-place, without registration ~~and SMS~~
|
|
61
|
+
//
|
|
62
|
+
// Styleguide: sass-tools.mixins.utils.mk_util
|
|
63
|
+
|
|
64
|
+
@mixin mk-util($raw-name, $values, $components: (), $options: ()) {
|
|
65
|
+
$util-data: ml.parse-util($raw-name);
|
|
66
|
+
$util-name: map.get($util-data, 'value');
|
|
67
|
+
$is-range: map.has-key($options, 'isRange');
|
|
68
|
+
|
|
69
|
+
$main-options: if(
|
|
70
|
+
$is-range,
|
|
71
|
+
$options,
|
|
72
|
+
-util-main-options($util-name, $options),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
$props: map.get($main-options, 'properties');
|
|
76
|
+
$custom-selector: map.get($main-options, 'selector');
|
|
77
|
+
$bound-comp-str: map.get($main-options, 'components');
|
|
78
|
+
$bound-components: $bound-comp-str and ml.parse-util($bound-comp-str);
|
|
79
|
+
$is-bound-comp: list.length($bound-components) > 1;
|
|
80
|
+
$range-generator: map.get(
|
|
81
|
+
ml.$utils-cfg,
|
|
82
|
+
'range-generators',
|
|
83
|
+
(
|
|
84
|
+
map.get($main-options, 'range-generator')
|
|
85
|
+
or 'number'
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
$class-name: if(
|
|
90
|
+
$bound-components,
|
|
91
|
+
map.get($bound-components, 'value'),
|
|
92
|
+
$util-name
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
@if not map.has-key(ml.$utils-db, 'utils', 'registry', $util-name) {
|
|
96
|
+
ml.$utils-db: map.set(
|
|
97
|
+
ml.$utils-db, 'utils', 'registry', $util-name, if($options, $options, $props)
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@if $is-bound-comp {
|
|
102
|
+
$util-data: $bound-components;
|
|
103
|
+
} @else if list.length($components) > 0 {
|
|
104
|
+
$util-data: $components;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
$is-values-map: meta.type-of($values) == 'map';
|
|
108
|
+
$is-bound-comp: $is-bound-comp or map.get($main-options, 'groupBoundComp');
|
|
109
|
+
$new-keywords: ();
|
|
110
|
+
$i: 1;
|
|
111
|
+
|
|
112
|
+
@each $key, $value in $values {
|
|
113
|
+
$range-list: if($is-values-map, $key, list.nth($values, $i));
|
|
114
|
+
$range-data: null;
|
|
115
|
+
|
|
116
|
+
@if list.is-bracketed($range-list) {
|
|
117
|
+
$range-data: meta.call($range-generator, $range-list, $util-name);
|
|
118
|
+
} @else if meta.type-of($key) == 'string' and string.index($key, ml.$kUvKA) {
|
|
119
|
+
$range-data: ml.expand-util-kw-alias($key, $util-name);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@if $range-data {
|
|
123
|
+
@if not map.has-key($range-data, 'components') {
|
|
124
|
+
$range-data: map.set($range-data, 'components', $util-data);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@include mk-util(
|
|
128
|
+
$util-name,
|
|
129
|
+
$options: map.set($main-options, 'isRange', true),
|
|
130
|
+
$range-data...
|
|
131
|
+
);
|
|
132
|
+
} @else {
|
|
133
|
+
$util-val-data: ml.parse-util($key);
|
|
134
|
+
$util-parsed-val: map.get($util-val-data, 'value');
|
|
135
|
+
|
|
136
|
+
@if $is-bound-comp or list.length($util-val-data) < 2 {
|
|
137
|
+
$util-val-data: $util-data;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
$at-rules: map.get($util-val-data, 'at-rules');
|
|
141
|
+
$post-states: map.get($util-val-data, 'post-states');
|
|
142
|
+
$pre-states: map.get($util-val-data, 'pre-states');
|
|
143
|
+
$is-important: map.get($util-val-data, 'important');
|
|
144
|
+
$css-values: $value;
|
|
145
|
+
|
|
146
|
+
@if $css-values == null {
|
|
147
|
+
$css-values: ml.convert-util-value($util-parsed-val, $util-name);
|
|
148
|
+
} @else if $css-values == false {
|
|
149
|
+
$css-values: $util-parsed-val;
|
|
150
|
+
} @else if not $is-range {
|
|
151
|
+
$new-keywords: map.set($new-keywords, $util-parsed-val + '', $value);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
$separated-value: ml.util-separated-value($util-parsed-val);
|
|
155
|
+
$this-util: (
|
|
156
|
+
'name': $util-name,
|
|
157
|
+
'value': $separated-value
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
@if $class-name == '' {
|
|
161
|
+
$separated-value: $util-parsed-val;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@if $is-important {
|
|
165
|
+
$separated-value: $separated-value + ml.$tUIm;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
$selector: ml.str-escape(
|
|
169
|
+
ml.$class-prefix + $class-name + $separated-value
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
$val-feat-str: meta.inspect(
|
|
173
|
+
map.values(map.remove($util-val-data, 'value'))
|
|
174
|
+
);
|
|
175
|
+
$st-only: string.index($val-feat-str, ml.$kStOl);
|
|
176
|
+
$ar-st-only: string.index($val-feat-str, ml.$kArSO);
|
|
177
|
+
$ar-st: string.index($val-feat-str, ml.$kArSt);
|
|
178
|
+
$args: (
|
|
179
|
+
$props,
|
|
180
|
+
$css-values,
|
|
181
|
+
$is-important,
|
|
182
|
+
map.get($main-options, 'repeat-prop-values'),
|
|
183
|
+
map.get($main-options, 'preset-properties'),
|
|
184
|
+
$util-name,
|
|
185
|
+
$util-parsed-val,
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
@if not string.index($val-feat-str, ml.$kArOl) and not $ar-st-only {
|
|
189
|
+
@include ml.mk-state(
|
|
190
|
+
$post-states,
|
|
191
|
+
$pre-states,
|
|
192
|
+
not $st-only,
|
|
193
|
+
$selector,
|
|
194
|
+
$class-name,
|
|
195
|
+
$custom-selector,
|
|
196
|
+
) {
|
|
197
|
+
@include -generate-props($args...);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@if $at-rules {
|
|
202
|
+
@include ml.mk-ar($at-rules, $this-util) using ($ar) {
|
|
203
|
+
$util-selector: '.' + ml.str-escape($ar + ml.$tUCm) + $selector;
|
|
204
|
+
|
|
205
|
+
@if not $ar-st-only {
|
|
206
|
+
@at-root {
|
|
207
|
+
#{ml.util-apply-selector($custom-selector, $util-selector)} {
|
|
208
|
+
@include -generate-props($args...);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@if $ar-st or $ar-st-only {
|
|
214
|
+
@include ml.mk-state(
|
|
215
|
+
$post-states,
|
|
216
|
+
$pre-states,
|
|
217
|
+
false,
|
|
218
|
+
$util-selector,
|
|
219
|
+
$class-name,
|
|
220
|
+
$custom-selector,
|
|
221
|
+
) {
|
|
222
|
+
@include -generate-props($args...);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
$i: $i + 1;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@if list.length($new-keywords) > 0 {
|
|
233
|
+
@include -save-new-keywords(
|
|
234
|
+
$new-keywords, $util-name, $props, map.get($main-options, 'groupItemIndex')
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@mixin -save-new-keywords($new-keywords, $util-name, $props, $group-item-index) {
|
|
240
|
+
$conversion: (
|
|
241
|
+
map.get(ml.$utils-db, 'utils', 'registry', $util-name, 'conversion') or
|
|
242
|
+
'default'
|
|
243
|
+
);
|
|
244
|
+
$converters-list: map.get(ml.$utils-cfg, 'conversion-types', $conversion);
|
|
245
|
+
|
|
246
|
+
@if list.nth($converters-list, 1) != 'color' {
|
|
247
|
+
$util-keywords: map.get(
|
|
248
|
+
ml.$utils-db, 'utils', 'registry', $util-name, 'keywords'
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
$util-map: (
|
|
252
|
+
'properties': $props,
|
|
253
|
+
);
|
|
254
|
+
|
|
255
|
+
@if not list.index($converters-list, 'keyword') {
|
|
256
|
+
$conversion: 'kw_' + $conversion;
|
|
257
|
+
$util-map: map.set($util-map, 'conversion', $conversion);
|
|
258
|
+
|
|
259
|
+
@if not map.has-key(ml.$utils-cfg, 'conversion-types', $conversion) {
|
|
260
|
+
$converters-list: list.join('keyword', $converters-list);
|
|
261
|
+
ml.$utils-cfg: map.set(
|
|
262
|
+
ml.$utils-cfg,
|
|
263
|
+
'conversion-types',
|
|
264
|
+
$conversion,
|
|
265
|
+
$converters-list
|
|
266
|
+
);
|
|
267
|
+
} @else {
|
|
268
|
+
$converters-list: map.get(ml.$utils-cfg, 'conversion-types', $conversion);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
@if meta.type-of($util-keywords) == 'map' or not $util-keywords {
|
|
273
|
+
$util-map: map.set($util-map, 'keywords', $new-keywords);
|
|
274
|
+
} @else {
|
|
275
|
+
$util-map: map.set($util-map, 'custom-keywords', $new-keywords);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
ml.$utils-db: map.deep-merge(
|
|
279
|
+
ml.$utils-db,
|
|
280
|
+
('utils': ('registry': ($util-name: $util-map)))
|
|
281
|
+
);
|
|
282
|
+
} @else if not $group-item-index or $group-item-index < 2 {
|
|
283
|
+
ml.$utils-db: map.merge(
|
|
284
|
+
ml.$utils-db, 'common', 'keywords', 'colors', $new-keywords
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
@mixin -generate-props(
|
|
290
|
+
$props, $values, $is-important, $repeat-values, $preset-props, $util, $util-value
|
|
291
|
+
) {
|
|
292
|
+
$i: if($repeat-values == null, 0, 1);
|
|
293
|
+
$values-count: list.length($values);
|
|
294
|
+
$important: (
|
|
295
|
+
(ml.$utils-up-specificity == true) or $is-important
|
|
296
|
+
) and string.unquote('!important');
|
|
297
|
+
|
|
298
|
+
$css-values: if(
|
|
299
|
+
list.length($props) < 2 and $values-count > 1,
|
|
300
|
+
($values,),
|
|
301
|
+
$values
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
@if $preset-props {
|
|
305
|
+
@each $key, $value in $preset-props {
|
|
306
|
+
@if meta.type-of($value) == 'function' {
|
|
307
|
+
$final-value: meta.call($value, $util, $util-value, $values, $important);
|
|
308
|
+
|
|
309
|
+
// temporary fix, because Sass does not allow `null` value for hiding custom properties
|
|
310
|
+
@if $final-value {
|
|
311
|
+
#{$key}: $final-value;
|
|
312
|
+
}
|
|
313
|
+
} @else {
|
|
314
|
+
#{$key}: $value $important;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
@each $item in $props {
|
|
320
|
+
@if $repeat-values == null {
|
|
321
|
+
#{$item}: list.nth($css-values, ($i % $values-count) + 1) $important;
|
|
322
|
+
} @else if $i <= $values-count {
|
|
323
|
+
#{$item}: list.nth($css-values, $i) $important;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
$i: $i + 1;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
@function -util-main-options($name, $options) {
|
|
331
|
+
$prop: null;
|
|
332
|
+
$result: ();
|
|
333
|
+
$needed-options: (
|
|
334
|
+
'repeat-prop-values', 'preset-properties',
|
|
335
|
+
'selector', 'range-generator', 'components'
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
@each $item in $needed-options {
|
|
339
|
+
$result: map.set(
|
|
340
|
+
$result,
|
|
341
|
+
$item,
|
|
342
|
+
map.get(ml.$utils-db, 'utils', 'registry', $name, $item),
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
$prop: map.get($options, 'properties');
|
|
347
|
+
$external-selector: map.get($options, 'selector');
|
|
348
|
+
|
|
349
|
+
@if (
|
|
350
|
+
$external-selector and
|
|
351
|
+
map.has-key(ml.$utils-db, 'utils', 'registry', $name, 'selector') and
|
|
352
|
+
not string.index(meta.inspect($external-selector), ml.$tSTu)
|
|
353
|
+
) {
|
|
354
|
+
$options: map.set(
|
|
355
|
+
$options,
|
|
356
|
+
'selector',
|
|
357
|
+
selector.nest($external-selector, map.get($result, 'selector'))
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
$result: map.merge($result, $options);
|
|
362
|
+
|
|
363
|
+
@return map.set(
|
|
364
|
+
$result, 'properties', $prop or ml.util-prop($name, 'utils', true)
|
|
365
|
+
);
|
|
366
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
@use 'sass:map';
|
|
2
|
+
@use 'sass:math';
|
|
3
|
+
@use 'sass:string';
|
|
4
|
+
|
|
5
|
+
// General
|
|
6
|
+
//
|
|
7
|
+
// Settings that affect the work of the all toolkit.
|
|
8
|
+
//
|
|
9
|
+
// $browser-font-size = 16px - font size for converting [px to rem](section-sass-tools.html#kssref-sass-tools-functions-px2rem). 16px used because is default font size in settings of most browsers.
|
|
10
|
+
// $su = 0.25rem - space unit value
|
|
11
|
+
// $css-vars-fallback = false - add fallback for values in `grid-gutters` units
|
|
12
|
+
// $css-transition-time = 0.3s - default transition duration.
|
|
13
|
+
// $ratio-box-flex = false - adds a more advanced version of [Ratio-box](section-css_lib.html#kssref-css_lib-helpers-ratio-box) helper with an arbitrary height \- `ratio-box-flex`
|
|
14
|
+
// $wrapper-max-width = 1200px - max width of the [Wraper](section-css_lib.html#kssref-css_lib-helpers-wrapper) helper
|
|
15
|
+
// $css-var-prefix = 'ml-' - prefix for the CSS custom properties, which are generated in the values of utilities. For example, value of `W-$myCard` with prefix: `var(--ml-myCard)`, and without: `var(--myCard)`
|
|
16
|
+
// $class-prefix - prefix, which will be added to CSS classes of all utilities. This can be useful when using mlut on top of the existing CSS
|
|
17
|
+
//
|
|
18
|
+
// Styleguide: settings.general
|
|
19
|
+
|
|
20
|
+
// TODO: add docs
|
|
21
|
+
// Generic CSS
|
|
22
|
+
//
|
|
23
|
+
// Generic styles like a reset/normalize, setting `box-sizing` etc. See example here.
|
|
24
|
+
//
|
|
25
|
+
/// Styleguide: settings.general.generic_css
|
|
26
|
+
|
|
27
|
+
// TODO: add docs for css vars
|
|
28
|
+
// CSS variables
|
|
29
|
+
//
|
|
30
|
+
// Settings of global [CSS custom properties](section-css_lib.html#kssref-css_lib-styles-css_vars) which used in mlut.
|
|
31
|
+
//
|
|
32
|
+
/// Styleguide: settings.general.css_vars
|
|
33
|
+
|
|
34
|
+
// Names
|
|
35
|
+
//
|
|
36
|
+
// In addition to variables, the names of custom properties are contained in the map `$css-vars`.
|
|
37
|
+
// Below are the names of the variables, the corresponding keys in the map and names of custom properties.
|
|
38
|
+
//
|
|
39
|
+
// $var-gg = --gg - `gg`.
|
|
40
|
+
// $var-grid-cols = --grid-cols - `grid-cols`.
|
|
41
|
+
//
|
|
42
|
+
/// Styleguide: settings.general.css_vars.names
|
|
43
|
+
|
|
44
|
+
$ratio-box-flex: false !default;
|
|
45
|
+
$browser-font-size: 16px !default;
|
|
46
|
+
$css-transition-time: 0.3s !default;
|
|
47
|
+
$wrapper-max-width: 1200px !default;
|
|
48
|
+
|
|
49
|
+
$su: 0.25rem !default;
|
|
50
|
+
|
|
51
|
+
$is-test-env: false !default;
|
|
52
|
+
|
|
53
|
+
$css-var-prefix: 'ml-' !default;
|
|
54
|
+
$css-vars-fallback: false !default;
|
|
55
|
+
|
|
56
|
+
$class-prefix: '' !default;
|
|
57
|
+
|
|
58
|
+
$hex-digits: (
|
|
59
|
+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
$dec-digits: (
|
|
63
|
+
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
$spec-chars: (
|
|
67
|
+
' ', '!', '#', '$', '%', '&', '(', ')', '*', '+', ',', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', ']', '^', '`', '{', '|', '}', '~', "'",
|
|
68
|
+
) !default;
|
|
69
|
+
|
|
70
|
+
$number-max: 2e9 !default;
|
|
71
|
+
|
|
72
|
+
$general-cfg: (
|
|
73
|
+
'main-directions': (
|
|
74
|
+
't': top,
|
|
75
|
+
'r': right,
|
|
76
|
+
'b': bottom,
|
|
77
|
+
'l': left,
|
|
78
|
+
),
|
|
79
|
+
'custom-unit-values': (
|
|
80
|
+
'u': $su,
|
|
81
|
+
),
|
|
82
|
+
'units': (
|
|
83
|
+
'css': (
|
|
84
|
+
'px': 1px,
|
|
85
|
+
'cm': 1cm,
|
|
86
|
+
'mm': 1mm,
|
|
87
|
+
'q': 1q,
|
|
88
|
+
'rem': 1rem,
|
|
89
|
+
'%': 1%,
|
|
90
|
+
'fr': 1fr,
|
|
91
|
+
'ch': 1ch,
|
|
92
|
+
'pc': 1pc,
|
|
93
|
+
'in': 1in,
|
|
94
|
+
'em': 1em,
|
|
95
|
+
'pt': 1pt,
|
|
96
|
+
'ex': 1ex,
|
|
97
|
+
'vw': 1vw,
|
|
98
|
+
'vh': 1vh,
|
|
99
|
+
'vmin': 1vmin,
|
|
100
|
+
'vmax': 1vmax,
|
|
101
|
+
'deg': 1deg,
|
|
102
|
+
'turn': 1turn,
|
|
103
|
+
'grad': 1grad,
|
|
104
|
+
'rad': 1rad,
|
|
105
|
+
's': 1s,
|
|
106
|
+
'ms': 1ms,
|
|
107
|
+
'hz': 1hz,
|
|
108
|
+
'khz': 1khz,
|
|
109
|
+
'dpi': 1dpi,
|
|
110
|
+
'dpcm': 1dpcm,
|
|
111
|
+
'dppx': 1dppx,
|
|
112
|
+
'x': 1x,
|
|
113
|
+
),
|
|
114
|
+
'custom': (
|
|
115
|
+
'': 1,
|
|
116
|
+
'gg': 1gg,
|
|
117
|
+
'gc': 1gc,
|
|
118
|
+
'u': 1u,
|
|
119
|
+
'd': 1d,
|
|
120
|
+
'e': 1e,
|
|
121
|
+
'g': 1g,
|
|
122
|
+
'i': 1i,
|
|
123
|
+
'p': 1p,
|
|
124
|
+
'r': 1r,
|
|
125
|
+
'ra': 1ra,
|
|
126
|
+
't': 1t,
|
|
127
|
+
),
|
|
128
|
+
),
|
|
129
|
+
'generic-css': (
|
|
130
|
+
'border-box': true,
|
|
131
|
+
'sup-sub-no-v-align': true,
|
|
132
|
+
'embeds-v-align': true,
|
|
133
|
+
'embeds-aspect-ratio': true,
|
|
134
|
+
'forms-normalize': true,
|
|
135
|
+
'embeds-block': false,
|
|
136
|
+
'svg-fill-cur-color': false,
|
|
137
|
+
'default-reduce-motion': false,
|
|
138
|
+
'reset-border': false,
|
|
139
|
+
'reset': false,
|
|
140
|
+
),
|
|
141
|
+
'css-vars': (
|
|
142
|
+
'gg': 'gg',
|
|
143
|
+
'gs-formula-diff': 'gsfd',
|
|
144
|
+
'gs-columns-count': 'gscc',
|
|
145
|
+
),
|
|
146
|
+
) !default;
|
|
147
|
+
|
|
148
|
+
$general-config: () !default;
|
|
149
|
+
$general-config-ext: () !default;
|
|
150
|
+
|
|
151
|
+
$general-cfg: map.deep-merge($general-cfg, $general-config);
|
|
152
|
+
$general-cfg: map.deep-merge($general-cfg, $general-config-ext);
|
|
153
|
+
|
|
154
|
+
$main-directions: map.get($general-cfg, 'main-directions');
|
|
155
|
+
|
|
156
|
+
$units-all: map.merge(
|
|
157
|
+
map.get($general-cfg, 'units', 'css'),
|
|
158
|
+
map.get($general-cfg, 'units', 'custom'),
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
$-prefixed-vars: ();
|
|
162
|
+
|
|
163
|
+
@each $key, $value in map.get($general-cfg, 'css-vars') {
|
|
164
|
+
$-prefixed-vars: map.set(
|
|
165
|
+
$-prefixed-vars, $key, string.unquote('--#{$css-var-prefix}#{$value}')
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
$general-cfg: map.set($general-cfg, 'css-vars', $-prefixed-vars);
|
|
170
|
+
|
|
171
|
+
$var-gg: map.get($general-cfg, 'css-vars', 'gg');
|
|
172
|
+
$var-gsfd: map.get($general-cfg, 'css-vars', 'gs-formula-diff');
|
|
173
|
+
$var-gscc: map.get($general-cfg, 'css-vars', 'gs-columns-count');
|
|
174
|
+
|
|
175
|
+
$base-border-box: map.get($general-cfg, 'generic-css', 'border-box');
|