@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,175 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:list';
|
|
3
|
+
@use 'sass:map';
|
|
4
|
+
@use 'sass:selector';
|
|
5
|
+
@use 'sass:string';
|
|
6
|
+
|
|
7
|
+
@use 'forward-tools' as ml;
|
|
8
|
+
|
|
9
|
+
// mk-state
|
|
10
|
+
//
|
|
11
|
+
// Generates values for utilities in various [states](section-concepts.html#kssref-concepts-utility-states). Names and values of states are set in the [settings](#kssref-sass-tools-settings-utils-states). Usually this mixin is not used separately because it is called inside [mk-util](#kssref-sass-tools-mixins-mk_util).
|
|
12
|
+
//
|
|
13
|
+
// ```scss
|
|
14
|
+
//@include mk-state('.Bgc-mn0', ('h')) {
|
|
15
|
+
// background-color: #60f;
|
|
16
|
+
//}
|
|
17
|
+
// ```
|
|
18
|
+
// CSS
|
|
19
|
+
// ```css
|
|
20
|
+
//.Bgc-mn0 {
|
|
21
|
+
// background-color: #60f;
|
|
22
|
+
//}
|
|
23
|
+
//
|
|
24
|
+
//.h_Bgc-mn0:hover {
|
|
25
|
+
// background-color: #60f;
|
|
26
|
+
//}
|
|
27
|
+
// ```
|
|
28
|
+
//
|
|
29
|
+
// $post
|
|
30
|
+
// $pre = null
|
|
31
|
+
// $no-state = 1 - number flag. If equal to 1, then a value without state will be generated as in the example above.
|
|
32
|
+
// $selector = & - selector of CSS rule. Can be `string` or `&`.
|
|
33
|
+
// $this-util = null
|
|
34
|
+
// $custom-sel = null
|
|
35
|
+
//
|
|
36
|
+
/// Styleguide: sass-tools.mixins.utils.mk_state
|
|
37
|
+
|
|
38
|
+
@mixin mk-state(
|
|
39
|
+
$post,
|
|
40
|
+
$pre: null,
|
|
41
|
+
$no-state: true,
|
|
42
|
+
$selector: &,
|
|
43
|
+
$this-util: null,
|
|
44
|
+
$custom-sel: null,
|
|
45
|
+
) {
|
|
46
|
+
@if not $selector {
|
|
47
|
+
@error '$selector argument must not be null.';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
$selector: ml.css-class($selector);
|
|
51
|
+
$final-selector-list: ();
|
|
52
|
+
$pre-comb-list: $selector;
|
|
53
|
+
|
|
54
|
+
@at-root {
|
|
55
|
+
@if $no-state {
|
|
56
|
+
#{ml.util-apply-selector($custom-sel, $selector)} {
|
|
57
|
+
@content;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@if $pre {
|
|
62
|
+
$pre-comb-list: ();
|
|
63
|
+
$pre-states: ml.str-split($pre, ml.$kStCb);
|
|
64
|
+
$separate-states: list.nth($pre-states, 1);
|
|
65
|
+
|
|
66
|
+
@if $separate-states != '' {
|
|
67
|
+
$final-selector-list: -convert-states($separate-states, $selector, $this-util);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@if list.length($pre-states) > 1 {
|
|
71
|
+
$pre-comb-list: -convert-states(list.nth($pre-states, 2), $selector, $this-util);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@if $post {
|
|
76
|
+
$post-states: ml.str-split($post, ml.$kStCb);
|
|
77
|
+
$separate-states: list.nth($post-states, 1);
|
|
78
|
+
|
|
79
|
+
@if $separate-states != '' {
|
|
80
|
+
$final-selector-list: list.join(
|
|
81
|
+
$final-selector-list,
|
|
82
|
+
-convert-states($separate-states, $selector, $this-util, 'post')
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@if list.length($post-states) > 1 {
|
|
87
|
+
@each $pre-item in $pre-comb-list {
|
|
88
|
+
$final-selector-list: list.join(
|
|
89
|
+
$final-selector-list,
|
|
90
|
+
-convert-states(list.nth($post-states, 2), $pre-item, $this-util, 'post')
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@each $item in $final-selector-list {
|
|
97
|
+
#{ml.util-apply-selector($custom-sel, $item)} {
|
|
98
|
+
@content;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@function -pre-state-selector($list, $selector, $this: null) {
|
|
105
|
+
$result: ();
|
|
106
|
+
$selector: ml.css-class($selector, 1);
|
|
107
|
+
$escaped-token: ml.str-escape(ml.$tUCm);
|
|
108
|
+
|
|
109
|
+
@each $item in $list {
|
|
110
|
+
$selector-list: '';
|
|
111
|
+
|
|
112
|
+
@each $part in ml.str-split(
|
|
113
|
+
ml.convert-util-states($item, $this, true), ','
|
|
114
|
+
) {
|
|
115
|
+
$state-prefix: ml.str-escape($item) + $escaped-token;
|
|
116
|
+
$ar-separator: string.index($selector, $escaped-token + $this);
|
|
117
|
+
|
|
118
|
+
$cur-selector: if(
|
|
119
|
+
$ar-separator,
|
|
120
|
+
string.insert(
|
|
121
|
+
$selector, $state-prefix, $ar-separator + string.length($escaped-token)
|
|
122
|
+
),
|
|
123
|
+
$state-prefix + $selector
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
$selector-list: $selector-list + '#{$part}.#{$cur-selector},';
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
$result: list.append($result, string.slice($selector-list, 1, -2));
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@return $result;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@function -post-state-selector($list, $selector, $this: null) {
|
|
136
|
+
$result: ();
|
|
137
|
+
$escaped-token: ml.str-escape(ml.$tSTu);
|
|
138
|
+
|
|
139
|
+
@each $item in $list {
|
|
140
|
+
$util-selector: selector.append($selector, ml.str-escape(ml.$tUCm + $item));
|
|
141
|
+
$state-selector: ml.str-replace-all(
|
|
142
|
+
ml.convert-util-states($item, $this), $escaped-token, $util-selector
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
$result: list.append(
|
|
146
|
+
$result,
|
|
147
|
+
selector.nest(
|
|
148
|
+
$util-selector,
|
|
149
|
+
$state-selector
|
|
150
|
+
)
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@return $result;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@function -convert-states($item, $selector, $this: null, $type: 'pre') {
|
|
158
|
+
// TODO: move this repeating code from here and from `mk-ar` to a separate function
|
|
159
|
+
$result: ml.str-split(ml.str-trim($item), ' ');
|
|
160
|
+
|
|
161
|
+
@each $key, $value in map.get(ml.$utils-cfg, 'states', 'keywords') {
|
|
162
|
+
@if meta.type-of($value) == 'string' {
|
|
163
|
+
$value: map.keys(map.get(ml.$utils-cfg, 'states', $value));
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
$result: ml.replace-keyword($result, $key, $value);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
@return meta.call(
|
|
170
|
+
meta.get-function('-#{$type}-state-selector'),
|
|
171
|
+
$result,
|
|
172
|
+
$selector,
|
|
173
|
+
$this
|
|
174
|
+
);
|
|
175
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@forward 'utils';
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
@use 'sass:meta';
|
|
2
|
+
@use 'sass:list';
|
|
3
|
+
@use 'sass:map';
|
|
4
|
+
@use 'sass:math';
|
|
5
|
+
@use 'sass:string';
|
|
6
|
+
|
|
7
|
+
@forward 'mk-util';
|
|
8
|
+
|
|
9
|
+
@use '../forward-tools' as ml;
|
|
10
|
+
@use 'mk-util' as mu;
|
|
11
|
+
|
|
12
|
+
// Utilities
|
|
13
|
+
//
|
|
14
|
+
// Mixins for creating utilities and working with them.
|
|
15
|
+
//
|
|
16
|
+
// Styleguide: sass-tools.mixins.utils
|
|
17
|
+
|
|
18
|
+
// mk-utils-group
|
|
19
|
+
//
|
|
20
|
+
// Creates utilities group based on a map or a list with values. Works similarly that [mk-util](section-sass-tools.html#kssref-sass-tools-mixins-utils-mk_util) mixin. You can find existing groups [here](section-general_reference.html#kssref-general_reference-groups).
|
|
21
|
+
//
|
|
22
|
+
// ```scss
|
|
23
|
+
// @include ml.mk-utils-group(
|
|
24
|
+
// 'Margins', (
|
|
25
|
+
// 'xs0': 100px,
|
|
26
|
+
// 150: null
|
|
27
|
+
// ));
|
|
28
|
+
//
|
|
29
|
+
// // CSS
|
|
30
|
+
// .M-xs0 {
|
|
31
|
+
// margin: 100px;
|
|
32
|
+
// }
|
|
33
|
+
//
|
|
34
|
+
// .M150 {
|
|
35
|
+
// margin: 150px;
|
|
36
|
+
// }
|
|
37
|
+
//
|
|
38
|
+
// .Mt-xs0 {
|
|
39
|
+
// margin-top: 100px;
|
|
40
|
+
// }
|
|
41
|
+
//
|
|
42
|
+
// // etc
|
|
43
|
+
// ```
|
|
44
|
+
//
|
|
45
|
+
// $raw-name - `string` <div> name of the group. You can use [generation syntax](section-concepts.html#kssref-concepts-util-components-syntax) here </div>
|
|
46
|
+
// $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
|
|
47
|
+
// $components = () - <div class="Mt3u"> `map` </div> Contains utility [components](section-concepts.html#kssref-concepts-util-components) in longhand format
|
|
48
|
+
//
|
|
49
|
+
// Styleguide: sass-tools.mixins.utils.mk_utils_group
|
|
50
|
+
|
|
51
|
+
@mixin mk-utils-group(
|
|
52
|
+
$raw-name, $values, $components: (), $bound-components: true
|
|
53
|
+
) {
|
|
54
|
+
$group-data: ml.parse-util($raw-name);
|
|
55
|
+
$name: map.get($group-data, 'value');
|
|
56
|
+
|
|
57
|
+
@if not map.has-key(ml.$utils-groups-db, $name) {
|
|
58
|
+
@error 'Group `#{$name}` not defined in registry';
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
$bound-comp-map: (
|
|
62
|
+
$bound-components and
|
|
63
|
+
map.has-key(ml.$utils-groups-db, $name, 'components') and
|
|
64
|
+
ml.parse-util(
|
|
65
|
+
map.get(ml.$utils-groups-db, $name, 'components')
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
$is-bound-comp: list.length($bound-comp-map) > 1;
|
|
69
|
+
|
|
70
|
+
@if $is-bound-comp {
|
|
71
|
+
$group-data: $bound-comp-map;
|
|
72
|
+
} @else if list.length($components) > 0 {
|
|
73
|
+
$group-data: $components;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
$i: 1;
|
|
77
|
+
$members: (
|
|
78
|
+
map.get(ml.$utils-groups-db, $name, 'members') or
|
|
79
|
+
map.get(ml.$utils-groups-db, $name)
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
@each $util in $members {
|
|
83
|
+
@include mu.mk-util(
|
|
84
|
+
$util,
|
|
85
|
+
$values,
|
|
86
|
+
if(
|
|
87
|
+
not $is-bound-comp and string.index($util, ml.$tUCm), (), $group-data
|
|
88
|
+
),
|
|
89
|
+
('groupItemIndex': $i, 'groupBoundComp': $is-bound-comp)
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
$i: $i + 1;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// apply
|
|
97
|
+
//
|
|
98
|
+
// Applies a list of utilities in the form of styles to CSS rule:
|
|
99
|
+
// ```scss
|
|
100
|
+
// .card {
|
|
101
|
+
// display: block;
|
|
102
|
+
//
|
|
103
|
+
// @include ml.apply('P2u Fns1r xl_P5u');
|
|
104
|
+
// }
|
|
105
|
+
//
|
|
106
|
+
// // CSS
|
|
107
|
+
// .card {
|
|
108
|
+
// display: block;
|
|
109
|
+
// padding: 0.5rem;
|
|
110
|
+
// font-size: 1rem;
|
|
111
|
+
// }
|
|
112
|
+
//
|
|
113
|
+
// @media (min-width: 1200px) {
|
|
114
|
+
// .card {
|
|
115
|
+
// padding: 1.25rem;
|
|
116
|
+
// }
|
|
117
|
+
// }
|
|
118
|
+
// ```
|
|
119
|
+
//
|
|
120
|
+
// If a mixin is called outside CSS rule, then creates utilities from the list. See examples [here](section-how_to.html#kssref-how_to-config).
|
|
121
|
+
//
|
|
122
|
+
// Apply has some restrictions. If you try to use a utility with `pre-state` in it without a clear indication that this is a state, you will get an error. This happens because the Parser cannot distinguish `pre-state` from the utility itself. To create such utilities, pass a list of utilities as a list of strings, separating the components of the utility by spaces, as well as in Generation Syntax. Next, pass `true` in the third argument:
|
|
123
|
+
// ```scss
|
|
124
|
+
// @include ml.apply(('.js:h:>* _D', 'Lnh2r!_af'), (), true);
|
|
125
|
+
//
|
|
126
|
+
// // CSS
|
|
127
|
+
// .js:hover > * .\.js\:h\:\>\*_D {
|
|
128
|
+
// display: block;
|
|
129
|
+
// }
|
|
130
|
+
//
|
|
131
|
+
// .Lnh2r\!_af::after {
|
|
132
|
+
// line-height: 2rem !important;
|
|
133
|
+
// }
|
|
134
|
+
// ```
|
|
135
|
+
//
|
|
136
|
+
// $utils - `string | list` <div> string with space-separated utilities or a list of utils as strings </div>
|
|
137
|
+
// $components = () - <div class="Mt3u"> `map` </div> Contains utility [components](section-concepts.html#kssref-concepts-util-components) in longhand format
|
|
138
|
+
// $ready-list = false - <div class="Mt3u"> `boolean` </div> if `true` than you can pass any utilities as a list
|
|
139
|
+
//
|
|
140
|
+
// Styleguide: sass-tools.mixins.utils.apply
|
|
141
|
+
|
|
142
|
+
@mixin apply($utils, $components: (), $ready-list: false) {
|
|
143
|
+
$utils-list: if(
|
|
144
|
+
$ready-list, $utils, ml.str-split($utils, ' ')
|
|
145
|
+
);
|
|
146
|
+
$util-options: ('components': null);
|
|
147
|
+
|
|
148
|
+
@if & != null {
|
|
149
|
+
$util-options: map.set($util-options, 'selector', &);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// TODO: optimize the applying several values of one utility
|
|
153
|
+
@each $item in $utils-list {
|
|
154
|
+
$util-data: ml.parse-util($item);
|
|
155
|
+
$abbr-data: ml.parse-abbr(map.get($util-data, 'value'));
|
|
156
|
+
$util-data: map.merge($util-data, $components);
|
|
157
|
+
$keyword: ml.$kStOl;
|
|
158
|
+
$pre-states: map.get($util-data, 'pre-states');
|
|
159
|
+
$post-states: map.get($util-data, 'post-states');
|
|
160
|
+
|
|
161
|
+
@if map.get($util-data, 'at-rules') {
|
|
162
|
+
$keyword: ml.$kArSO;
|
|
163
|
+
// It's a bit dangerous to use non-standard fields in map, but it is unlikely that a way to check keywords in the `mk-util` will change
|
|
164
|
+
$util-data: map.set($util-data, 'applyArKw', ml.$kArOl);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@if $pre-states or $post-states {
|
|
168
|
+
@if $pre-states and $post-states {
|
|
169
|
+
$util-data: map.merge(
|
|
170
|
+
$util-data,
|
|
171
|
+
(
|
|
172
|
+
'pre-states': '#{ml.$kStCb} ' + $pre-states,
|
|
173
|
+
'post-states':'#{ml.$kStCb} ' + $post-states,
|
|
174
|
+
)
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
$util-data: map.set($util-data, 'applyStKw', $keyword);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@include mu.mk-util(
|
|
182
|
+
map.get($abbr-data, 'name'),
|
|
183
|
+
map.get($abbr-data, 'value'),
|
|
184
|
+
map.remove($util-data, 'value'),
|
|
185
|
+
$util-options
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
}
|