rDrama/files/assets/css2/bootstrap/vendor/_rfs.scss
2021-09-29 03:47:46 +02:00

163 lines
4.3 KiB
SCSS

//
//
$rfs-base-font-size: 1.25rem !default;
$rfs-font-size-unit: rem !default;
$rfs-breakpoint: 1200px !default;
$rfs-breakpoint-unit: px !default;
$rfs-two-dimensional: false !default;
$rfs-factor: 10 !default;
@if type-of($rfs-factor) != "number" or $rfs-factor <= 1 {
@error "`#{$rfs-factor}` is not a valid $rfs-factor, it must be greater than 1.";
}
$rfs-class: false !default;
$rfs-rem-value: 16 !default;
$rfs-safari-iframe-resize-bug-fix: false !default;
$enable-responsive-font-sizes: true !default;
$rfs-base-font-size-unit: unit($rfs-base-font-size);
@if $rfs-base-font-size-unit == "px" {
$rfs-base-font-size: $rfs-base-font-size / ($rfs-base-font-size * 0 + 1);
}
@else if $rfs-base-font-size-unit == "rem" {
$rfs-base-font-size: $rfs-base-font-size / ($rfs-base-font-size * 0 + 1 / $rfs-rem-value);
}
$rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
@if $rfs-breakpoint-unit-cache == "px" {
$rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1);
}
@else if $rfs-breakpoint-unit-cache == "rem" or $rfs-breakpoint-unit-cache == "em" {
$rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1 / $rfs-rem-value);
}
@mixin rfs($fs, $important: false) {
$fs-unit: if(type-of($fs) == "number", unit($fs), false);
$rfs-suffix: if($important, " !important", "");
@if not $fs-unit or $fs-unit != "" and $fs-unit != "px" and $fs-unit != "rem" or $fs == 0 {
font-size: #{$fs}#{$rfs-suffix};
}
@else {
$rfs-static: null;
$rfs-fluid: null;
@if $fs-unit == "px" {
$fs: $fs / ($fs * 0 + 1);
}
@else if $fs-unit == "rem" {
$fs: $fs / ($fs * 0 + 1 / $rfs-rem-value);
}
@if $rfs-font-size-unit == rem {
$rfs-static: #{$fs / $rfs-rem-value}rem#{$rfs-suffix};
}
@else if $rfs-font-size-unit == px {
$rfs-static: #{$fs}px#{$rfs-suffix};
}
@else {
@error "`#{$rfs-font-size-unit}` is not a valid unit for $rfs-font-size-unit. Use `px` or `rem`.";
}
@if $fs > $rfs-base-font-size and $enable-responsive-font-sizes {
$min-width: null;
$variable-unit: null;
$fs-min: $rfs-base-font-size + ($fs - $rfs-base-font-size) / $rfs-factor;
$fs-diff: $fs - $fs-min;
$min-width: if($rfs-font-size-unit == rem, #{$fs-min / $rfs-rem-value}rem, #{$fs-min}px);
$variable-unit: if($rfs-two-dimensional, vmin, vw);
$variable-width: #{$fs-diff * 100 / $rfs-breakpoint}#{$variable-unit};
$rfs-fluid: calc(#{$min-width} + #{$variable-width}) #{$rfs-suffix};
}
@if $rfs-fluid == null {
font-size: $rfs-static;
}
@else {
$mq-value: null;
@if $rfs-breakpoint-unit == em or $rfs-breakpoint-unit == rem {
$mq-value: #{$rfs-breakpoint / $rfs-rem-value}#{$rfs-breakpoint-unit};
}
@else if $rfs-breakpoint-unit == px {
$mq-value: #{$rfs-breakpoint}px;
}
@else {
@error "`#{$rfs-breakpoint-unit}` is not a valid unit for $rfs-breakpoint-unit. Use `px`, `em` or `rem`.";
}
@if $rfs-class == "disable" {
&,
.disable-responsive-font-size &,
&.disable-responsive-font-size {
font-size: $rfs-static;
}
}
@else {
font-size: $rfs-static;
}
@if $rfs-two-dimensional {
@media (max-width: #{$mq-value}), (max-height: #{$mq-value}) {
@if $rfs-class == "enable" {
.enable-responsive-font-size &,
&.enable-responsive-font-size {
font-size: $rfs-fluid;
}
}
@else {
font-size: $rfs-fluid;
}
@if $rfs-safari-iframe-resize-bug-fix {
min-width: 0vw;
}
}
}
@else {
@media (max-width: #{$mq-value}) {
@if $rfs-class == "enable" {
.enable-responsive-font-size &,
&.enable-responsive-font-size {
font-size: $rfs-fluid;
}
}
@else {
font-size: $rfs-fluid;
}
@if $rfs-safari-iframe-resize-bug-fix {
min-width: 0vw;
}
}
}
}
}
}
@mixin font-size($fs, $important: false) {
@include rfs($fs, $important);
}
@mixin responsive-font-size($fs, $important: false) {
@include rfs($fs, $important);
}