@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.
Files changed (84) hide show
  1. package/README.md +24 -0
  2. package/_index.scss +1 -0
  3. package/_tools.scss +1 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/index.js +2 -0
  6. package/dist/jit/JitEngine.d.ts +19 -0
  7. package/dist/jit/JitEngine.js +124 -0
  8. package/dist/jit/index.d.ts +1 -0
  9. package/dist/jit/index.js +1 -0
  10. package/dist/sass/addons/demo-theme.scss +112 -0
  11. package/dist/sass/css/_base-setup.scss +3 -0
  12. package/dist/sass/css/_index.scss +2 -0
  13. package/dist/sass/css/helpers/_index.scss +3 -0
  14. package/dist/sass/css/helpers/btn.scss +28 -0
  15. package/dist/sass/css/helpers/gs-debug.scss +28 -0
  16. package/dist/sass/css/helpers/ratio-box.scss +47 -0
  17. package/dist/sass/css/helpers/row.scss +98 -0
  18. package/dist/sass/css/helpers/wrapper.scss +21 -0
  19. package/dist/sass/css/styles/_index.scss +2 -0
  20. package/dist/sass/css/styles/generic.scss +296 -0
  21. package/dist/sass/css/styles/variables.scss +32 -0
  22. package/dist/sass/css/utils/_bg-bd.scss +27 -0
  23. package/dist/sass/css/utils/_grid.scss +37 -0
  24. package/dist/sass/css/utils/_index.scss +2 -0
  25. package/dist/sass/css/utils/_load.scss +9 -0
  26. package/dist/sass/css/utils/_transition.scss +16 -0
  27. package/dist/sass/css/utils/box-alignment.scss +29 -0
  28. package/dist/sass/css/utils/box-model.scss +48 -0
  29. package/dist/sass/css/utils/grid-system.scss +17 -0
  30. package/dist/sass/css/utils/init.scss +107 -0
  31. package/dist/sass/css/utils/other.scss +35 -0
  32. package/dist/sass/css/utils/text.scss +33 -0
  33. package/dist/sass/css/utils/visual.scss +32 -0
  34. package/dist/sass/index.scss +4 -0
  35. package/dist/sass/tools/_index.scss +4 -0
  36. package/dist/sass/tools/functions/_index.import.scss +3 -0
  37. package/dist/sass/tools/functions/_index.scss +9 -0
  38. package/dist/sass/tools/functions/base/_error.scss +9 -0
  39. package/dist/sass/tools/functions/base/_getters.scss +124 -0
  40. package/dist/sass/tools/functions/base/_index.scss +11 -0
  41. package/dist/sass/tools/functions/base/_list.scss +56 -0
  42. package/dist/sass/tools/functions/base/_math.scss +149 -0
  43. package/dist/sass/tools/functions/base/_string.scss +300 -0
  44. package/dist/sass/tools/functions/common/_custom-units.scss +231 -0
  45. package/dist/sass/tools/functions/common/_forward-tools.scss +2 -0
  46. package/dist/sass/tools/functions/common/_helpers.scss +57 -0
  47. package/dist/sass/tools/functions/common/_index.scss +9 -0
  48. package/dist/sass/tools/functions/common/_utils.scss +211 -0
  49. package/dist/sass/tools/functions/high/_at-rules.scss +296 -0
  50. package/dist/sass/tools/functions/high/_forward-tools.scss +3 -0
  51. package/dist/sass/tools/functions/high/_index.scss +8 -0
  52. package/dist/sass/tools/functions/high/utils/_index.scss +288 -0
  53. package/dist/sass/tools/functions/high/utils/_parse-util.scss +107 -0
  54. package/dist/sass/tools/functions/high/utils/_range-generators.scss +355 -0
  55. package/dist/sass/tools/functions/high/utils/_util-apply-selector.scss +134 -0
  56. package/dist/sass/tools/functions/high/utils/_value-converters.scss +294 -0
  57. package/dist/sass/tools/functions/high/utils/_value-transformers.scss +65 -0
  58. package/dist/sass/tools/mixins/_index.import.scss +2 -0
  59. package/dist/sass/tools/mixins/_index.scss +8 -0
  60. package/dist/sass/tools/mixins/base/_forward-tools.scss +2 -0
  61. package/dist/sass/tools/mixins/base/_index.scss +93 -0
  62. package/dist/sass/tools/mixins/base/_mk-ar.scss +96 -0
  63. package/dist/sass/tools/mixins/base/_mk-state.scss +175 -0
  64. package/dist/sass/tools/mixins/high/_forward-tools.scss +3 -0
  65. package/dist/sass/tools/mixins/high/_index.scss +1 -0
  66. package/dist/sass/tools/mixins/high/utils/_index.scss +188 -0
  67. package/dist/sass/tools/mixins/high/utils/_mk-util.scss +366 -0
  68. package/dist/sass/tools/settings/_index.import.scss +3 -0
  69. package/dist/sass/tools/settings/_index.scss +3 -0
  70. package/dist/sass/tools/settings/base/_general.scss +175 -0
  71. package/dist/sass/tools/settings/base/_index.scss +2 -0
  72. package/dist/sass/tools/settings/base/_utils.scss +578 -0
  73. package/dist/sass/tools/settings/common/_at-rules.scss +213 -0
  74. package/dist/sass/tools/settings/common/_index.scss +2 -0
  75. package/dist/sass/tools/settings/common/_utils.scss +1926 -0
  76. package/dist/sass/tools/settings/high/_forward-tools.scss +2 -0
  77. package/dist/sass/tools/settings/high/_grid.scss +55 -0
  78. package/dist/sass/tools/settings/high/_index.scss +2 -0
  79. package/dist/sass/tools/settings/high/_utils.scss +104 -0
  80. package/dist/utils/index.d.ts +1 -0
  81. package/dist/utils/index.js +1 -0
  82. package/dist/utils/logger.d.ts +7 -0
  83. package/dist/utils/logger.js +13 -0
  84. package/package.json +48 -0
@@ -0,0 +1,32 @@
1
+ @use 'sass:map';
2
+ @use '../../tools' as ml;
3
+
4
+ ml.$utils-map: map.merge(
5
+ ml.$utils-map,
6
+ ml.$kSsUMCS,
7
+ (
8
+ // transform
9
+ ml.$cBpAllCp + 'Tf': (ml.$kUvKA, 'n'),
10
+ 'Tfo': (ml.$kUvKA, 'r;t', 'r;b', 'l;b', 'l;t'),
11
+ ml.$cBpAllCp + 'Translates': (-50p, 50p),
12
+ ml.$cBpAllCp + '-Trx': -100p,
13
+ ml.$cBpAllCp + '-Try': -100p,
14
+ ml.$cBpAllCp + '-Rt': (-90d, 90d, 180d),
15
+ // filter
16
+ 'Ft': ('', 'n'),
17
+ 'Bcf': ('', 'n'),
18
+ '-Bcf': '',
19
+ // other
20
+ 'Bfv': ('h', 'v'),
21
+ 'Bxdb': ml.$kUvKA,
22
+ ml.$cBpAllCp + 'Bxsd': 'n',
23
+ 'Cs': ('', 'a', 'd', 'wt', 't', 'm', 'h', 'nta'),
24
+ 'Is': ('i', 'a'),
25
+ ml.$cBpAllCp + 'O': (0, 1),
26
+ 'Ol': 0,
27
+ 'Ols': ('d', 'dh', 'db', 's'),
28
+ ml.$cBpAllCp + 'Ojf': ml.$kUvKA,
29
+ 'Ojp': ml.$kUvKA,
30
+ ml.$cBpAllCp + 'Vs': ml.$kUvKA,
31
+ )
32
+ );
@@ -0,0 +1,4 @@
1
+ @charset 'utf-8';
2
+
3
+ @forward 'tools';
4
+ @forward 'css';
@@ -0,0 +1,4 @@
1
+ @forward 'settings';
2
+ @forward 'functions' hide
3
+ str-split, str-trim, remove-nth, str-replace, str-replace-all, str-starts, ls-join, ls-find, str-hex2color, str-contains-item;
4
+ @forward 'mixins';
@@ -0,0 +1,3 @@
1
+ @forward 'base' as ml-*;
2
+ @forward 'common' as ml-*;
3
+ @forward 'high' as ml-*;
@@ -0,0 +1,9 @@
1
+ // Functions
2
+ //
3
+ // Most of the functions are used for internal needs and has not yet been documented. But some functions from here can be useful in ordinary code.
4
+ //
5
+ // Styleguide: sass-tools.functions
6
+
7
+ @forward 'base';
8
+ @forward 'common';
9
+ @forward 'high';
@@ -0,0 +1,9 @@
1
+ @use '../../settings/base/general' as ml;
2
+
3
+ @function error($message, $catch: ml.$is-test-env) {
4
+ @if $catch {
5
+ @return 'ERROR: #{$message}';
6
+ }
7
+
8
+ @error '#{$message}';
9
+ }
@@ -0,0 +1,124 @@
1
+ @use 'sass:list';
2
+ @use 'sass:string';
3
+ @use 'sass:map';
4
+ @use 'sass:meta';
5
+
6
+ @use '../../settings' as ml;
7
+
8
+ // Getters
9
+ //
10
+ // Functions-getters from settings maps and more.
11
+ //
12
+ /// Styleguide: sass-tools.functions.getters
13
+
14
+ /// Styleguide: sass-tools.functions.base.getters
15
+
16
+ @function bp($name, $error-handler: 1) {
17
+ @if map.has-key(ml.$bp-map, $name) or $error-handler == 0 {
18
+ @return map.get(ml.$bp-map, $name);
19
+ }
20
+
21
+ @error 'Invalid breakpoint name: `#{$name}`. `#{$name}` is not defined in $ml-breakpoints';
22
+ }
23
+
24
+ @function bp-next($bp: 0, $data-type: 'value') {
25
+ @if $bp == 0 or map.has-key(ml.$bp-map, $bp) {
26
+ $bp-keys: map.keys(ml.$bp-map);
27
+ $bp-index: if($bp != 0, list.index($bp-keys, $bp), 0);
28
+
29
+ @if $data-type == 'name' {
30
+ @return if($bp-index < list.length($bp-keys), list.nth(map.keys(ml.$bp-map), $bp-index + 1), 0);
31
+ } @else {
32
+ @return if($bp-index < list.length($bp-keys), list.nth(map.values(ml.$bp-map), $bp-index + 1), 0);
33
+ }
34
+ }
35
+
36
+ @error 'Invalid breakpoint name: `#{$bp}`. `#{$bp}` is not defined in $ml-breakpoints';
37
+ }
38
+
39
+ @function bp-next-name($bp: 0) {
40
+ @return bp-next($bp, 'name');
41
+ }
42
+
43
+ @function bp-prev($bp: 0, $data-type: 'value') {
44
+ @if $bp == 0 or map.has-key(ml.$bp-map, $bp) {
45
+ $bp-keys: map.keys(ml.$bp-map);
46
+ $bp-index: if($bp != 0, list.index($bp-keys, $bp), list.length($bp-keys) + 1);
47
+
48
+ @if $data-type == 'name' {
49
+ @return if($bp-index > 1, list.nth(map.keys(ml.$bp-map), $bp-index - 1), 0);
50
+ } @else {
51
+ @return if($bp-index > 1, list.nth(map.values(ml.$bp-map), $bp-index - 1), 0);
52
+ }
53
+ }
54
+
55
+ @error 'Invalid breakpoint name: `#{$bp}`. `#{$bp}` is not defined in $ml-breakpoints';
56
+ }
57
+
58
+ @function bp-prev-name($bp: 0) {
59
+ @return bp-prev($bp, 'name');
60
+ }
61
+
62
+ @function grid-gtr($name, $error-handler: 1) {
63
+ @if map.has-key(ml.$gs-gutters, $name) or $error-handler == 0 {
64
+ @return map.get(ml.$gs-gutters, $name);
65
+ }
66
+
67
+ @error 'Invalid breakpoint name: `#{$name}`. `#{$name}` is not defined in $ml-gs-gutters';
68
+ }
69
+
70
+ @function css-var($name, $error-handler: 1) {
71
+ @if map.has-key(ml.$general-cfg, 'css-vars', $name) or $error-handler == 0 {
72
+ @return map.get(ml.$general-cfg, 'css-vars', $name);
73
+ }
74
+
75
+ @error 'Invalid custom property name. `#{$name}` is not defined in $ml-css-vars';
76
+ }
77
+
78
+ // util-prop
79
+ //
80
+ // Get the CSS property, which corresponds to the utility from registry.
81
+ // ```scss
82
+ //@debug ml.util-prop('D'); // 'display'
83
+ //```
84
+ //
85
+ // $name - utility name
86
+ // $section = 'utils' - section in the registry in which utility was defined
87
+ // $name-as-prop = false - return the utility name as a property if it was not found
88
+ // $single = false - return one property of the utility, even if there are several
89
+ //
90
+ // Styleguide: sass-tools.functions.utils.util_prop
91
+
92
+ /// Styleguide: sass-tools.functions.getters.util_prop
93
+ /// Styleguide: sass-tools.functions.base.getters.util_prop
94
+
95
+ @function util-prop(
96
+ $name, $section: 'utils', $name-as-prop: false, $single: false
97
+ ) {
98
+ $options: map.get(ml.$utils-db, $section, 'registry', $name);
99
+ $prop: null;
100
+
101
+ @if meta.type-of($options) == 'map' {
102
+ $prop-list: map.get($options, 'properties');
103
+
104
+ @if $single {
105
+ $prop: list.nth($prop-list, 1);
106
+ } @else {
107
+ $prop: $prop-list;
108
+ }
109
+ } @else {
110
+ $prop: $options;
111
+ }
112
+
113
+ @return $prop or (
114
+ $name-as-prop and if(
115
+ string.slice($name, 1, 1) == '-',
116
+ (
117
+ '--' + ml.$uv-css-var-prefix +
118
+ // TODO: replace with str-lcfirst function
119
+ string.to-lower-case(string.slice($name, 2, 2)) + string.slice($name, 3)
120
+ ),
121
+ string.to-lower-case($name)
122
+ )
123
+ );
124
+ }
@@ -0,0 +1,11 @@
1
+ // Base
2
+ //
3
+ // Basic functions.
4
+ //
5
+ /// Styleguide: sass-tools.functions.base
6
+
7
+ @forward 'error';
8
+ @forward 'string';
9
+ @forward 'list';
10
+ @forward 'math';
11
+ @forward 'getters';
@@ -0,0 +1,56 @@
1
+ @use 'sass:meta';
2
+ @use 'sass:string';
3
+ @use 'sass:list';
4
+
5
+ @use 'error' as *;
6
+
7
+ // Private functions only for internal usage. I hope that in the future they will be built into Sass. And when it will happens I don't want that their removing broke backward compatibility.
8
+
9
+ @function ls-implode($list, $separator: '') {
10
+ $result: '';
11
+
12
+ @each $item in $list {
13
+ $result: $result + $item + $separator;
14
+ }
15
+
16
+ @return string.slice($result, 1, -1 - string.length($separator));
17
+ }
18
+
19
+ @function ls-find($list, $callback, $args...) {
20
+ @if meta.type-of($callback) != 'function' {
21
+ @return error(
22
+ 'Wrong type of argument $callback: `#{meta.type-of($callback)}`. Expected `function`'
23
+ );
24
+ }
25
+
26
+ $i: 1;
27
+
28
+ @each $item in $list {
29
+ @if meta.call($callback, $item, $i, $args...) {
30
+ @return $item;
31
+ }
32
+
33
+ $i: $i + 1;
34
+ }
35
+
36
+ @return null;
37
+ }
38
+
39
+ @function remove-nth($list, $index) {
40
+ @if meta.type-of($index) != 'number' {
41
+ @return error('Wrong type of argument $index: `#{meta.type-of($index)}`. Expected `number`');
42
+ }
43
+
44
+ $result: ();
45
+ $i: 1;
46
+
47
+ @each $item in $list {
48
+ @if $i != $index {
49
+ $result: list.append($result, $item);
50
+ }
51
+
52
+ $i: $i + 1;
53
+ }
54
+
55
+ @return $result;
56
+ }
@@ -0,0 +1,149 @@
1
+ @use 'sass:math';
2
+ @use 'sass:meta';
3
+
4
+ @use '../../settings' as ml;
5
+
6
+ // Math
7
+ //
8
+ // Functions for calculations.
9
+ //
10
+ // Styleguide: sass-tools.functions.math
11
+
12
+ // decimal-round
13
+ //
14
+ // Decimal rounding.
15
+ // ```scss
16
+ //@debug ml.decimal-round(33.33333%, 2); // 33.33%
17
+ //```
18
+ //
19
+ // $number - decimal to be rounded. Type: number.
20
+ // $pos - the number of decimal places.
21
+ // $type = 'round' - service parameter for functions-wrappers.
22
+ //
23
+ // Styleguide: sass-tools.functions.math.decimal_round
24
+
25
+ @function decimal-round($number, $pos, $type: 'round') {
26
+ $n: 1;
27
+
28
+ @if meta.type-of($number) != 'number' {
29
+ @error 'Wrong type of argument $number: `#{meta.type-of($number)}`. Expected number';
30
+ }
31
+
32
+ @if meta.type-of($pos) != 'number' {
33
+ @error 'Wrong type of argument $pos: `#{meta.type-of($pos)}`. Expected `number`';
34
+ }
35
+
36
+ @for $i from 0 to $pos {
37
+ $n: $n * 10;
38
+ }
39
+
40
+ @if $type == 'round' {
41
+ @return math.div(math.round($number * $n), $n);
42
+ } @else if $type == 'ceil' {
43
+ @return math.div(math.ceil($number * $n), $n);
44
+ } @else if $type == 'floor' {
45
+ @return math.div(math.floor($number * $n), $n);
46
+ } @else {
47
+ @error 'Invalid round type: `#{$type}`';
48
+ }
49
+ }
50
+
51
+ // decimal-ceil
52
+ //
53
+ // Wrapper on [decimal-round](#kssref-sass-tools-functions-math-decimal_round) for ceil round.
54
+ // ```scss
55
+ //@debug ml.decimal-ceil(33.33333%, 2); // 33.34%
56
+ //```
57
+ //
58
+ // $number - decimal to be rounded. Type: number.
59
+ // $pos - the number of decimal places.
60
+ //
61
+ // Styleguide: sass-tools.functions.math.decimal_ceil
62
+
63
+ @function decimal-ceil($number, $pos) {
64
+ @return decimal-round($number, $pos, 'ceil');
65
+ }
66
+
67
+
68
+ // decimal-floor
69
+ //
70
+ // Wrapper on [decimal-round](#kssref-sass-tools-functions-decimal_round) for floor round.
71
+ // ```scss
72
+ //@debug ml.decimal-floor(33.33999%, 2); // 33.33%
73
+ //```
74
+ //
75
+ // $number - decimal to be rounded. Type: number.
76
+ // $pos - the number of decimal places.
77
+ //
78
+ // Styleguide: sass-tools.functions.math.decimal_floor
79
+
80
+ @function decimal-floor($number, $pos) {
81
+ @return decimal-round($number, $pos, 'floor');
82
+ }
83
+
84
+ // px2em
85
+ //
86
+ // Convert pixels to `em`.
87
+ // Final value in ems rounded because accuracy more than two decimal places does not make sense.
88
+ // ```scss
89
+ //@debug ml.px2em(24px, 18px); // 1.33em
90
+ //@debug ml.px2em(24px); // 1.5em
91
+ // ```
92
+ //
93
+ // $number - number in `px` that will be converted.
94
+ // $divider = $browser-font-size - parent font size in `px`.
95
+ // $unit = 'em' - service parameter for functions-wrappers.
96
+ //
97
+ // Styleguide: sass-tools.functions.math.px2em
98
+
99
+ @function px2em($number, $divider: ml.$browser-font-size, $unit: 'em') {
100
+ @if math.is-unitless($number) {
101
+ $number: $number * 1px;
102
+ } @else if math.unit($number) == $unit {
103
+ @return $number;
104
+ }
105
+
106
+ @if $unit == 'rem' {
107
+ @return decimal-round(math.div($number, $divider), 2) * 1rem;
108
+ }
109
+
110
+ @if $unit == '' {
111
+ @return decimal-round(math.div($number, $divider), 2);
112
+ }
113
+
114
+ @return decimal-round(math.div($number, $divider), 2) * 1em;
115
+ }
116
+
117
+ // px2rem
118
+ //
119
+ // Wrapper on [px2em](#kssref-sass-tools-functions-math-px2em) for converting to `rem`. Works similarly.
120
+ // ```scss
121
+ //@debug ml.px2rem(24px); // 1.5rem
122
+ // ```
123
+ //
124
+ // $number - number in `px` that will be converted.
125
+ // $divider = $browser-font-size - browser default font size in `px`.
126
+ //
127
+ // Styleguide: sass-tools.functions.math.px2rem
128
+
129
+ @function px2rem($number, $divider: ml.$browser-font-size) {
130
+ @return px2em($number, $divider, 'rem');
131
+ }
132
+
133
+
134
+ // px2lh
135
+ //
136
+ // Wrapper on [px2em](#kssref-sass-tools-functions-math-px2em) for converting to `line-height` units. Works similarly.
137
+ // ```scss
138
+ //@debug ml.px2lh(24px, 14px); // 1.71
139
+ //@debug ml.px2lh(24px); // 1.5
140
+ // ```
141
+ //
142
+ // $number - number in `px` that will be converted.
143
+ // $divider = $browser-font-size - parent font size in `px`.
144
+ //
145
+ // Styleguide: sass-tools.functions.math.px2lh
146
+
147
+ @function px2lh($number, $divider: ml.$browser-font-size) {
148
+ @return px2em($number, $divider, '');
149
+ }