bootstrap/scss/utilities/_api.scss

56 lines
2.1 KiB
SCSS
Raw Normal View History

2024-07-30 13:04:11 +08:00
@use "sass:map";
@use "sass:meta";
@use "../mixins/breakpoints";
@use "../mixins/utilities" as mixins-utilities;
@use "../utilities";
2024-07-30 17:16:28 +08:00
@use "../setup/variables";
2024-07-30 13:04:11 +08:00
@use "../vendor/rfs";
2019-05-23 17:56:03 +08:00
// Loop over each breakpoint
2024-07-30 13:04:11 +08:00
@each $breakpoint in map.keys(variables.$grid-breakpoints) {
2019-05-23 17:56:03 +08:00
// Generate media query if needed
2024-07-30 13:04:11 +08:00
@include breakpoints.media-breakpoint-up($breakpoint) {
$infix: breakpoints.breakpoint-infix($breakpoint, variables.$grid-breakpoints);
2019-05-23 17:56:03 +08:00
// Loop over each utility property
2024-07-30 13:04:11 +08:00
@each $key, $utility in utilities.$utilities {
2019-05-23 17:56:03 +08:00
// 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
2024-07-30 13:04:11 +08:00
@if meta.type-of($utility) == "map" and (map.get($utility, responsive) or $infix == "") {
@include mixins-utilities.generate-utility($utility, $infix);
2019-05-23 17:56:03 +08:00
}
}
}
}
2020-02-15 19:01:32 +08:00
// RFS rescaling
2024-07-30 13:04:11 +08:00
@media (min-width: rfs.$rfs-mq-value) {
@each $breakpoint in map.keys(variables.$grid-breakpoints) {
$infix: breakpoints.breakpoint-infix($breakpoint, variables.$grid-breakpoints);
2020-02-15 19:01:32 +08:00
2024-07-30 13:04:11 +08:00
@if (map.get(variables.$grid-breakpoints, $breakpoint) < rfs.$rfs-breakpoint) {
2020-02-15 19:01:32 +08:00
// Loop over each utility property
2024-07-30 13:04:11 +08:00
@each $key, $utility in utilities.$utilities {
2020-02-15 19:01:32 +08:00
// 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
2024-07-30 13:04:11 +08:00
@if meta.type-of($utility) == "map" and map.get($utility, rfs) and (map.get($utility, responsive) or $infix == "") {
@include mixins-utilities.generate-utility($utility, $infix, true);
2020-02-15 19:01:32 +08:00
}
}
}
}
}
2019-05-23 17:56:03 +08:00
// Print utilities
@media print {
2024-07-30 13:04:11 +08:00
@each $key, $utility in utilities.$utilities {
2019-05-23 17:56:03 +08:00
// The utility can be disabled with `false`, thus check if the utility is a map first
// Then check if the utility needs print styles
2024-07-30 13:04:11 +08:00
@if meta.type-of($utility) == "map" and map.get($utility, print) == true {
@include mixins-utilities.generate-utility($utility, "-print");
2019-05-23 17:56:03 +08:00
}
}
}