@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,211 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use 'sass:math';
|
|
5
|
+
@use 'sass:string';
|
|
6
|
+
|
|
7
|
+
@use 'forward-tools' as ml;
|
|
8
|
+
@use 'helpers';
|
|
9
|
+
|
|
10
|
+
// Utils
|
|
11
|
+
//
|
|
12
|
+
// Basically, here are functions for internal needs. Perhaps the documentation will appear later.
|
|
13
|
+
//
|
|
14
|
+
/// Styleguide: sass-tools.functions.common.utils
|
|
15
|
+
|
|
16
|
+
// convert-util-value
|
|
17
|
+
//
|
|
18
|
+
// Determines the type of utility and, depending on type, calls the converter from the `$util-value-converters` map. If the utility type is not recognized, the [default converter](#kssref-sass-tools-functions-utils-value_converters-def) is called. If the `$utils-value-converters` does not contain a converter for this type, the utility value is returned without conversion. Else the result of the converter work is returned.
|
|
19
|
+
// ```scss
|
|
20
|
+
//@debug ml.convert-util-value('2r', 'Fns'); // 2rem
|
|
21
|
+
//@debug ml.convert-util-value(100, 'Fnw'); // 100
|
|
22
|
+
// ```
|
|
23
|
+
//
|
|
24
|
+
// $util-val - utility value
|
|
25
|
+
// $name - utility name
|
|
26
|
+
// $section = 'utils' - section in the registry in which utility was defined
|
|
27
|
+
//
|
|
28
|
+
/// Styleguide: sass-tools.functions.common.utils.convert_util_value
|
|
29
|
+
|
|
30
|
+
@function convert-util-value($util-val, $name, $section: 'utils') {
|
|
31
|
+
$result: null;
|
|
32
|
+
|
|
33
|
+
@if meta.type-of($util-val) == 'string' {
|
|
34
|
+
$multi-list-sep: if(
|
|
35
|
+
map.has-key(ml.$utils-db, $section, 'registry', $name, 'multi-list-separator'),
|
|
36
|
+
map.get(ml.$utils-db, $section, 'registry', $name, 'multi-list-separator'),
|
|
37
|
+
ml.$tUNls
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
@if string.index($util-val, $multi-list-sep) or string.index($util-val, ml.$tUSp) {
|
|
41
|
+
$converted: ();
|
|
42
|
+
$separator: map.get(ml.$utils-cfg, 'tokens-values', $multi-list-sep);
|
|
43
|
+
|
|
44
|
+
@each $list in ml.str-split($util-val, $multi-list-sep) {
|
|
45
|
+
$items: ml.str-split($list, ml.$tUSp);
|
|
46
|
+
$one-value: list.length($items) == 1;
|
|
47
|
+
$converted-items: ();
|
|
48
|
+
|
|
49
|
+
@each $value in $items {
|
|
50
|
+
$converted-items: list.append(
|
|
51
|
+
$converted-items,
|
|
52
|
+
apply-value-converter($value, $name, $section, $one-value)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
$converted: list.append($converted, $converted-items, $separator);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
$result: if(
|
|
60
|
+
list.length($converted) == 1,
|
|
61
|
+
list.nth($converted, 1),
|
|
62
|
+
$converted
|
|
63
|
+
);
|
|
64
|
+
} @else if string.slice($util-val, 1, 1) == ml.$tURv {
|
|
65
|
+
$result: string.unquote(string.slice($util-val, 2));
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@if not $result {
|
|
70
|
+
$result: apply-value-converter($util-val, $name, $section);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@if map.has-key(
|
|
74
|
+
ml.$utils-db, $section, 'registry', $name, 'transformer'
|
|
75
|
+
) {
|
|
76
|
+
@return meta.call(
|
|
77
|
+
map.get(
|
|
78
|
+
ml.$utils-cfg,
|
|
79
|
+
'transformers',
|
|
80
|
+
map.get(ml.$utils-db, $section, 'registry', $name, 'transformer')
|
|
81
|
+
),
|
|
82
|
+
$result,
|
|
83
|
+
('name': $name)
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@return $result;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@function apply-value-converter(
|
|
91
|
+
$util-value, $name, $section: 'utils', $one-value: true
|
|
92
|
+
) {
|
|
93
|
+
@if ml.str-starts($util-value, ml.$tURv) {
|
|
94
|
+
@return string.unquote(string.slice($util-value, 2));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
$conversion: (
|
|
98
|
+
map.get(ml.$utils-db, $section, 'registry', $name, 'conversion') or
|
|
99
|
+
'default'
|
|
100
|
+
);
|
|
101
|
+
$is-pipeline: false;
|
|
102
|
+
$negative: (
|
|
103
|
+
meta.type-of($util-value) == 'string' and
|
|
104
|
+
string.slice($util-value, 1, 1) == '-' and
|
|
105
|
+
not list.index(ml.$dec-digits, string.slice($util-value, 2, 2))
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
@if $negative {
|
|
109
|
+
$util-value: string.slice($util-value, 2);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@each $item in map.get(ml.$utils-cfg, 'conversion-types', $conversion) {
|
|
113
|
+
@if map.has-key(ml.$utils-cfg, 'converters', $item) {
|
|
114
|
+
$prev-value: $util-value;
|
|
115
|
+
|
|
116
|
+
$util-value: meta.call(
|
|
117
|
+
map.get(ml.$utils-cfg, 'converters', $item),
|
|
118
|
+
$util-value,
|
|
119
|
+
(
|
|
120
|
+
'name': $name,
|
|
121
|
+
'section': $section,
|
|
122
|
+
'negative': $negative,
|
|
123
|
+
'one-value': $one-value,
|
|
124
|
+
)
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
@if $util-value != $prev-value and not $is-pipeline {
|
|
128
|
+
@if $negative and ($item == 'keyword' or $item == 'global-kw') {
|
|
129
|
+
@if meta.type-of($util-value) == 'number' {
|
|
130
|
+
@return $util-value * -1;
|
|
131
|
+
} @else if(
|
|
132
|
+
helpers.is-css-var($util-value) or
|
|
133
|
+
meta.type-of($util-value) == 'calculation'
|
|
134
|
+
) {
|
|
135
|
+
@return calc($util-value * -1);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@return $util-value;
|
|
140
|
+
}
|
|
141
|
+
} @else if $item == ml.$kSsVCP {
|
|
142
|
+
$is-pipeline: true;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@if $negative {
|
|
147
|
+
$util-value: '-' + $util-value;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@return if(
|
|
151
|
+
//checks type again because here we could get after the converter pipeline
|
|
152
|
+
meta.type-of($util-value) == 'string',
|
|
153
|
+
string.unquote($util-value),
|
|
154
|
+
$util-value
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@function parse-abbr($abbr) {
|
|
159
|
+
$abbr-value: '';
|
|
160
|
+
$abbr-prefix: '';
|
|
161
|
+
$hash-value-sep: ml.$tUHv;
|
|
162
|
+
$all-separators: ml.$abbr-separators;
|
|
163
|
+
$result: ();
|
|
164
|
+
|
|
165
|
+
@if string.slice($abbr, 1, 1) == '-' {
|
|
166
|
+
$abbr: string.slice($abbr, 2);
|
|
167
|
+
$abbr-prefix: '-';
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@if ml.$tUHv == '' {
|
|
171
|
+
$hash-value-sep: '#';
|
|
172
|
+
$all-separators: list.append($all-separators, '#');
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
$abbr-name: $abbr;
|
|
176
|
+
$number-index: ml.str-digit-index($abbr);
|
|
177
|
+
$separator: ml.ls-find(
|
|
178
|
+
$all-separators, meta.get-function('str-contains-item', false, ml), $abbr
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
$sep-before-digit: if(
|
|
182
|
+
$separator and $number-index,
|
|
183
|
+
$number-index > string.index($abbr, $separator),
|
|
184
|
+
true
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
@if $separator and $sep-before-digit {
|
|
188
|
+
$abbr-parts: ml.str-split($abbr, $separator, 1);
|
|
189
|
+
$abbr-name: list.nth($abbr-parts, 1);
|
|
190
|
+
$abbr-value: list.nth($abbr-parts, 2);
|
|
191
|
+
|
|
192
|
+
@if ml.$tUNv == '' and $separator == '-' and ml.str2n($abbr-value) {
|
|
193
|
+
$abbr-value: '-' + $abbr-value;
|
|
194
|
+
} @else if $separator == $hash-value-sep or $separator == ml.$tURv {
|
|
195
|
+
$abbr-value: $separator + $abbr-value;
|
|
196
|
+
} @else {
|
|
197
|
+
$result: map.set($result, 'separator', $separator);
|
|
198
|
+
}
|
|
199
|
+
} @else if ml.$tUNv == '' and $number-index {
|
|
200
|
+
$abbr-name: string.slice($abbr, 1, $number-index - 1);
|
|
201
|
+
$abbr-value: string.slice($abbr, $number-index);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@return map.merge(
|
|
205
|
+
$result,
|
|
206
|
+
(
|
|
207
|
+
'value': $abbr-value,
|
|
208
|
+
'name': $abbr-prefix + $abbr-name,
|
|
209
|
+
)
|
|
210
|
+
);
|
|
211
|
+
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:string';
|
|
4
|
+
@use 'sass:math';
|
|
5
|
+
@use 'sass:meta';
|
|
6
|
+
|
|
7
|
+
@use 'forward-tools' as ml;
|
|
8
|
+
|
|
9
|
+
// At-rules
|
|
10
|
+
//
|
|
11
|
+
// Functions for working with at-rules.
|
|
12
|
+
//
|
|
13
|
+
/// Styleguide: sass-tools.functions.high.at_rules
|
|
14
|
+
|
|
15
|
+
$-tALs-length: string.length(ml.$tALs);
|
|
16
|
+
$-tACs-length: string.length(ml.$tACs);
|
|
17
|
+
|
|
18
|
+
@function convert-bp-list($bp-list) {
|
|
19
|
+
$from: list.nth($bp-list, 1);
|
|
20
|
+
$is-max: ml.str-starts($from, ml.$tALs);
|
|
21
|
+
|
|
22
|
+
@if $is-max {
|
|
23
|
+
$from: string.slice($from, $-tALs-length + 1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
$from-value: map.get(ml.$bp-map, $from);
|
|
27
|
+
|
|
28
|
+
@if not $from-value {
|
|
29
|
+
@return ml.error(
|
|
30
|
+
'Invalid breakpoint name: `#{$from}`',
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
$media-str: '(min-width: #{$from-value})';
|
|
35
|
+
|
|
36
|
+
@if $is-max {
|
|
37
|
+
$media-str: '(max-width: #{$from-value - 1px})';
|
|
38
|
+
} @else if list.length($bp-list) >= 2 {
|
|
39
|
+
$media-str:
|
|
40
|
+
$media-str + ' and (max-width: #{ml.bp(list.nth($bp-list, 2)) - 1px})';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@return $media-str;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@function convert-feature-abbr($abbr, $section: 'utils') {
|
|
47
|
+
@if $abbr == '' {
|
|
48
|
+
@return ml.error('Passed empty string');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
$result: '';
|
|
52
|
+
$abbr-data: ml.parse-abbr($abbr);
|
|
53
|
+
$abbr-feature: map.get($abbr-data, 'name');
|
|
54
|
+
$abbr-value: map.get($abbr-data, 'value');
|
|
55
|
+
$separator: map.get($abbr-data, 'separator');
|
|
56
|
+
$feat-prefix: '';
|
|
57
|
+
$feature: ml.util-prop($abbr-feature, $section, false, true);
|
|
58
|
+
|
|
59
|
+
@if not $feature {
|
|
60
|
+
@if $section == 'container' and $abbr-value == '' {
|
|
61
|
+
@return $abbr;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@return ml.error(
|
|
65
|
+
'Invalid feature abbreviation: `#{$abbr}`. `#{$abbr}` is not defined in `#{$section}` section of $utils-db map'
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@if (
|
|
70
|
+
$abbr-value == '' and
|
|
71
|
+
not map.has-key(ml.$utils-db, $section, 'registry', $abbr-feature, 'keywords')
|
|
72
|
+
) {
|
|
73
|
+
@return '(#{$feature})';
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@if $separator {
|
|
77
|
+
@if string.index($separator, ml.$tALs) {
|
|
78
|
+
$feat-prefix: 'max-';
|
|
79
|
+
} @else if string.index($separator, ml.$tAGt) {
|
|
80
|
+
$feat-prefix: 'min-';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
$feat-value: ml.convert-util-value($abbr-value, $abbr-feature, $section);
|
|
85
|
+
|
|
86
|
+
@if meta.type-of($feat-value) == 'number' {
|
|
87
|
+
$value-unit: math.unit($feat-value);
|
|
88
|
+
|
|
89
|
+
@if $value-unit == 'u' {
|
|
90
|
+
$feat-value: ml.su($feat-value);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@if $separator == ml.$tALs or $separator == ml.$tAGt {
|
|
94
|
+
$value-diff: bp-value-diff($feat-value, $value-unit);
|
|
95
|
+
|
|
96
|
+
@if $separator == ml.$tALs {
|
|
97
|
+
$value-diff: $value-diff * -1;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
$feat-value: $feat-value + $value-diff;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@return '(#{$feat-prefix + $feature}: #{$feat-value})';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@function bp-value-diff($value, $computed-unit: null) {
|
|
108
|
+
$unit: $computed-unit or math.unit($value);
|
|
109
|
+
$diff: map.get(ml.$general-cfg, 'units', 'css', $unit) or 1;
|
|
110
|
+
|
|
111
|
+
@if $unit == 'rem' or $unit == 'em' {
|
|
112
|
+
$diff: $diff * 0.06; // 1px = 0.062rem
|
|
113
|
+
} @else if $unit != 'px' and $unit != '' {
|
|
114
|
+
// TODO: add calculations for other units
|
|
115
|
+
$diff: $diff * 0.01;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@return $diff;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Converters
|
|
122
|
+
//
|
|
123
|
+
// Converts abbreviations to at-rules. The name of the converter begins with `convert-ar-` and ends with the name of the at-rule, which it corresponds. The exception is the breakpoint converter. All converters take the same arguments, see below.
|
|
124
|
+
//
|
|
125
|
+
// Converter is bind to the at-rule that contains in the `$at-rules-db` map. It is recorded on the 'converter' key in the map of the relevant rule.
|
|
126
|
+
//
|
|
127
|
+
// Available converters:
|
|
128
|
+
// ```scss
|
|
129
|
+
//@debug ml.convert-ar-bp('<sm,xl'); // '(max-width: 519px), (min-width: 1168px)'
|
|
130
|
+
//@debug ml.convert-ar-media('s:fc'); // 'screen and (forced-colors)'
|
|
131
|
+
//@debug ml.convert-ar-supports('!&', 'D-ig'); // '(not (display: inline-grid))'
|
|
132
|
+
// ```
|
|
133
|
+
//
|
|
134
|
+
// $ar - string with abbreviations
|
|
135
|
+
// $this-util = null - utility for which the at-rules will be generated
|
|
136
|
+
//
|
|
137
|
+
/// Styleguide: sass-tools.functions.high.at_rules.converters
|
|
138
|
+
|
|
139
|
+
@function convert-ar-bp($ar, $this-util: null) {
|
|
140
|
+
$result: '';
|
|
141
|
+
$queries: ml.str-split($ar, ml.$tAOr);
|
|
142
|
+
|
|
143
|
+
@each $queary in $queries {
|
|
144
|
+
$result: $result + convert-bp-list(ml.str-split($queary, ml.$tAAnd)) + ', ';
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@return string.slice($result, 1, -3);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@function convert-ar-media($ar, $this-util: null) {
|
|
151
|
+
$result: '';
|
|
152
|
+
$queries: ml.str-split($ar, ml.$tAOr);
|
|
153
|
+
$and: ' and ';
|
|
154
|
+
$or: ', ';
|
|
155
|
+
|
|
156
|
+
@each $queary in $queries {
|
|
157
|
+
$queary-list: ml.str-split($queary, ml.$tAAnd);
|
|
158
|
+
|
|
159
|
+
@each $item in $queary-list {
|
|
160
|
+
@if map.has-key(ml.$at-rules-db, 'media', 'types', $item) {
|
|
161
|
+
$result: $result + map.get(ml.$at-rules-db, 'media', 'types', $item);
|
|
162
|
+
} @else if ml.str-starts($item, ml.$tACs) {
|
|
163
|
+
$item-name: string.slice($item, $-tACs-length + 1);
|
|
164
|
+
|
|
165
|
+
@if map.has-key(ml.$at-rules-db, 'media', 'custom', $item-name) {
|
|
166
|
+
$result: $result + map.get(ml.$at-rules-db, 'media', 'custom', $item-name);
|
|
167
|
+
} @else {
|
|
168
|
+
@return ml.error('Undefined custom media query: `#{$item}`');
|
|
169
|
+
}
|
|
170
|
+
} @else {
|
|
171
|
+
$result: $result + convert-feature-abbr($item, 'media');
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
$result: $result + $and;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
$result: string.slice($result, 1, -(1 + string.length($and))) + $or;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@return string.slice($result, 1, -(1 + string.length($or)));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@function convert-ar-supports($ar, $this-util: null) {
|
|
184
|
+
@if $ar == '' and $this-util {
|
|
185
|
+
@return convert-feature-abbr(
|
|
186
|
+
map.get($this-util, 'name') + map.get($this-util, 'value')
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
$result: '';
|
|
191
|
+
$separator: ml.$tAAnd;
|
|
192
|
+
$operator: ' and ';
|
|
193
|
+
|
|
194
|
+
@if string.index($ar, ml.$tAOr) {
|
|
195
|
+
@if string.index($ar, ml.$tAAnd) {
|
|
196
|
+
@return ml.error('Different operators are not allowed in one abbreviations list');
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
$separator: ml.$tAOr;
|
|
200
|
+
$operator: ' or ';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@each $item in ml.str-split($ar, $separator) {
|
|
204
|
+
$converted: '';
|
|
205
|
+
$not: string.slice($item, 1, 1) == ml.$tANot;
|
|
206
|
+
|
|
207
|
+
@if $not {
|
|
208
|
+
$item: string.slice($item, 2);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
@if ml.str-starts($item, ml.$tACs) {
|
|
212
|
+
$item-name: string.slice($item, 2);
|
|
213
|
+
|
|
214
|
+
@if map.has-key(ml.$at-rules-db, 'supports', 'custom', $item-name) {
|
|
215
|
+
$converted: map.get(ml.$at-rules-db, 'supports', 'custom', $item-name);
|
|
216
|
+
} @else {
|
|
217
|
+
@return ml.error('Undefined custom supports condition: `#{$item}`');
|
|
218
|
+
}
|
|
219
|
+
} @else if ml.str-starts($item, ml.$tSTu) {
|
|
220
|
+
@if not $this-util {
|
|
221
|
+
@return ml.error('`#{ml.$tSTu}` cannot be used because $this-util is not passed');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
$value: map.get($this-util, 'value');
|
|
225
|
+
|
|
226
|
+
@if $item == ml.$tSTu + ml.$tUSv {
|
|
227
|
+
$value: ml.$tUSv + 'ini';
|
|
228
|
+
} @else if $item != ml.$tSTu {
|
|
229
|
+
$value: string.slice($item, 2);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
$converted: convert-feature-abbr(map.get($this-util, 'name') + $value);
|
|
233
|
+
} @else {
|
|
234
|
+
$converted: convert-feature-abbr(ml.str-ucfirst($item));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
@if $not {
|
|
238
|
+
$converted: '(not #{$converted})';
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
$result: $result + $converted + $operator;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@return string.slice($result, 1, -(1 + string.length($operator)));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
@function convert-ar-container($ar, $this-util: null) {
|
|
248
|
+
$result: '';
|
|
249
|
+
$queries: ml.str-split($ar, ml.$tAOr);
|
|
250
|
+
$and: ' and ';
|
|
251
|
+
$or: ', ';
|
|
252
|
+
|
|
253
|
+
@each $queary in $queries {
|
|
254
|
+
$queary-list: ml.str-split($queary, ml.$tAAnd);
|
|
255
|
+
|
|
256
|
+
@each $item in $queary-list {
|
|
257
|
+
$is-container-name: false;
|
|
258
|
+
|
|
259
|
+
@if ml.str-starts($item, ml.$tACs) {
|
|
260
|
+
$item-name: string.slice($item, $-tACs-length + 1);
|
|
261
|
+
|
|
262
|
+
@if map.has-key(ml.$at-rules-db, 'container', 'custom', $item-name) {
|
|
263
|
+
$result: $result + map.get(ml.$at-rules-db, 'container', 'custom', $item-name);
|
|
264
|
+
} @else {
|
|
265
|
+
@return ml.error('Undefined custom container condition: `#{$item}`');
|
|
266
|
+
}
|
|
267
|
+
} @else {
|
|
268
|
+
$converted: convert-feature-abbr($item, 'container');
|
|
269
|
+
|
|
270
|
+
@if $converted == $item {
|
|
271
|
+
$is-container-name: true;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
$result: $result + $converted;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
$result: $result + if($is-container-name, ' ', $and);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
$result: string.slice($result, 1, -(1 + string.length($and))) + $or;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
@return string.slice($result, 1, -(1 + string.length($or)));
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
@function convert-ar-layer($ar, $this-util: null) {
|
|
287
|
+
@return $ar;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
@each $key, $value in ml.$at-rules-db {
|
|
291
|
+
@if meta.function-exists('convert-ar-#{$key}') {
|
|
292
|
+
ml.$at-rules-db: map.set(
|
|
293
|
+
ml.$at-rules-db, $key, 'converter', meta.get-function('convert-ar-#{$key}')
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
}
|