2017-02-08 11:43:28 -05:00
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
// Tools / Mixins
|
|
|
|
|
|
// ==========================================================================
|
|
|
|
|
|
|
|
|
|
|
|
// Set the color of the highlight that appears over a link while it's being tapped.
|
|
|
|
|
|
//
|
|
|
|
|
|
// By default, the highlight is suppressed.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @param {Color} $value [rgba(0, 0, 0, 0)] - The value of the highlight.
|
|
|
|
|
|
// @output `-webkit-tap-highlight-color`
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin tap-highlight-color($value: rgba(0, 0, 0, 0)) {
|
2016-12-18 15:45:44 -05:00
|
|
|
|
-webkit-tap-highlight-color: $value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Set whether or not touch devices use momentum-based scrolling for the given element.
|
|
|
|
|
|
//
|
|
|
|
|
|
// By default, applies momentum-based scrolling for the current element.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @param {String} $value [rgba(0, 0, 0, 0)] - The type of scrolling.
|
|
|
|
|
|
// @output `-webkit-overflow-scrolling`
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin overflow-scrolling($value: touch) {
|
2016-12-18 15:45:44 -05:00
|
|
|
|
-webkit-overflow-scrolling: $value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Micro clearfix rules for containing floats.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @link http://www.cssmojo.com/the-very-latest-clearfix-reloaded/
|
|
|
|
|
|
// @param {List} $supports The type of clearfix to generate.
|
|
|
|
|
|
// @output Injects `:::after` pseudo-element.
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin u-clearfix($supports...) {
|
2016-12-18 15:45:44 -05:00
|
|
|
|
&::after {
|
|
|
|
|
|
display: if(list-contains($supports, table), table, block);
|
2017-04-27 16:00:45 -04:00
|
|
|
|
clear: both;
|
|
|
|
|
|
content: if(list-contains($supports, opera), " ", "");
|
2016-12-18 15:45:44 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Generate a font-size and baseline-compatible line-height.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @link https://github.com/inuitcss/inuitcss/c14029c/tools/_tools.font-size.scss
|
|
|
|
|
|
// @param {Number} $font-size - The size of the font.
|
|
|
|
|
|
// @param {Number} $line-height [auto] - The line box height.
|
|
|
|
|
|
// @param {Boolean} $important [false] - Whether the font-size is important.
|
|
|
|
|
|
// @output `font-size`, `line-height`
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin font-size($font-size, $line-height: auto, $important: false) {
|
2017-04-27 16:00:45 -04:00
|
|
|
|
$important: important($important);
|
2017-06-09 10:55:20 -04:00
|
|
|
|
font-size: rem($font-size) $important;
|
2016-12-18 15:45:44 -05:00
|
|
|
|
|
2017-04-27 16:00:45 -04:00
|
|
|
|
@if ($line-height == "auto") {
|
2023-04-05 14:40:28 +02:00
|
|
|
|
line-height: ceil(math.div($font-size, $line-height)) * math.div($line-height, $font-size) $important;
|
2016-12-18 15:45:44 -05:00
|
|
|
|
}
|
|
|
|
|
|
@else {
|
2017-04-27 16:00:45 -04:00
|
|
|
|
@if (type-of($line-height) == number or $line-height == "inherit" or $line-height == "normal") {
|
2016-12-18 15:45:44 -05:00
|
|
|
|
line-height: $line-height $important;
|
|
|
|
|
|
}
|
2023-01-31 13:57:51 -05:00
|
|
|
|
@else if ($line-height != "none" and $line-height != false) {
|
2022-05-02 10:30:35 +02:00
|
|
|
|
@error "D’oh! `#{$line-height}` is not a valid value for `$line-height`.";
|
2016-12-18 15:45:44 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Vertically-center the direct descendants of the current element.
|
|
|
|
|
|
//
|
|
|
|
|
|
// Centering is achieved by displaying children as inline-blocks. Any whitespace
|
|
|
|
|
|
// between elements is nullified by redefining the font size of the container
|
|
|
|
|
|
// and its children.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @output `font-size`, `display`, `vertical-align`
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin o-vertical-center {
|
2016-08-22 10:30:46 -04:00
|
|
|
|
font-size: 0;
|
2015-07-02 15:12:13 -04:00
|
|
|
|
|
2016-12-18 15:45:44 -05:00
|
|
|
|
&::before {
|
2017-04-27 16:00:45 -04:00
|
|
|
|
display: inline-block;
|
|
|
|
|
|
height: 100%;
|
|
|
|
|
|
content: "";
|
2016-08-22 10:30:46 -04:00
|
|
|
|
vertical-align: middle;
|
|
|
|
|
|
}
|
2015-07-02 15:12:13 -04:00
|
|
|
|
|
2016-08-22 10:30:46 -04:00
|
|
|
|
> * {
|
2017-04-27 16:00:45 -04:00
|
|
|
|
display: inline-block;
|
2016-08-22 10:30:46 -04:00
|
|
|
|
vertical-align: middle;
|
2017-04-27 16:00:45 -04:00
|
|
|
|
font-size: 1rem;
|
2016-08-22 10:30:46 -04:00
|
|
|
|
}
|
2015-07-02 15:12:13 -04:00
|
|
|
|
}
|
2015-09-30 14:39:40 -04:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Generate `:hover` and `:focus` styles in one go.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @link https://github.com/inuitcss/inuitcss/blob/master/tools/_tools.mixins.scss
|
|
|
|
|
|
// @content Wrapped in `:focus` and `:hover` pseudo-classes.
|
|
|
|
|
|
// @output Wraps the given content in `:focus` and `:hover` pseudo-classes.
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin u-hocus {
|
2016-12-18 15:45:44 -05:00
|
|
|
|
&:focus,
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
@content;
|
2016-08-22 10:30:46 -04:00
|
|
|
|
}
|
2015-09-30 14:39:40 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Generate `:active` and `:focus` styles in one go.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @see {Mixin} u-hocus
|
|
|
|
|
|
// @content Wrapped in `:focus` and `:active` pseudo-classes.
|
|
|
|
|
|
// @output Wraps the given content in `:focus` and `:hover` pseudo-classes.
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin u-actus {
|
2016-12-18 15:45:44 -05:00
|
|
|
|
&:focus,
|
|
|
|
|
|
&:active {
|
|
|
|
|
|
@content;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Prevent text from wrapping onto multiple lines for the current element.
|
|
|
|
|
|
//
|
|
|
|
|
|
// An ellipsis is appended to the end of the line.
|
|
|
|
|
|
//
|
|
|
|
|
|
// 1. Ensure that the node has a maximum width after which truncation can occur.
|
|
|
|
|
|
// 2. Fix for IE 8/9 if `word-wrap: break-word` is in effect on ancestor nodes.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @param {Number} $width [100%] - The maximum width of element.
|
|
|
|
|
|
// @output `max-width`, `word-wrap`, `white-space`, `overflow`, `text-overflow`
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin u-truncate($width: 100%) {
|
2017-04-27 16:00:45 -04:00
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
word-wrap: normal; // [2]
|
2016-12-18 15:45:44 -05:00
|
|
|
|
@if $width {
|
|
|
|
|
|
max-width: $width; // [1]
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Applies accessible hiding to the current element.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @param {Boolean} $important [true] - Whether the visibility is important.
|
|
|
|
|
|
// @output Properties for removing the element from the document flow.
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin u-accessibly-hidden($important: true) {
|
2017-06-09 10:55:20 -04:00
|
|
|
|
$important: important($important);
|
2016-12-18 15:45:44 -05:00
|
|
|
|
position: absolute $important;
|
|
|
|
|
|
overflow: hidden;
|
2017-04-27 16:00:45 -04:00
|
|
|
|
clip: rect(0 0 0 0);
|
|
|
|
|
|
margin: 0;
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
width: 1px;
|
|
|
|
|
|
height: 1px;
|
|
|
|
|
|
border: 0;
|
2016-12-18 15:45:44 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Allows an accessibly hidden element to be focusable via keyboard navigation.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @content For styling the now visible element.
|
|
|
|
|
|
// @output Injects `:focus`, `:active` pseudo-classes.
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin u-accessibly-focusable {
|
2016-12-18 15:45:44 -05:00
|
|
|
|
@include u-actus {
|
2017-04-27 16:00:45 -04:00
|
|
|
|
clip: auto;
|
|
|
|
|
|
width: auto;
|
2016-12-18 15:45:44 -05:00
|
|
|
|
height: auto;
|
|
|
|
|
|
|
|
|
|
|
|
@content;
|
|
|
|
|
|
}
|
2015-09-30 14:39:40 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Hide the current element from all.
|
|
|
|
|
|
//
|
|
|
|
|
|
// The element will be hidden from screen readers and removed from the document flow.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @link http://juicystudio.com/article/screen-readers-display-none.php
|
|
|
|
|
|
// @param {Boolean} $important [true] - Whether the visibility is important.
|
|
|
|
|
|
// @output `display`, `visibility`
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
@mixin u-hidden($important: true) {
|
2017-06-09 10:55:20 -04:00
|
|
|
|
$important: important($important);
|
2017-04-27 16:00:45 -04:00
|
|
|
|
display: none $important;
|
|
|
|
|
|
visibility: hidden $important;
|
2016-12-18 15:45:44 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
2017-02-08 11:43:28 -05:00
|
|
|
|
// Show the current element for all.
|
|
|
|
|
|
//
|
|
|
|
|
|
// The element will be accessible from screen readers and visible in the document flow.
|
|
|
|
|
|
//
|
|
|
|
|
|
// @param {String} $display [block] - The rendering box used for the element.
|
|
|
|
|
|
// @param {Boolean} $important [true] - Whether the visibility is important.
|
|
|
|
|
|
// @output `display`, `visibility`
|
2022-05-12 16:15:44 +02:00
|
|
|
|
|
2017-04-27 16:00:45 -04:00
|
|
|
|
@mixin u-shown($display: block, $important: true) {
|
2017-06-09 10:55:20 -04:00
|
|
|
|
$important: important($important);
|
2017-04-27 16:00:45 -04:00
|
|
|
|
display: $display $important;
|
|
|
|
|
|
visibility: visible $important;
|
2015-09-30 14:39:40 -04:00
|
|
|
|
}
|
2023-08-14 10:40:24 +02:00
|
|
|
|
|
|
|
|
|
|
// Aspect-ratio polyfill
|
|
|
|
|
|
//
|
2023-09-05 09:34:24 +02:00
|
|
|
|
// @param {Number} $ratio [19/6] - The ratio of the element.
|
|
|
|
|
|
// @param {Number} $width [100%] - The fallback width of element.
|
|
|
|
|
|
// @param {Boolean} $children [false] - Whether the element contains children for the fallback properties.
|
2023-08-14 10:40:24 +02:00
|
|
|
|
// @output Properties for maintaining aspect-ratio
|
|
|
|
|
|
|
|
|
|
|
|
@mixin aspect-ratio($ratio: math.div(16, 9), $width: 100%, $children: false) {
|
|
|
|
|
|
|
2023-11-29 11:10:32 +01:00
|
|
|
|
@supports (aspect-ratio: 1) {
|
2023-08-14 10:40:24 +02:00
|
|
|
|
aspect-ratio: $ratio;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-29 11:10:32 +01:00
|
|
|
|
@supports not (aspect-ratio: 1) {
|
2023-08-14 10:40:24 +02:00
|
|
|
|
height: 0;
|
|
|
|
|
|
padding-top: calc(#{$width} * #{math.div(1, $ratio)});
|
|
|
|
|
|
|
|
|
|
|
|
@if ($children == true) {
|
|
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
|
|
|
|
> * {
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
top: 0;
|
|
|
|
|
|
left: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|