mirror of
https://github.com/tabler/tabler.git
synced 2026-08-29 21:31:28 +04:00
58 lines
2.3 KiB
SCSS
58 lines
2.3 KiB
SCSS
@use 'sass:map';
|
|
@use 'sass:meta';
|
|
// Not forwarded by `_mixins.scss` on purpose: this file uses `config`, so
|
|
// forwarding it there would create a circular module load.
|
|
@use '../config' as *;
|
|
|
|
// Emits the whole utilities API (responsive, RFS and print variants) for a
|
|
// given `$utilities` map. Parameterized so that bundles with their own map
|
|
// (e.g. tabler-marketing) can reuse the loops — with the module system a
|
|
// bundle can no longer swap the global `$utilities` before loading the API.
|
|
@mixin utilities-api($utilities) {
|
|
// Loop over each breakpoint
|
|
@each $breakpoint in map.keys($grid-breakpoints) {
|
|
// Generate media query if needed
|
|
@include media-breakpoint-up($breakpoint) {
|
|
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
|
|
|
|
// Loop over each utility property
|
|
@each $key, $utility in $utilities {
|
|
// The utility can be disabled with `false`, thus check if the utility is a map first
|
|
// Only proceed if responsive media queries are enabled or if it's the base media query
|
|
@if meta.type-of($utility) == 'map' and (map.get($utility, responsive) or $infix == '') {
|
|
@include generate-utility($utility, $infix);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// RFS rescaling
|
|
@media (min-width: $rfs-mq-value) {
|
|
@each $breakpoint in map.keys($grid-breakpoints) {
|
|
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
|
|
|
|
@if (map.get($grid-breakpoints, $breakpoint) < $rfs-breakpoint) {
|
|
// Loop over each utility property
|
|
@each $key, $utility in $utilities {
|
|
// The utility can be disabled with `false`, thus check if the utility is a map first
|
|
// Only proceed if responsive media queries are enabled or if it's the base media query
|
|
@if meta.type-of($utility) == 'map' and map.get($utility, rfs) and (map.get($utility, responsive) or $infix == '') {
|
|
@include generate-utility($utility, $infix, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Print utilities
|
|
@media print {
|
|
@each $key, $utility in $utilities {
|
|
// The utility can be disabled with `false`, thus check if the utility is a map first
|
|
// Then check if the utility needs print styles
|
|
@if meta.type-of($utility) == 'map' and map.get($utility, print) == true {
|
|
@include generate-utility($utility, '-print');
|
|
}
|
|
}
|
|
}
|
|
}
|