@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,355 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use 'sass:math';
|
|
5
|
+
@use 'sass:string';
|
|
6
|
+
@use 'sass:color';
|
|
7
|
+
|
|
8
|
+
@use '../forward-tools' as ml;
|
|
9
|
+
@use 'value-converters' as converters;
|
|
10
|
+
@use 'parse-util' as mpu;
|
|
11
|
+
|
|
12
|
+
@function number-range($range, $util) {
|
|
13
|
+
$range-args-count: list.length($range);
|
|
14
|
+
|
|
15
|
+
@if $range-args-count < 2 {
|
|
16
|
+
@return ml.error('Invalid range syntax: `#{$range}`. Expected 2 or 3 arguments');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
$value-data: mpu.parse-util(list.nth($range, 1));
|
|
20
|
+
$start: map.get($value-data, 'value');
|
|
21
|
+
$start-number: ml.str2n($start, true);
|
|
22
|
+
$end: list.nth($range, 2);
|
|
23
|
+
|
|
24
|
+
@if meta.type-of($start-number) != 'number' {
|
|
25
|
+
@if ml.str2n($start) {
|
|
26
|
+
@return ml.error('Unknown unit in $start value in range: `#{$start}`');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@return ml.error('Invalid $start value in range: `#{$start}`');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
$result: if(
|
|
33
|
+
list.length($value-data) > 1,
|
|
34
|
+
('components': map.remove($value-data, 'value')),
|
|
35
|
+
()
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
$unit-name: math.unit($start-number);
|
|
39
|
+
$unit: map.get(ml.$units-all, $unit-name);
|
|
40
|
+
$converted-start: ml.convert-util-value($start-number, $util);
|
|
41
|
+
$css-unit-name: null;
|
|
42
|
+
$css-unit: null;
|
|
43
|
+
|
|
44
|
+
@if meta.type-of($converted-start) == 'number' {
|
|
45
|
+
$css-unit-name: math.unit($converted-start);
|
|
46
|
+
$css-unit: (
|
|
47
|
+
map.get(
|
|
48
|
+
ml.$utils-cfg,
|
|
49
|
+
'units',
|
|
50
|
+
map.get(ml.$utils-db, 'utils', 'registry', $util, 'conversion'),
|
|
51
|
+
$unit-name
|
|
52
|
+
) or
|
|
53
|
+
map.get(ml.$units-all, $css-unit-name)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@if map.has-key(ml.$general-cfg, 'custom-unit-values', $unit-name) {
|
|
58
|
+
$css-unit: map.get(ml.$general-cfg, 'custom-unit-values', $unit-name);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
$step: if(($range-args-count > 2), list.nth($range, 3), 1);
|
|
62
|
+
$values: ();
|
|
63
|
+
$is-css-unit-fn: meta.type-of($css-unit) == 'function';
|
|
64
|
+
$i: math.div($start-number, $unit);
|
|
65
|
+
|
|
66
|
+
@while $i <= $end {
|
|
67
|
+
$css-value: if(
|
|
68
|
+
$is-css-unit-fn,
|
|
69
|
+
meta.call($css-unit, $i, ('util': $util)),
|
|
70
|
+
$i * $css-unit
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
$values: map.set($values, $i * $unit, $css-value);
|
|
74
|
+
$i: $i + $step;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@return map.set($result, 'values', $values);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
$-color-adjust-fn: meta.get-function('adjust', false, color);
|
|
81
|
+
$-color-scale-fn: meta.get-function('scale', false, color);
|
|
82
|
+
|
|
83
|
+
@function -shade-name($item, $i, $step) {
|
|
84
|
+
@return $step <= $item;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@function color-range($range, $util) {
|
|
88
|
+
$range-args-count: list.length($range);
|
|
89
|
+
|
|
90
|
+
@if $range-args-count < 3 {
|
|
91
|
+
@return ml.error('invalid range syntax: `#{$range}`. Expected 3 or 4 arguments');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
$numbers-list: list.nth($range, 2);
|
|
95
|
+
$shades-num-data: mpu.parse-util(list.nth($numbers-list, 1));
|
|
96
|
+
$shades-number: ml.str2n(map.get($shades-num-data, 'value'));
|
|
97
|
+
|
|
98
|
+
$alpha-number: if(
|
|
99
|
+
list.length($numbers-list) > 1,
|
|
100
|
+
list.nth($numbers-list, 2),
|
|
101
|
+
$shades-number
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
$step-map: list.nth($range, 3);
|
|
105
|
+
$step-fn: $-color-adjust-fn;
|
|
106
|
+
$is-alpha: map.has-key($step-map, 'alpha');
|
|
107
|
+
$only-alpha: list.length($step-map) == 1 and $is-alpha;
|
|
108
|
+
$util-data: (
|
|
109
|
+
'name': $util,
|
|
110
|
+
'section': 'utils',
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
$result: if(
|
|
114
|
+
list.length($shades-num-data) > 1,
|
|
115
|
+
('components': map.remove($shades-num-data, 'value')),
|
|
116
|
+
()
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
@if $range-args-count >= 4 {
|
|
120
|
+
$fn-link: list.nth($range, 4);
|
|
121
|
+
|
|
122
|
+
$step-fn: if(
|
|
123
|
+
meta.type-of($fn-link) == 'function',
|
|
124
|
+
$fn-link,
|
|
125
|
+
meta.get-function($fn-link, false, color)
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
$shades-map: if(
|
|
130
|
+
$only-alpha,
|
|
131
|
+
list.nth($range, 1),
|
|
132
|
+
-generate-color-shades(
|
|
133
|
+
list.nth($range, 1),
|
|
134
|
+
$shades-number,
|
|
135
|
+
map.remove($step-map, 'alpha'),
|
|
136
|
+
$step-fn,
|
|
137
|
+
$util-data
|
|
138
|
+
)
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
$shades-list: if(
|
|
142
|
+
meta.type-of($shades-map) == 'map',
|
|
143
|
+
map.keys($shades-map),
|
|
144
|
+
$shades-map
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
$values: if(
|
|
148
|
+
$is-alpha,
|
|
149
|
+
-generate-color-alpha(
|
|
150
|
+
$shades-list, $alpha-number, map.get($step-map, 'alpha'), $step-fn, $util-data
|
|
151
|
+
),
|
|
152
|
+
$shades-map
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
@return map.set($result, 'values', $values);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@function -generate-color-shades(
|
|
159
|
+
$colors, $count, $step-map, $step-fn, $util-data
|
|
160
|
+
) {
|
|
161
|
+
$values: ();
|
|
162
|
+
$new-shades: ();
|
|
163
|
+
$shade-step: 50;
|
|
164
|
+
$max-step: 0;
|
|
165
|
+
|
|
166
|
+
@if map.has-key($step-map, 'rgb') {
|
|
167
|
+
$max-step: map.get($step-map, 'rgb');
|
|
168
|
+
$step-map: map.merge(
|
|
169
|
+
map.remove($step-map, 'rgb'),
|
|
170
|
+
(
|
|
171
|
+
'red': $max-step,
|
|
172
|
+
'green': $max-step,
|
|
173
|
+
'blue': $max-step,
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
} @else {
|
|
177
|
+
//stylelint-disable
|
|
178
|
+
$max-step: math.max(map.values($step-map)...);
|
|
179
|
+
//stylelint-enable
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
$max-step: math.abs($max-step);
|
|
183
|
+
|
|
184
|
+
@if $step-fn == $-color-adjust-fn {
|
|
185
|
+
$shade-step: ml.ls-find(
|
|
186
|
+
(5, 10, 50), meta.get-function('-shade-name'), $max-step
|
|
187
|
+
) or 100;
|
|
188
|
+
} @else if $step-fn == $-color-scale-fn {
|
|
189
|
+
$shade-step: if($max-step <= 20%, 50, 100);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@each $item in $colors {
|
|
193
|
+
$color: ml.apply-value-converter(
|
|
194
|
+
$item, $util-data...
|
|
195
|
+
);
|
|
196
|
+
$is-css-var: ml.is-css-var($color, true);
|
|
197
|
+
|
|
198
|
+
@if meta.type-of($color) != 'color' and not $is-css-var {
|
|
199
|
+
@return ml.error(
|
|
200
|
+
'invalid value in range: `#{$color}`. Expected color or CSS variable'
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
$str-color: $item + '';
|
|
205
|
+
$color-values: (
|
|
206
|
+
$item: $color
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
@if not $is-css-var and not (
|
|
210
|
+
string.slice($str-color, 1, 1) == '#' or
|
|
211
|
+
string.index($str-color, ml.$tUCla)
|
|
212
|
+
) {
|
|
213
|
+
$cur-shade: 0;
|
|
214
|
+
$i: 1;
|
|
215
|
+
|
|
216
|
+
@if string.slice($str-color, -1) == '0' {
|
|
217
|
+
$str-color: string.slice($str-color, 1, -2);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
@while $i < $count {
|
|
221
|
+
$color: meta.call($step-fn, $color, $step-map...);
|
|
222
|
+
$cur-shade: $cur-shade + $shade-step;
|
|
223
|
+
$key: $str-color + $cur-shade;
|
|
224
|
+
|
|
225
|
+
@if not map.has-key(ml.$utils-db, 'common', 'keywords', 'colors', $key) {
|
|
226
|
+
$new-shades: map.set($new-shades, $key, $color);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
$color-values: map.set($color-values, $key, $color);
|
|
230
|
+
$i: $i + 1;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
$values: map.merge($values, $color-values);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// questionable solution because the generator has a hidden side effect
|
|
238
|
+
// TODO: move saving new shades from here
|
|
239
|
+
@if list.length($new-shades) > 0 {
|
|
240
|
+
ml.$utils-db: map.merge(
|
|
241
|
+
ml.$utils-db, 'common', 'keywords', 'colors', $new-shades
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
@return $values;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
@function -generate-color-alpha(
|
|
249
|
+
$colors, $count, $step-value, $step-fn, $util-data
|
|
250
|
+
) {
|
|
251
|
+
$values: ();
|
|
252
|
+
$step: if(
|
|
253
|
+
ml.str-starts($step-value, ml.$tUCp), null, 0
|
|
254
|
+
);
|
|
255
|
+
$is-percent-step: false;
|
|
256
|
+
|
|
257
|
+
@if $step {
|
|
258
|
+
$is-percent-step: math.unit($step-value) == '%';
|
|
259
|
+
|
|
260
|
+
$step: if(
|
|
261
|
+
$is-percent-step,
|
|
262
|
+
math.div($step-value, 1%) * 1p,
|
|
263
|
+
$step-value * 100p
|
|
264
|
+
);
|
|
265
|
+
|
|
266
|
+
$step-value: -$step-value;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
@each $item in $colors {
|
|
270
|
+
$color: ml.apply-value-converter(
|
|
271
|
+
$item, $util-data...
|
|
272
|
+
);
|
|
273
|
+
$is-css-var: ml.is-css-var($color, true);
|
|
274
|
+
|
|
275
|
+
@if meta.type-of($color) != 'color' and not $is-css-var {
|
|
276
|
+
@return ml.error(
|
|
277
|
+
'invalid value in range: `#{$color}`. Expected color or CSS variable'
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
$color-values: (
|
|
282
|
+
$item: $color
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
@if not $step {
|
|
286
|
+
$color-values: map.set(
|
|
287
|
+
$color-values,
|
|
288
|
+
($item + ml.$tUCla + $step-value),
|
|
289
|
+
rgba(
|
|
290
|
+
$color,
|
|
291
|
+
string.insert(
|
|
292
|
+
converters.convert-uv-cust-prop($step-value), ', 1', -2
|
|
293
|
+
)
|
|
294
|
+
)
|
|
295
|
+
);
|
|
296
|
+
} @else {
|
|
297
|
+
@if meta.type-of($item) == 'string' {
|
|
298
|
+
$token-pos: string.index($item, ml.$tUCla);
|
|
299
|
+
|
|
300
|
+
@if $token-pos {
|
|
301
|
+
$item: string.slice($item, 1, $token-pos - 1);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
$cur-alpha: 100p;
|
|
306
|
+
$cur-alpha-val: 1;
|
|
307
|
+
$prev-alpha-val: 1;
|
|
308
|
+
$i: 1;
|
|
309
|
+
|
|
310
|
+
@if $is-css-var {
|
|
311
|
+
$space-pos: string.index($color, '), ');
|
|
312
|
+
|
|
313
|
+
@if $is-percent-step {
|
|
314
|
+
$step-value: math.div($step-value, 100%);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
@if $space-pos {
|
|
318
|
+
$cur-alpha-val: ml.str2n(string.slice($color, $space-pos + 3));
|
|
319
|
+
$cur-alpha: $cur-alpha-val * 100p;
|
|
320
|
+
$prev-alpha-val: $cur-alpha-val;
|
|
321
|
+
} @else {
|
|
322
|
+
$color: rgba($color, 1);
|
|
323
|
+
}
|
|
324
|
+
} @else {
|
|
325
|
+
$cur-alpha: color.alpha($color) * 100p;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
@while $i < $count {
|
|
329
|
+
@if $is-css-var {
|
|
330
|
+
$cur-alpha: $cur-alpha - $step;
|
|
331
|
+
$cur-alpha-val: $cur-alpha-val + $step-value;
|
|
332
|
+
$color: ml.str-replace($color, $prev-alpha-val + '', $cur-alpha-val);
|
|
333
|
+
$prev-alpha-val: $cur-alpha-val;
|
|
334
|
+
} @else {
|
|
335
|
+
$color: meta.call($step-fn, $color, $alpha: $step-value);
|
|
336
|
+
|
|
337
|
+
$cur-alpha: if(
|
|
338
|
+
$is-percent-step,
|
|
339
|
+
color.alpha($color) * 100p,
|
|
340
|
+
$cur-alpha - $step
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
$color-values: map.set(
|
|
345
|
+
$color-values, ($item + ml.$tUCla + $cur-alpha), $color
|
|
346
|
+
);
|
|
347
|
+
$i: $i + 1;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
$values: map.merge($values, $color-values);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
@return $values;
|
|
355
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
@use 'sass:list';
|
|
2
|
+
@use 'sass:map';
|
|
3
|
+
@use 'sass:meta';
|
|
4
|
+
@use 'sass:string';
|
|
5
|
+
@use 'sass:selector';
|
|
6
|
+
|
|
7
|
+
@use '../forward-tools' as ml;
|
|
8
|
+
|
|
9
|
+
@function util-apply-selector($selector, $util-sel-list) {
|
|
10
|
+
@if not $selector {
|
|
11
|
+
@return if(
|
|
12
|
+
meta.type-of(ml.$utils-up-specificity) == 'string',
|
|
13
|
+
selector.nest(ml.$utils-up-specificity, $util-sel-list),
|
|
14
|
+
$util-sel-list
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
$result: if(
|
|
19
|
+
string.index(meta.inspect($selector), ml.$tSTu),
|
|
20
|
+
-apply-custom($selector, $util-sel-list),
|
|
21
|
+
-apply-external($selector, $util-sel-list)
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
@if meta.type-of(ml.$utils-up-specificity) == 'string' {
|
|
25
|
+
$result: selector.nest(ml.$utils-up-specificity, $result);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@return if(
|
|
29
|
+
list.length($result) > 1,
|
|
30
|
+
$result,
|
|
31
|
+
list.nth($result, 1)
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@function -str-item-index($item, $i, $str) {
|
|
36
|
+
@return string.index($item, $str);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@function -apply-external($external-sel-list, $util-sel-list) {
|
|
40
|
+
$result: ();
|
|
41
|
+
|
|
42
|
+
@each $external-sel in $external-sel-list {
|
|
43
|
+
@each $util-selector in $util-sel-list {
|
|
44
|
+
$util-sel-str: if(
|
|
45
|
+
meta.type-of($util-selector) == 'list',
|
|
46
|
+
meta.inspect($util-selector),
|
|
47
|
+
$util-selector
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
$util-simple-sel: -util-simple-selector($util-sel-str);
|
|
51
|
+
$result: list.append(
|
|
52
|
+
$result,
|
|
53
|
+
if(
|
|
54
|
+
$util-simple-sel == $util-sel-str,
|
|
55
|
+
$external-sel,
|
|
56
|
+
ml.str-replace-all($util-sel-str, $util-simple-sel, $external-sel)
|
|
57
|
+
),
|
|
58
|
+
comma
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@return $result;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@function -apply-custom($custom-sel, $util-sel-list) {
|
|
67
|
+
$result: ();
|
|
68
|
+
|
|
69
|
+
@each $util-selector in $util-sel-list {
|
|
70
|
+
$selector: $custom-sel;
|
|
71
|
+
$complex-sel-list: ml.str-split($selector, ' ');
|
|
72
|
+
|
|
73
|
+
$compound-sel: if(
|
|
74
|
+
list.length($complex-sel-list) > 1,
|
|
75
|
+
ml.ls-find($complex-sel-list, meta.get-function('-str-item-index'), ml.$tSTu),
|
|
76
|
+
$selector
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
$compound-sel-prefix: list.nth(ml.str-split($compound-sel, ml.$tSTu), 1);
|
|
80
|
+
$new-util-compd-sel: null;
|
|
81
|
+
|
|
82
|
+
$util-sel-str: if(
|
|
83
|
+
meta.type-of($util-selector) == 'list',
|
|
84
|
+
meta.inspect($util-selector),
|
|
85
|
+
$util-selector
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
@if $compound-sel-prefix != '' {
|
|
89
|
+
$util-simple-sel: -util-simple-selector($util-sel-str);
|
|
90
|
+
$new-util-compd-sel: $compound-sel-prefix + string.slice($util-simple-sel, 2);
|
|
91
|
+
|
|
92
|
+
$util-sel-str: ml.str-replace(
|
|
93
|
+
$util-sel-str, $util-simple-sel, $new-util-compd-sel
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
$selector: ml.str-replace(
|
|
97
|
+
$selector, $compound-sel-prefix + ml.$tSTu, $util-sel-str
|
|
98
|
+
);
|
|
99
|
+
} @else {
|
|
100
|
+
$selector: ml.str-replace($selector, ml.$tSTu, $util-sel-str);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@if string.index($selector, ml.$tSTu) {
|
|
104
|
+
$selector: ml.str-replace-all(
|
|
105
|
+
$selector,
|
|
106
|
+
ml.$tSTu,
|
|
107
|
+
$new-util-compd-sel or -util-simple-selector($util-sel-str)
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
$result: list.append($result, $selector, comma);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@return $result;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@function -util-simple-selector($util-selector) {
|
|
118
|
+
// A bad solution, because a simple selector can be obtained in `mk-state` mixin, but now it seems too difficult to do it. Maybe this will be refactored in future
|
|
119
|
+
$complex-sel: list.nth(selector.parse($util-selector), 1);
|
|
120
|
+
|
|
121
|
+
$compound-sel: if(
|
|
122
|
+
list.length($complex-sel) > 1,
|
|
123
|
+
ml.ls-find($complex-sel, meta.get-function('-str-item-index'), ml.$tUCm),
|
|
124
|
+
list.nth($complex-sel, 1)
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
$simple-sel-list: selector.simple-selectors($compound-sel);
|
|
128
|
+
|
|
129
|
+
@return if(
|
|
130
|
+
list.length($simple-sel-list) > 1,
|
|
131
|
+
ml.ls-find($simple-sel-list, meta.get-function('-str-item-index'), ml.$tUCm),
|
|
132
|
+
$compound-sel
|
|
133
|
+
);
|
|
134
|
+
}
|