Back to home page

EIC code displayed by LXR

 
 

    


Warning, /iDDS/monitor/data/scss/bootstrap/vendor/_rfs.scss is written in an unsupported language. File is not indexed.

0001 // stylelint-disable property-blacklist, scss/dollar-variable-default
0002 
0003 // SCSS RFS mixin
0004 //
0005 // Automated responsive values for font sizes, paddings, margins and much more
0006 //
0007 // Licensed under MIT (https://github.com/twbs/rfs/blob/master/LICENSE)
0008 
0009 // Configuration
0010 
0011 // Base value
0012 $rfs-base-value: 1.25rem !default;
0013 $rfs-unit: rem !default;
0014 
0015 @if $rfs-unit != rem and $rfs-unit != px {
0016   @error "`#{$rfs-unit}` is not a valid unit for $rfs-unit. Use `px` or `rem`.";
0017 }
0018 
0019 // Breakpoint at where values start decreasing if screen width is smaller
0020 $rfs-breakpoint: 1200px !default;
0021 $rfs-breakpoint-unit: px !default;
0022 
0023 @if $rfs-breakpoint-unit != px and $rfs-breakpoint-unit != em and $rfs-breakpoint-unit != rem {
0024   @error "`#{$rfs-breakpoint-unit}` is not a valid unit for $rfs-breakpoint-unit. Use `px`, `em` or `rem`.";
0025 }
0026 
0027 // Resize values based on screen height and width
0028 $rfs-two-dimensional: false !default;
0029 
0030 // Factor of decrease
0031 $rfs-factor: 10 !default;
0032 
0033 @if type-of($rfs-factor) != number or $rfs-factor <= 1 {
0034   @error "`#{$rfs-factor}` is not a valid  $rfs-factor, it must be greater than 1.";
0035 }
0036 
0037 // Mode. Possibilities: "min-media-query", "max-media-query"
0038 $rfs-mode: min-media-query !default;
0039 
0040 // Generate enable or disable classes. Possibilities: false, "enable" or "disable"
0041 $rfs-class: false !default;
0042 
0043 // 1 rem = $rfs-rem-value px
0044 $rfs-rem-value: 16 !default;
0045 
0046 // Safari iframe resize bug: https://github.com/twbs/rfs/issues/14
0047 $rfs-safari-iframe-resize-bug-fix: false !default;
0048 
0049 // Disable RFS by setting $enable-rfs to false
0050 $enable-rfs: true !default;
0051 
0052 // Cache $rfs-base-value unit
0053 $rfs-base-value-unit: unit($rfs-base-value);
0054 
0055 // Remove px-unit from $rfs-base-value for calculations
0056 @if $rfs-base-value-unit == px {
0057   $rfs-base-value: $rfs-base-value / ($rfs-base-value * 0 + 1);
0058 }
0059 @else if $rfs-base-value-unit == rem {
0060   $rfs-base-value: $rfs-base-value / ($rfs-base-value * 0 + 1 / $rfs-rem-value);
0061 }
0062 
0063 // Cache $rfs-breakpoint unit to prevent multiple calls
0064 $rfs-breakpoint-unit-cache: unit($rfs-breakpoint);
0065 
0066 // Remove unit from $rfs-breakpoint for calculations
0067 @if $rfs-breakpoint-unit-cache == px {
0068   $rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1);
0069 }
0070 @else if $rfs-breakpoint-unit-cache == rem or $rfs-breakpoint-unit-cache == "em" {
0071   $rfs-breakpoint: $rfs-breakpoint / ($rfs-breakpoint * 0 + 1 / $rfs-rem-value);
0072 }
0073 
0074 // Calculate the media query value
0075 $rfs-mq-value: if($rfs-breakpoint-unit == px, #{$rfs-breakpoint}px, #{$rfs-breakpoint / $rfs-rem-value}#{$rfs-breakpoint-unit});
0076 $rfs-mq-property-width: if($rfs-mode == max-media-query, max-width, min-width);
0077 $rfs-mq-property-height: if($rfs-mode == max-media-query, max-height, min-height);
0078 
0079 // Internal mixin used to determine which media query needs to be used
0080 @mixin _rfs-media-query {
0081   @if $rfs-two-dimensional {
0082     @if $rfs-mode == max-media-query {
0083       @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}), (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
0084         @content;
0085       }
0086     }
0087     @else {
0088       @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) and (#{$rfs-mq-property-height}: #{$rfs-mq-value}) {
0089         @content;
0090       }
0091     }
0092   }
0093   @else {
0094     @media (#{$rfs-mq-property-width}: #{$rfs-mq-value}) {
0095       @content;
0096     }
0097   }
0098 }
0099 
0100 // Internal mixin that adds disable classes to the selector if needed.
0101 @mixin _rfs-rule {
0102   @if $rfs-class == disable and $rfs-mode == max-media-query {
0103     // Adding an extra class increases specificity, which prevents the media query to override the property
0104     &,
0105     .disable-rfs &,
0106     &.disable-rfs {
0107       @content;
0108     }
0109   }
0110   @else if $rfs-class == enable and $rfs-mode == min-media-query {
0111     .enable-rfs &,
0112     &.enable-rfs {
0113       @content;
0114     }
0115   }
0116   @else {
0117     @content;
0118   }
0119 }
0120 
0121 // Internal mixin that adds enable classes to the selector if needed.
0122 @mixin _rfs-media-query-rule {
0123 
0124   @if $rfs-class == enable {
0125     @if $rfs-mode == min-media-query {
0126       @content;
0127     }
0128 
0129     @include _rfs-media-query {
0130       .enable-rfs &,
0131       &.enable-rfs {
0132         @content;
0133       }
0134     }
0135   }
0136   @else {
0137     @if $rfs-class == disable and $rfs-mode == min-media-query {
0138       .disable-rfs &,
0139       &.disable-rfs {
0140         @content;
0141       }
0142     }
0143     @include _rfs-media-query {
0144       @content;
0145     }
0146   }
0147 }
0148 
0149 // Helper function to get the formatted non-responsive value
0150 @function rfs-value($values) {
0151   // Convert to list
0152   $values: if(type-of($values) != list, ($values,), $values);
0153 
0154   $val: '';
0155 
0156   // Loop over each value and calculate value
0157   @each $value in $values {
0158     @if $value == 0 {
0159       $val: $val + ' 0';
0160     }
0161     @else {
0162       // Cache $value unit
0163       $unit: if(type-of($value) == "number", unit($value), false);
0164 
0165       @if $unit == px {
0166         // Convert to rem if needed
0167         $val: $val + ' ' + if($rfs-unit == rem, #{$value / ($value * 0 + $rfs-rem-value)}rem, $value);
0168       }
0169       @else if $unit == rem {
0170         // Convert to px if needed
0171         $val: $val + ' ' + if($rfs-unit == px, #{$value / ($value * 0 + 1) * $rfs-rem-value}px, $value);
0172       }
0173       @else {
0174         // 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
0175         $val: $val + ' ' + $value;
0176       }
0177     }
0178   }
0179 
0180   // Remove first space
0181   @return unquote(str-slice($val, 2));
0182 }
0183 
0184 // Helper function to get the responsive value calculated by RFS
0185 @function rfs-fluid-value($values) {
0186   // Convert to list
0187   $values: if(type-of($values) != list, ($values,), $values);
0188 
0189   $val: '';
0190 
0191   // Loop over each value and calculate value
0192   @each $value in $values {
0193     @if $value == 0 {
0194       $val: $val + ' 0';
0195     }
0196 
0197     @else {
0198       // Cache $value unit
0199       $unit: if(type-of($value) == "number", unit($value), false);
0200 
0201       // 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
0202       @if not $unit or $unit != px and $unit != rem {
0203         $val: $val + ' ' + $value;
0204       }
0205 
0206       @else {
0207         // Remove unit from $value for calculations
0208         $value: $value / ($value * 0 + if($unit == px, 1, 1 / $rfs-rem-value));
0209 
0210         // Only add the media query if the value is greater than the minimum value
0211         @if abs($value) <= $rfs-base-value or not $enable-rfs {
0212           $val: $val + ' ' +  if($rfs-unit == rem, #{$value / $rfs-rem-value}rem, #{$value}px);
0213         }
0214         @else {
0215           // Calculate the minimum value
0216           $value-min: $rfs-base-value + (abs($value) - $rfs-base-value) / $rfs-factor;
0217 
0218           // Calculate difference between $value and the minimum value
0219           $value-diff: abs($value) - $value-min;
0220 
0221           // Base value formatting
0222           $min-width: if($rfs-unit == rem, #{$value-min / $rfs-rem-value}rem, #{$value-min}px);
0223 
0224           // Use negative value if needed
0225           $min-width: if($value < 0, -$min-width, $min-width);
0226 
0227           // Use `vmin` if two-dimensional is enabled
0228           $variable-unit: if($rfs-two-dimensional, vmin, vw);
0229 
0230           // Calculate the variable width between 0 and $rfs-breakpoint
0231           $variable-width: #{$value-diff * 100 / $rfs-breakpoint}#{$variable-unit};
0232 
0233           // Return the calculated value
0234           $val: $val + ' calc(' + $min-width + if($value < 0, ' - ', ' + ') + $variable-width + ')';
0235         }
0236       }
0237     }
0238   }
0239 
0240   // Remove first space
0241   @return unquote(str-slice($val, 2));
0242 }
0243 
0244 // RFS mixin
0245 @mixin rfs($values, $property: font-size) {
0246   @if $values != null {
0247     $val: rfs-value($values);
0248     $fluidVal: rfs-fluid-value($values);
0249 
0250     // Do not print the media query if responsive & non-responsive values are the same
0251     @if $val == $fluidVal {
0252       #{$property}: $val;
0253     }
0254     @else {
0255       @include _rfs-rule {
0256         #{$property}: if($rfs-mode == max-media-query, $val, $fluidVal);
0257 
0258         // Include safari iframe resize fix if needed
0259         min-width: if($rfs-safari-iframe-resize-bug-fix, (0 * 1vw), null);
0260       }
0261 
0262       @include _rfs-media-query-rule {
0263         #{$property}: if($rfs-mode == max-media-query, $fluidVal, $val);
0264       }
0265     }
0266   }
0267 }
0268 
0269 // Shorthand helper mixins
0270 @mixin font-size($value) {
0271   @include rfs($value);
0272 }
0273 
0274 @mixin padding($value) {
0275   @include rfs($value, padding);
0276 }
0277 
0278 @mixin padding-top($value) {
0279   @include rfs($value, padding-top);
0280 }
0281 
0282 @mixin padding-right($value) {
0283   @include rfs($value, padding-right);
0284 }
0285 
0286 @mixin padding-bottom($value) {
0287   @include rfs($value, padding-bottom);
0288 }
0289 
0290 @mixin padding-left($value) {
0291   @include rfs($value, padding-left);
0292 }
0293 
0294 @mixin margin($value) {
0295   @include rfs($value, margin);
0296 }
0297 
0298 @mixin margin-top($value) {
0299   @include rfs($value, margin-top);
0300 }
0301 
0302 @mixin margin-right($value) {
0303   @include rfs($value, margin-right);
0304 }
0305 
0306 @mixin margin-bottom($value) {
0307   @include rfs($value, margin-bottom);
0308 }
0309 
0310 @mixin margin-left($value) {
0311   @include rfs($value, margin-left);
0312 }