mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
parent
1663a49cee
commit
073b7b6717
244 changed files with 9494 additions and 8597 deletions
410
dev/scss/bootstrap/vendor/_rfs.scss
vendored
Normal file → Executable file
410
dev/scss/bootstrap/vendor/_rfs.scss
vendored
Normal file → Executable file
|
@ -2,30 +2,41 @@
|
|||
|
||||
// SCSS RFS mixin
|
||||
//
|
||||
// Automated font-resizing
|
||||
// Automated responsive values for font sizes, paddings, margins and much more
|
||||
//
|
||||
// See https://github.com/twbs/rfs
|
||||
// Licensed under MIT (https://github.com/twbs/rfs/blob/main/LICENSE)
|
||||
|
||||
// Configuration
|
||||
|
||||
// Base font size
|
||||
$rfs-base-font-size: 1.25rem !default;
|
||||
$rfs-font-size-unit: rem !default;
|
||||
// Base value
|
||||
$rfs-base-value: 1.25rem !default;
|
||||
$rfs-unit: rem !default;
|
||||
|
||||
// Breakpoint at where font-size starts decreasing if screen width is smaller
|
||||
@if $rfs-unit != rem and $rfs-unit != px {
|
||||
@error "`#{$rfs-unit}` is not a valid unit for $rfs-unit. Use `px` or `rem`.";
|
||||
}
|
||||
|
||||
// Breakpoint at where values start decreasing if screen width is smaller
|
||||
$rfs-breakpoint: 1200px !default;
|
||||
$rfs-breakpoint-unit: px !default;
|
||||
|
||||
// Resize font-size based on screen height and width
|
||||
@if $rfs-breakpoint-unit != px and $rfs-breakpoint-unit != em and $rfs-breakpoint-unit != rem {
|
||||
@error "`#{$rfs-breakpoint-unit}` is not a valid unit for $rfs-breakpoint-unit. Use `px`, `em` or `rem`.";
|
||||
}
|
||||
|
||||
// Resize values based on screen height and width
|
||||
$rfs-two-dimensional: false !default;
|
||||
|
||||
// Factor of decrease
|
||||
$rfs-factor: 10 !default;
|
||||
|
||||
@if type-of($rfs-factor) != "number" or $rfs-factor <= 1 {
|
||||
@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.";
|
||||
}
|
||||
|
||||
// Mode. Possibilities: "min-media-query", "max-media-query"
|
||||
$rfs-mode: min-media-query !default;
|
||||
|
||||
// Generate enable or disable classes. Possibilities: false, "enable" or "disable"
|
||||
$rfs-class: false !default;
|
||||
|
||||
|
@ -35,170 +46,309 @@ $rfs-rem-value: 16 !default;
|
|||
// Safari iframe resize bug: https://github.com/twbs/rfs/issues/14
|
||||
$rfs-safari-iframe-resize-bug-fix: false !default;
|
||||
|
||||
// Disable RFS by setting $enable-responsive-font-sizes to false
|
||||
$enable-responsive-font-sizes: true !default;
|
||||
// Disable RFS by setting $enable-rfs to false
|
||||
$enable-rfs: true !default;
|
||||
|
||||
// Cache $rfs-base-font-size unit
|
||||
$rfs-base-font-size-unit: unit($rfs-base-font-size);
|
||||
// Cache $rfs-base-value unit
|
||||
$rfs-base-value-unit: unit($rfs-base-value);
|
||||
|
||||
// Remove px-unit from $rfs-base-font-size for calculations
|
||||
@if $rfs-base-font-size-unit == "px" {
|
||||
$rfs-base-font-size: $rfs-base-font-size / ($rfs-base-font-size * 0 + 1);
|
||||
@function divide($dividend, $divisor, $precision: 10) {
|
||||
$sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
|
||||
$dividend: abs($dividend);
|
||||
$divisor: abs($divisor);
|
||||
@if $dividend == 0 {
|
||||
@return 0;
|
||||
}
|
||||
@if $divisor == 0 {
|
||||
@error "Cannot divide by 0";
|
||||
}
|
||||
$remainder: $dividend;
|
||||
$result: 0;
|
||||
$factor: 10;
|
||||
@while ($remainder > 0 and $precision >= 0) {
|
||||
$quotient: 0;
|
||||
@while ($remainder >= $divisor) {
|
||||
$remainder: $remainder - $divisor;
|
||||
$quotient: $quotient + 1;
|
||||
}
|
||||
$result: $result * 10 + $quotient;
|
||||
$factor: $factor * .1;
|
||||
$remainder: $remainder * 10;
|
||||
$precision: $precision - 1;
|
||||
@if ($precision < 0 and $remainder >= $divisor * 5) {
|
||||
$result: $result + 1;
|
||||
}
|
||||
}
|
||||
$result: $result * $factor * $sign;
|
||||
$dividend-unit: unit($dividend);
|
||||
$divisor-unit: unit($divisor);
|
||||
$unit-map: (
|
||||
"px": 1px,
|
||||
"rem": 1rem,
|
||||
"em": 1em,
|
||||
"%": 1%
|
||||
);
|
||||
@if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
|
||||
$result: $result * map-get($unit-map, $dividend-unit);
|
||||
}
|
||||
@return $result;
|
||||
}
|
||||
@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);
|
||||
|
||||
// Remove px-unit from $rfs-base-value for calculations
|
||||
@if $rfs-base-value-unit == px {
|
||||
$rfs-base-value: divide($rfs-base-value, $rfs-base-value * 0 + 1);
|
||||
}
|
||||
@else if $rfs-base-value-unit == rem {
|
||||
$rfs-base-value: divide($rfs-base-value, divide($rfs-base-value * 0 + 1, $rfs-rem-value));
|
||||
}
|
||||
|
||||
// Cache $rfs-breakpoint unit to prevent multiple calls
|
||||
$rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
|
||||
|
||||
// Remove unit from $rfs-breakpoint for calculations
|
||||
@if $rfs-breakpoint-unit-cache == "px" {
|
||||
$rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1);
|
||||
@if $rfs-breakpoint-unit-cache == px {
|
||||
$rfs-breakpoint: divide($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);
|
||||
@else if $rfs-breakpoint-unit-cache == rem or $rfs-breakpoint-unit-cache == "em" {
|
||||
$rfs-breakpoint: divide($rfs-breakpoint, divide($rfs-breakpoint * 0 + 1, $rfs-rem-value));
|
||||
}
|
||||
|
||||
// Responsive font-size mixin
|
||||
@mixin rfs($fs, $important: false) {
|
||||
// Cache $fs unit
|
||||
$fs-unit: if(type-of($fs) == "number", unit($fs), false);
|
||||
// Calculate the media query value
|
||||
$rfs-mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{divide($rfs-breakpoint, $rfs-rem-value)}#{$rfs-breakpoint-unit});
|
||||
$rfs-mq-property-width: if($rfs-mode == max-media-query, max-width, min-width);
|
||||
$rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height);
|
||||
|
||||
// Add !important suffix if needed
|
||||
$rfs-suffix: if($important, " !important", "");
|
||||
// Internal mixin used to determine which media query needs to be used
|
||||
@mixin _rfs-media-query {
|
||||
@if $rfs-two-dimensional {
|
||||
@if $rfs-mode == max-media-query {
|
||||
@media (#{$rfs-mq-property-width}: #{$rfs-mq-value}), (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
@else {
|
||||
@media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) and (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
@else {
|
||||
@media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If $fs isn't a number (like inherit) or $fs has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
|
||||
@if not $fs-unit or $fs-unit != "" and $fs-unit != "px" and $fs-unit != "rem" or $fs == 0 {
|
||||
font-size: #{$fs}#{$rfs-suffix};
|
||||
// Internal mixin that adds disable classes to the selector if needed.
|
||||
@mixin _rfs-rule {
|
||||
@if $rfs-class == disable and $rfs-mode == max-media-query {
|
||||
// Adding an extra class increases specificity, which prevents the media query to override the property
|
||||
&,
|
||||
.disable-rfs &,
|
||||
&.disable-rfs {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
@else if $rfs-class == enable and $rfs-mode == min-media-query {
|
||||
.enable-rfs &,
|
||||
&.enable-rfs {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
@else {
|
||||
// Variables for storing static and fluid rescaling
|
||||
$rfs-static: null;
|
||||
$rfs-fluid: null;
|
||||
@content;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove px-unit from $fs for calculations
|
||||
@if $fs-unit == "px" {
|
||||
$fs: $fs / ($fs * 0 + 1);
|
||||
}
|
||||
@else if $fs-unit == "rem" {
|
||||
$fs: $fs / ($fs * 0 + 1 / $rfs-rem-value);
|
||||
// Internal mixin that adds enable classes to the selector if needed.
|
||||
@mixin _rfs-media-query-rule {
|
||||
|
||||
@if $rfs-class == enable {
|
||||
@if $rfs-mode == min-media-query {
|
||||
@content;
|
||||
}
|
||||
|
||||
// Set default font-size
|
||||
@if $rfs-font-size-unit == rem {
|
||||
$rfs-static: #{$fs / $rfs-rem-value}rem#{$rfs-suffix};
|
||||
@include _rfs-media-query {
|
||||
.enable-rfs &,
|
||||
&.enable-rfs {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
@else if $rfs-font-size-unit == px {
|
||||
$rfs-static: #{$fs}px#{$rfs-suffix};
|
||||
}
|
||||
@else {
|
||||
@if $rfs-class == disable and $rfs-mode == min-media-query {
|
||||
.disable-rfs &,
|
||||
&.disable-rfs {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
@include _rfs-media-query {
|
||||
@content;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Helper function to get the formatted non-responsive value
|
||||
@function rfs-value($values) {
|
||||
// Convert to list
|
||||
$values: if(type-of($values) != list, ($values,), $values);
|
||||
|
||||
$val: '';
|
||||
|
||||
// Loop over each value and calculate value
|
||||
@each $value in $values {
|
||||
@if $value == 0 {
|
||||
$val: $val + ' 0';
|
||||
}
|
||||
@else {
|
||||
@error "`#{$rfs-font-size-unit}` is not a valid unit for $rfs-font-size-unit. Use `px` or `rem`.";
|
||||
// Cache $value unit
|
||||
$unit: if(type-of($value) == "number", unit($value), false);
|
||||
|
||||
@if $unit == px {
|
||||
// Convert to rem if needed
|
||||
$val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $value * 0 + $rfs-rem-value)}rem, $value);
|
||||
}
|
||||
@else if $unit == rem {
|
||||
// Convert to px if needed
|
||||
$val: $val + ' ' + if($rfs-unit == px, #{divide($value, $value * 0 + 1) * $rfs-rem-value}px, $value);
|
||||
}
|
||||
@else {
|
||||
// If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
|
||||
$val: $val + ' ' + $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove first space
|
||||
@return unquote(str-slice($val, 2));
|
||||
}
|
||||
|
||||
// Helper function to get the responsive value calculated by RFS
|
||||
@function rfs-fluid-value($values) {
|
||||
// Convert to list
|
||||
$values: if(type-of($values) != list, ($values,), $values);
|
||||
|
||||
$val: '';
|
||||
|
||||
// Loop over each value and calculate value
|
||||
@each $value in $values {
|
||||
@if $value == 0 {
|
||||
$val: $val + ' 0';
|
||||
}
|
||||
|
||||
// Only add media query if font-size is bigger as the minimum font-size
|
||||
// If $rfs-factor == 1, no rescaling will take place
|
||||
@if $fs > $rfs-base-font-size and $enable-responsive-font-sizes {
|
||||
$min-width: null;
|
||||
$variable-unit: null;
|
||||
@else {
|
||||
// Cache $value unit
|
||||
$unit: if(type-of($value) == "number", unit($value), false);
|
||||
|
||||
// Calculate minimum font-size for given font-size
|
||||
$fs-min: $rfs-base-font-size + ($fs - $rfs-base-font-size) / $rfs-factor;
|
||||
// If $value isn't a number (like inherit) or $value has a unit (not px or rem, like 1.5em) or $ is 0, just print the value
|
||||
@if not $unit or $unit != px and $unit != rem {
|
||||
$val: $val + ' ' + $value;
|
||||
}
|
||||
|
||||
// Calculate difference between given font-size and minimum font-size for given font-size
|
||||
$fs-diff: $fs - $fs-min;
|
||||
@else {
|
||||
// Remove unit from $value for calculations
|
||||
$value: divide($value, $value * 0 + if($unit == px, 1, divide(1, $rfs-rem-value)));
|
||||
|
||||
// Base font-size formatting
|
||||
// No need to check if the unit is valid, because we did that before
|
||||
$min-width: if($rfs-font-size-unit == rem, #{$fs-min / $rfs-rem-value}rem, #{$fs-min}px);
|
||||
// Only add the media query if the value is greater than the minimum value
|
||||
@if abs($value) <= $rfs-base-value or not $enable-rfs {
|
||||
$val: $val + ' ' + if($rfs-unit == rem, #{divide($value, $rfs-rem-value)}rem, #{$value}px);
|
||||
}
|
||||
@else {
|
||||
// Calculate the minimum value
|
||||
$value-min: $rfs-base-value + divide(abs($value) - $rfs-base-value, $rfs-factor);
|
||||
|
||||
// If two-dimensional, use smallest of screen width and height
|
||||
$variable-unit: if($rfs-two-dimensional, vmin, vw);
|
||||
// Calculate difference between $value and the minimum value
|
||||
$value-diff: abs($value) - $value-min;
|
||||
|
||||
// Calculate the variable width between 0 and $rfs-breakpoint
|
||||
$variable-width: #{$fs-diff * 100 / $rfs-breakpoint}#{$variable-unit};
|
||||
// Base value formatting
|
||||
$min-width: if($rfs-unit == rem, #{divide($value-min, $rfs-rem-value)}rem, #{$value-min}px);
|
||||
|
||||
// Set the calculated font-size.
|
||||
$rfs-fluid: calc(#{$min-width} + #{$variable-width}) #{$rfs-suffix};
|
||||
// Use negative value if needed
|
||||
$min-width: if($value < 0, -$min-width, $min-width);
|
||||
|
||||
// Use `vmin` if two-dimensional is enabled
|
||||
$variable-unit: if($rfs-two-dimensional, vmin, vw);
|
||||
|
||||
// Calculate the variable width between 0 and $rfs-breakpoint
|
||||
$variable-width: #{divide($value-diff * 100, $rfs-breakpoint)}#{$variable-unit};
|
||||
|
||||
// Return the calculated value
|
||||
$val: $val + ' calc(' + $min-width + if($value < 0, ' - ', ' + ') + $variable-width + ')';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Rendering
|
||||
@if $rfs-fluid == null {
|
||||
// Only render static font-size if no fluid font-size is available
|
||||
font-size: $rfs-static;
|
||||
// Remove first space
|
||||
@return unquote(str-slice($val, 2));
|
||||
}
|
||||
|
||||
// RFS mixin
|
||||
@mixin rfs($values, $property: font-size) {
|
||||
@if $values != null {
|
||||
$val: rfs-value($values);
|
||||
$fluidVal: rfs-fluid-value($values);
|
||||
|
||||
// Do not print the media query if responsive & non-responsive values are the same
|
||||
@if $val == $fluidVal {
|
||||
#{$property}: $val;
|
||||
}
|
||||
@else {
|
||||
$mq-value: null;
|
||||
@include _rfs-rule {
|
||||
#{$property}: if($rfs-mode == max-media-query, $val, $fluidVal);
|
||||
|
||||
// RFS breakpoint formatting
|
||||
@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`.";
|
||||
// Include safari iframe resize fix if needed
|
||||
min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null);
|
||||
}
|
||||
|
||||
@if $rfs-class == "disable" {
|
||||
// Adding an extra class increases specificity,
|
||||
// which prevents the media query to override the font size
|
||||
&,
|
||||
.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 {
|
||||
// stylelint-disable-next-line length-zero-no-unit
|
||||
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 {
|
||||
// stylelint-disable-next-line length-zero-no-unit
|
||||
min-width: 0vw;
|
||||
}
|
||||
}
|
||||
@include _rfs-media-query-rule {
|
||||
#{$property}: if($rfs-mode == max-media-query, $fluidVal, $val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The font-size & responsive-font-size mixin uses RFS to rescale font sizes
|
||||
@mixin font-size($fs, $important: false) {
|
||||
@include rfs($fs, $important);
|
||||
// Shorthand helper mixins
|
||||
@mixin font-size($value) {
|
||||
@include rfs($value);
|
||||
}
|
||||
|
||||
@mixin responsive-font-size($fs, $important: false) {
|
||||
@include rfs($fs, $important);
|
||||
@mixin padding($value) {
|
||||
@include rfs($value, padding);
|
||||
}
|
||||
|
||||
@mixin padding-top($value) {
|
||||
@include rfs($value, padding-top);
|
||||
}
|
||||
|
||||
@mixin padding-right($value) {
|
||||
@include rfs($value, padding-right);
|
||||
}
|
||||
|
||||
@mixin padding-bottom($value) {
|
||||
@include rfs($value, padding-bottom);
|
||||
}
|
||||
|
||||
@mixin padding-left($value) {
|
||||
@include rfs($value, padding-left);
|
||||
}
|
||||
|
||||
@mixin margin($value) {
|
||||
@include rfs($value, margin);
|
||||
}
|
||||
|
||||
@mixin margin-top($value) {
|
||||
@include rfs($value, margin-top);
|
||||
}
|
||||
|
||||
@mixin margin-right($value) {
|
||||
@include rfs($value, margin-right);
|
||||
}
|
||||
|
||||
@mixin margin-bottom($value) {
|
||||
@include rfs($value, margin-bottom);
|
||||
}
|
||||
|
||||
@mixin margin-left($value) {
|
||||
@include rfs($value, margin-left);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue