8 #settings Settings
Most of the settings are stored in large maps, which are called depending on the area: utils
, at-aules
etc. Such settings are divided into two types, depending on the contents: data and configurations. Next, we will call their databases and configures, accordingly.
For user settings, separate maps are provided, which differ in the suffix. It is in them that you add changes in the configuration and they also merge into the original maps.
- maps with data: source suffix -
db
, user's -data
- maps with configs: source suffix -
cfg
, user's -config
@use 'mlut/tools' with (
$utils-config: (
'states': (
'custom': (
'are': '[aria-expanded=“true”]',
),
),
),
$at-rules-data: (
'container': (
'alias': 'c',
),
),
);
If you want to completely overwrite map or one of its fields, specify null
. Below in the configuration use *mapname*-ext
and then your values.
@use 'mlut/tools' as ml with (
$utils-data: (
'utils': (
'registry': (
'Ps': null,
),
),
),
$utils-data-ext: (
'utils': (
'registry': (
'Ps': (
'properties': position,
'keywords': ('sc': sticky),
),
)
),
),
);
@debug ml.uv('Ps-sc'); // sticky
@debug ml.uv('Ps-a'); // a
This is relevant for some smaller maps like a $breakpoints
. In the specific settings will specified which maps have the possibility of rewriting using ext
.
For the time being, you can look at the structure of maps with the settings in the code, but later it will be described in the documentation.
content/main.css
, line 1711
8.1 #settings.at_rules At-rules
Settings for media queries and other CSS at-rules. There is a small database and several configs.
../packages/core/src/sass/tools/settings/common/_at-rules.scss
, line 8
8.1.1 #settings.at_rules.breakpoints Breakpoints
Breakpoints are stored in the config $at-rules-cfg
, in the breakpoints
section. For convenience, they are configured in a separate map $breakpoints
. You can see an example of simple use here.
Name | Value |
---|---|
<sm | 0px |
sm | 520px |
md | 768px |
lg | 992px |
xl | 1200px |
xxl | 1400px |
To fully rewrite breakpoints, use $breakpoints-ext
map:
@use 'mlut/tools' as ml with (
$breakpoints: null,
$breakpoints-ext: (
'sm': 768px,
'md': 1200px,
'lg': 1440px,
),
);
@debug map.get(ml.$at-rules-cfg, 'breakpoints');
// (
// 'sm': 768px,
// 'md': 1200px,
// 'lg': 1440px,
// )
../packages/core/src/sass/tools/settings/common/_at-rules.scss
, line 26
8.1.2 #settings.at_rules.data Data
$at-rules-db
- map, the keys in which are the names of the at-rules, and the values are map with options. In the options of each at-rule there is a custom map, to which you can add alias for custom expressions. See example here.
Below are the at-rule options
-
alias
string
the abbreviation that will be used in the utils components. It will be converted into at-crule name. For example:@s
=>@supports
-
default
boolean
true
, only in one at-rule. Sets at-rule by default. This means that this at-rule will be used, without an indication of alias after the@
symbol. By default,media
is default at-ruleDefaults to:false
-
custom
map
../packages/core/src/sass/tools/settings/common/_at-rules.scss
, line 14
8.2 #settings.general General
Settings that affect the work of the all toolkit.
-
$browser-font-size
font size for converting px to rem. 16px used because is default font size in settings of most browsers.Defaults to:16px
-
$su
space unit valueDefaults to:0.25rem
-
$css-vars-fallback
add fallback for values ingrid-gutters
unitsDefaults to:false
-
$css-transition-time
default transition duration.Defaults to:0.3s
-
$ratio-box-flex
adds a more advanced version of Ratio-box helper with an arbitrary height -ratio-box-flex
Defaults to:false
-
$wrapper-max-width
max width of the Wraper helperDefaults to:1200px
-
$css-var-prefix
prefix for the CSS custom properties, which are generated in the values of utilities. For example, value ofW-$myCard
with prefix:var(--ml-myCard)
, and without:var(--myCard)
Defaults to:'ml-'
-
$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
../packages/core/src/sass/tools/settings/base/_general.scss
, line 5
8.3 #settings.gs Grid system
Settings that affect the work of grid system both modern and legacy.
-
$legacy-grid-system
enable legacy grid system and generate some CSS for itDefaults to:false
-
$gs-default-gtr
default gutter on large width screen. Used as fallback for--ml-gg
.Defaults to:4u
-
$gs-columns
columns count.Defaults to:12
-
$gs-gutters
map with grid gutters on breakpoints.
../packages/core/src/sass/tools/settings/high/_grid.scss
, line 5
8.3.1 #settings.gs.gtr Gutters
The gutters are stored in $gs-gutters
map. The keys in it are the names of the breakpoints, and the values are gutter. It is automatically filled out based on breakpoints. If you want to supplement or change gutters, use $gs-gutters-ext
. If you want to completely overwrite the initial values, specify them in $gs-gutters
in the config. Pay attention that this behavior is different from all other settings like a breakpoints
Gutters value on breakpoints:
Breakpoint | Gutter |
---|---|
<sm | 3u |
sm | 3u |
md | 3u |
lg | 4u |
xl | 4u |
xxl | 4u |
../packages/core/src/sass/tools/settings/high/_grid.scss
, line 19
8.4 #settings.utils Utilities
In the settings of utilities, there are both data and configs.
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 4
8.4.1 #settings.utils.config Config
Most of the settings are stored here, on the basis of which utilities work. Below are some sections that may be useful during customization.
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 82
8.4.1.1 #settings.utils.config.conversion Conversion type
Available on the key conversion-types
. This is a map, the keys in which are names of types that are used in utility options. The values in a map are a list of converters through which the value of utilities passes.
$utils-cfg: (
'conversion-types': (
'angle': ('angle', 'global-kw', 'cust-prop'),
'grid-span': ('grid-span', 'num-length', 'global-kw', 'cust-prop'),
),
);
Each converter is a function that returns, either an converted or initial value. By default, if the value was converted, then the process stops, else the value passes to the next converter from the list. If not a single converter has no worked, then at the result we get the initial value. But this behavior can be changed when adding a keyword Pl
(pipeline) to the list. The converters specified after it will be applied regardless of whether the value was converted in one of them. The list of all converters can be viewed in the code, but later they will be added here
Below you can find all available types of conversion. In the description of each type there will be a schema: a list of converters and keywords on which the conversion depends. For DRY reason, in the schema used Sass variables containing frequently used converters. They will be presented in the documentation as meta-types. You can use these variables when adding new types of conversion. In addition, the description of the type will have examples of its work.
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 119
8.4.1.1.1 #settings.utils.config.conversion.abbr-kw abbr-kw
Expand abbreaviations of utilities. Schema:
('abbr-kw': list.join('abbr', $uv-type-default))
Usage:
@debug ml.uv('Wlc-tf'); // transform
@debug ml.uv('Ts-bdc;2s,c;1s'); // border-color 2s, color 1s
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 257
8.4.1.1.2 #settings.utils.config.conversion.angle angle
Converts angles. Schema:
('angle': list.join('angle', $uv-type-base))
Usage:
@debug ml.uv('-Rt45d'); // 45deg
@debug ml.uv('-Rt-50g'); // -50grad
@debug ml.uv('-Sk3.14r;2r'); // 3.14rad 2rad
@debug ml.uv('-Hur-1.5t'); // -1.5turn
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 224
8.4.1.1.3 #settings.utils.config.conversion.color color
Converts colors. Schema:
('color': list.join('color', $uv-type-base))
Usage:
@debug ml.uv('C-tp'); // transparent
@debug ml.uv('Bgc#c06*$bgAlpha'); // rgba(204, 0, 102, var(--ml-bgAlpha, 1))
// you can use custom color keyword that you added in the database
@debug ml.uv('Bgc-purple50*20p'); // rgba(102, 0, 204, 0.2)
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 240
8.4.1.1.4 #settings.utils.config.conversion.gradient gradient
Converts values in the gradient functions. Schema:
('gradient': (
'keyword', 'color', 'cust-prop', 'Pl', 'number', 'angle', 'global-kw'
))
Usage:
@debug ml.uv('-Gdrl-b;r,black,#ff0'); // repeating-linear-gradient(to bottom right, black, #ff0)
@debug ml.uv('-Gdl-50d,blue;3r,cc;80p'); // linear-gradient(50deg, blue 3rem, currentColor 80%)
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 313
8.4.1.1.5 #settings.utils.config.conversion.grid-span grid-span
Converts special keywords, to specify the sizes of the grid items in spans. Schema:
('grid-span': list.join(('grid-span', 'num-length'), $uv-type-base))
Usage:
@debug ml.uv('Gc-s3'); // span 3 / span 3
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 285
8.4.1.1.6 #settings.utils.config.conversion.grid-tpl grid-tpl
Adds converting of special keywords for grid templates to the default type. Schema:
('grid-tpl': list.join('grid-tracks', $uv-type-default))
Usage:
@debug ml.uv('Gtc-t4'); // repeat(4, minmax(0, 1fr))
@debug ml.uv('G-t3/af;d;15r'); // repeat(3, minmax(0, 1fr)) / auto-flow dense 15rem
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 271
8.4.1.1.7 #settings.utils.config.conversion.kw-num-length kw-num-length
Type works almost as a default type, with the exception of that it does not convert numbers without units of measurement in a pixels. Schema:
('kw-num-length': list.set-nth($uv-type-default, 2, 'num-length'))
Usage:
@debug ml.uv('Fnw300'); // 300
@debug ml.uv('Fnw-bd'); // bolder
@debug ml.uv('Lnh4.5u'); // 1.125rem
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 195
8.4.1.1.8 #settings.utils.config.conversion.meta_base $uv-type-base
The basic meta type on which all other types are based. Schema:
$uv-type-base: ('global-kw', 'cust-prop');
Usage:
// global keywords
@debug ml.uv('C-ih'); // inherit
@debug ml.uv('W-gSm'); // 520px - sm breakpoints
// custom properties
@debug ml.uv('W-$myCard?200'); // var(--ml-myCard, 200px)
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 136
8.4.1.1.9 #settings.utils.config.conversion.meta_default $uv-type-default
Meta type that corresponds to the default conversion type. If the type of conversion is not specified for the utility, then this will be used. Schema:
$uv-type-default: list.join(('keyword', 'number'), $uv-type-base);
// and below in the conversion types
'conversion-types': (
'default': $uv-type-default,
Usage:
// keyword
@debug ml.uv('Ai-c'); // center
@debug ml.uv('Bd'); // 1px solid
// number
@debug ml.uv('W200'); // 200px
@debug ml.uv('Ml-0.7'); // -0.7rem
@debug ml.uv('P1r;2e;5p'); // 1rem 2em 5%
@debug ml.uv('Ml-2.5gg'); // calc(var(--ml-gg) * -2.5)
@debug ml.uv('W1/3'); // 33.3333333333%
@debug ml.uv('W2/$div'); // calc(2 / var(--ml-div) * 100%)
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 154
8.4.1.1.10 #settings.utils.config.conversion.num-length num-length
This type converts numbers almost as a default type, except that it does not convert numbers without units of measurement in a pixels. Schema:
('num-length': list.join('num-length', $uv-type-base))
Usage:
@debug ml.uv('Zi5'); // 5
@debug ml.uv('Tas2e'); // 2em
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 181
8.4.1.1.11 #settings.utils.config.conversion.num-percent num-percent
Converts percent to decimal fractions. Schema:
('num-percent': list.join('num-percent', $uv-type-base))
Usage:
@debug ml.uv('O70p'); // 0.7
@debug ml.uv('-S-50p'); // -0.5
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 210
8.4.1.1.12 #settings.utils.config.conversion.outline outline
Adds colors conversion to a default converters chain. Schema:
('outline': list.join(
('keyword', 'color', 'number'), $uv-type-base
))
Usage:
@debug ml.uv('Bd3;tp;d'); // 3px transparent dotted
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 298
8.4.1.2 #settings.utils.config.states States
States are stored in the states
section and grouped by type:
pseudo-cls
- pseudo classespseudo-elm
- pseudo elementscustom
- all the rest
Below is a quick reference of states. Later it will be supplemented by comments and examples.
If you want to add a state, it is recommended to do this in the custom
section. Please note that in the code, all custom states begin with a hyphen. This prevents names collision with native states from CSS.
@use 'mlut/tools' as ml with (
$utils-config: (
'states': (
'custom': (
'rtl': '[dir=“rtl”]',
),
),
),
);
@include ml.apply(('-rtl _Mr2r'), (), true);
// CSS
[dir=“rtl”] .-rtl_Mr2r {
margin-right: 2rem;
}
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 88
8.4.1.2.1 #settings.utils.config.states.custom custom
btc | ">*+*" |
evc | ":nth-child(2n)" |
evot | ":nth-of-type(2n)" |
odc | ":nth-child(odd)" |
odot | ":nth-of-type(odd)" |
op | "[open]" |
tif | '[tabindex="0"]' |
nojs | ".no-js" |
content/generate.css
, line 2843
8.4.1.2.2 #settings.utils.config.states.pseudo-cls pseudo classes
a | ":active" |
c | ":checked" |
d | ":disabled" |
df | ":default" |
de | ":defined" |
e | ":empty" |
en | ":enabled" |
f | ":focus" |
fw | ":focus-within" |
fv | ":focus-visible" |
frc | ":first-child" |
frot | ":first-of-type" |
h | ":hover" |
i | ":invalid" |
id | ":indeterminate" |
inr | ":in-range" |
lc | ":last-child" |
lot | ":last-of-type" |
ln | ":link" |
oc | ":only-child" |
oot | ":only-of-type" |
ot | ":optional" |
ouor | ":out-of-range" |
phs | ":placeholder-shown" |
r | ":required" |
rt | ":root" |
rdo | ":read-only" |
rdw | ":read-write" |
t | ":target" |
ui | ":user-invalid" |
uv | ":user-valid" |
v | ":visited" |
vl | ":valid" |
content/generate.css
, line 2829
8.4.1.2.3 #settings.utils.config.states.pseudo-elm pseudo elements
af | "::after" |
b | "::before" |
frl | "::first-line" |
frlt | "::first-letter" |
flsb | "::file-selector-button" |
m | "::marker" |
ph | "::placeholder" |
s | "::selection" |
content/generate.css
, line 2836
8.4.2 #settings.utils.data Data
The database of utilities is divided into 3 sections:
- utils - all utils that can be used to stylize
- media - @media features
- common - common utils for both section
Media features are here, because to work with them, the same code is used as for ordinary utilities.
The sections have a similar structure and consist of subsections such as registry and keywords.
../packages/core/src/sass/tools/settings/common/_utils.scss
, line 8
8.4.2.1 #settings.utils.data.registry Registry
The registry stores data of all utilities. You can get these data with the following path:
@use 'mlut/tools' as ml;
map.get(ml.$utils-db, 'utils', 'registry', '<utility-name>');
The registry is a map, the keys in which are the names of the utility, and the value can be, both a string with 1 property and a map with options. Below will be examined in detail the utility options. You can familiarize yourself with the utility registry on this page, and the registry of media features is available here.
../packages/core/src/sass/tools/settings/common/_utils.scss
, line 21
8.4.2.2 #settings.utils.data.kw Keywords
In this subsection, keywords that are used in several utilities are stored. To use a set of keywords from here, specify the corresponding map key, in the keywords
setting of utility.
@use 'mlut/tools' as ml with (
$utils-data: (
'utils': (
'registry': (
'Mxw': (
'keywords': ('sizing', 'my-sizing'),
),
'Flb': (
'keywords': ('sizing', 'my-sizing'),
),
),
'keywords': (
// adds new keywords to the existing set
'box-alignment': (
'sf': safe,
'u': unsafe,
),
'my-sizing': (
'sm': 22rem,
'md': 44rem,
),
),
),
),
);
@debug ml.uv('Mxw-sm'); // 22rem
@debug ml.uv('Flb-md'); // 44rem
@debug ml.uv('Jc-c;sf'); // center safe
See the full list of keywords here.
../packages/core/src/sass/tools/settings/common/_utils.scss
, line 34
8.4.2.3 #settings.utils.data.options Utilities options
These options control how the utility works. You can find example of usage in the reference. Later more examples will be added.
-
properties
string | list
The list of CSS properties controlled by the utility. Properties are specified as strings without quotes. If you do not specify this option, then the name of the utility will be used as a property -
preset-properties
map
important
boolean flag -
keywords
string | list | map
('abbr': value)
. You can also specify one or more links to the existing set. Link - the key in mapkeywords
, which is located in the same database. In this map there are already sets of frequently used CSS keywords. Please note that the keyword is an empty line''
- the meaning of the default utility value -
conversion
Type of conversion. It determines how the value of the utility in CSS value will convert. This means that for thestring
Txt-l
utility, CSS value will belowercase
, and forWlc-l
-left
. See more details about the type of conversion in the description of the configure of utilities.Defaults to:'default'
-
repeat-prop-values
boolean
margin: 1px;
, and a utility without a flag, likebackground: red
. Please note that an algorithm for repeating values differs from the repetition algorithm in CSSDefaults to:true
-
range-generator
-
selector
string
&
. For example:&::after
-
components
string
$utils-db
-
multi-list-separator
string
border-radius: 2px 3px / 8px;
. It is important to clearly specify this separator so that the conversion of the values works correctly. Usually in CSS such a separator will be,
or/
. -
transformer
string
../packages/core/src/sass/tools/settings/common/_utils.scss
, line 74
8.4.3 #settings.utils.other Other
Other settings that are not contained in main large maps
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 10
8.4.3.1 #settings.utils.other.groups Utils groups
Groups are stored in a separate database $utils-groups-db
. To modify or add groups, use $utils-groups
. When specifying utilities in the group, you can use Generation Syntax. In this case, utilities with components will be generated for each value.
@use 'mlut' as ml with (
$utils-groups: (
'MPSpaces': (
'M_ frc', Mt, Mr, Mb, Ml, -Mx, -My,
P, Pt, Pr, Pb, Pl, -Px, -Py,
),
),
$utils: (
'MPSpaces': (
100, '$myOffset'
),
),
);
// CSS
// some utils from standard library before
.M100 {
margin: 100px;
}
.M100_frc:first-child {
margin: 100px;
}
.M-\$myOffset {
margin: var(--ml-myOffset);
}
.M-\$myOffset_frc:first-child {
margin: var(--ml-myOffset);
}
.Mt100 {
margin-top: 100px;
}
// etc
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 35
8.4.3.2 #settings.utils.other.up_specificity $utils-up-specificity
boolean | string
Increase the specificity of all utilities at once. When true
- to each utility property will be added !important
. A string with a CSS selector is also acceptable. It will be added before the utility selector.
Defaults to: false
@use 'mlut/tools' as ml with (
$utils-up-specificity: true,
);
@include ml.apply('Mt2r');
// CSS
.Mt2r {
margin-top: 2rem !important;
}
../packages/core/src/sass/tools/settings/base/_utils.scss
, line 16