added bourbon

This commit is contained in:
Atlas Cove 2022-03-29 12:33:15 +01:00
parent 995dbd9536
commit b081b17572
46 changed files with 2182 additions and 0 deletions

54
sass/bourbon/_bourbon.scss vendored Normal file
View File

@ -0,0 +1,54 @@
// Bourbon 7.2.0
// https://www.bourbon.io/
// Copyright 2011-2020 thoughtbot, inc.
// MIT License
@import "bourbon/helpers/buttons-list";
@import "bourbon/helpers/scales";
@import "bourbon/helpers/text-inputs-list";
@import "bourbon/settings/settings";
@import "bourbon/validators/contains";
@import "bourbon/validators/contains-falsy";
@import "bourbon/validators/is-color";
@import "bourbon/validators/is-length";
@import "bourbon/validators/is-number";
@import "bourbon/validators/is-size";
@import "bourbon/utilities/assign-inputs";
@import "bourbon/utilities/compact-shorthand";
@import "bourbon/utilities/directional-property";
@import "bourbon/utilities/fetch-bourbon-setting";
@import "bourbon/utilities/font-source-declaration";
@import "bourbon/utilities/gamma";
@import "bourbon/utilities/lightness";
@import "bourbon/utilities/contrast-ratio";
@import "bourbon/utilities/unpack-shorthand";
@import "bourbon/library/border-color";
@import "bourbon/library/border-radius";
@import "bourbon/library/border-style";
@import "bourbon/library/border-width";
@import "bourbon/library/buttons";
@import "bourbon/library/clearfix";
@import "bourbon/library/contrast-switch";
@import "bourbon/library/ellipsis";
@import "bourbon/library/font-face";
@import "bourbon/library/font-stacks";
@import "bourbon/library/hide-text";
@import "bourbon/library/hide-visually";
@import "bourbon/library/margin";
@import "bourbon/library/modular-scale";
@import "bourbon/library/overflow-wrap";
@import "bourbon/library/padding";
@import "bourbon/library/position";
@import "bourbon/library/prefixer";
@import "bourbon/library/shade";
@import "bourbon/library/size";
@import "bourbon/library/strip-unit";
@import "bourbon/library/text-inputs";
@import "bourbon/library/timing-functions";
@import "bourbon/library/tint";
@import "bourbon/library/triangle";
@import "bourbon/library/value-prefixer";

View File

@ -0,0 +1,14 @@
@charset "UTF-8";
/// A list of all HTML button elements.
///
/// @type list
///
/// @access private
$_buttons-list: (
"button",
"[type='button']",
"[type='reset']",
"[type='submit']",
);

View File

@ -0,0 +1,27 @@
@charset "UTF-8";
////
/// Pre-defined scales for use with the `modular-scale` function.
///
/// @type number (unitless)
///
/// @see {function} modular-scale
////
$minor-second: 1.067;
$major-second: 1.125;
$minor-third: 1.2;
$major-third: 1.25;
$perfect-fourth: 1.333;
$augmented-fourth: 1.414;
$perfect-fifth: 1.5;
$minor-sixth: 1.6;
$golden: 1.618;
$major-sixth: 1.667;
$minor-seventh: 1.778;
$major-seventh: 1.875;
$octave: 2;
$major-tenth: 2.5;
$major-eleventh: 2.667;
$major-twelfth: 3;
$double-octave: 4;

View File

@ -0,0 +1,26 @@
@charset "UTF-8";
/// A list of all _text-based_ HTML inputs.
///
/// @type list
///
/// @access private
$_text-inputs-list: (
"[type='color']",
"[type='date']",
"[type='datetime']",
"[type='datetime-local']",
"[type='email']",
"[type='month']",
"[type='number']",
"[type='password']",
"[type='search']",
"[type='tel']",
"[type='text']",
"[type='time']",
"[type='url']",
"[type='week']",
"input:not([type])",
"textarea",
);

View File

@ -0,0 +1,26 @@
@charset "UTF-8";
/// Provides a concise, one-line method for setting `border-color` on specific
/// edges of a box. Use a `null` value to skip edges of the box with standard
/// CSS shorthand.
///
/// @argument {list} $values
/// List of colors; accepts CSS shorthand.
///
/// @example scss
/// .element {
/// @include border-color(#a60b55 #76cd9c null #e8ae1a);
/// }
///
/// // CSS Output
/// .element {
/// border-left-color: #e8ae1a;
/// border-right-color: #76cd9c;
/// border-top-color: #a60b55;
/// }
///
/// @require {mixin} _directional-property
@mixin border-color($values) {
@include _directional-property(border, color, $values);
}

View File

@ -0,0 +1,85 @@
@charset "UTF-8";
/// Provides a concise, one-line method for setting `border-radius` on both the
/// top-left and top-right of a box.
///
/// @argument {number (with unit)} $radii
///
/// @example scss
/// .element {
/// @include border-top-radius(4px);
/// }
///
/// // CSS Output
/// .element {
/// border-top-left-radius: 4px;
/// border-top-right-radius: 4px;
/// }
@mixin border-top-radius($radii) {
border-top-left-radius: $radii;
border-top-right-radius: $radii;
}
/// Provides a concise, one-line method for setting `border-radius` on both the
/// top-right and bottom-right of a box.
///
/// @argument {number (with unit)} $radii
///
/// @example scss
/// .element {
/// @include border-right-radius(3px);
/// }
///
/// // CSS Output
/// .element {
/// border-bottom-right-radius: 3px;
/// border-top-right-radius: 3px;
/// }
@mixin border-right-radius($radii) {
border-bottom-right-radius: $radii;
border-top-right-radius: $radii;
}
/// Provides a concise, one-line method for setting `border-radius` on both the
/// bottom-left and bottom-right of a box.
///
/// @argument {number (with unit)} $radii
///
/// @example scss
/// .element {
/// @include border-bottom-radius(2px);
/// }
///
/// // CSS Output
/// .element {
/// border-bottom-left-radius: 2px;
/// border-bottom-right-radius: 2px;
/// }
@mixin border-bottom-radius($radii) {
border-bottom-left-radius: $radii;
border-bottom-right-radius: $radii;
}
/// Provides a concise, one-line method for setting `border-radius` on both the
/// top-left and bottom-left of a box.
///
/// @argument {number (with unit)} $radii
///
/// @example scss
/// .element {
/// @include border-left-radius(1px);
/// }
///
/// // CSS Output
/// .element {
/// border-bottom-left-radius: 1px;
/// border-top-left-radius: 1px;
/// }
@mixin border-left-radius($radii) {
border-bottom-left-radius: $radii;
border-top-left-radius: $radii;
}

View File

@ -0,0 +1,25 @@
@charset "UTF-8";
/// Provides a concise, one-line method for setting `border-style` on specific
/// edges of a box. Use a `null` value to skip edges of the box with standard
/// CSS shorthand.
///
/// @argument {list} $values
/// List of border styles; accepts CSS shorthand.
///
/// @example scss
/// .element {
/// @include border-style(dashed null solid);
/// }
///
/// // CSS Output
/// .element {
/// border-bottom-style: solid;
/// border-top-style: dashed;
/// }
///
/// @require {mixin} _directional-property
@mixin border-style($values) {
@include _directional-property(border, style, $values);
}

View File

@ -0,0 +1,25 @@
@charset "UTF-8";
/// Provides a concise, one-line method for setting `border-width` on specific
/// edges of a box. Use a `null` value to skip edges of the box with standard
/// CSS shorthand.
///
/// @argument {list} $values
/// List of border widths; accepts CSS shorthand.
///
/// @example scss
/// .element {
/// @include border-width(1em null 20px);
/// }
///
/// // CSS Output
/// .element {
/// border-bottom-width: 20px;
/// border-top-width: 1em;
/// }
///
/// @require {mixin} _directional-property
@mixin border-width($values) {
@include _directional-property(border, width, $values);
}

View File

@ -0,0 +1,84 @@
@charset "UTF-8";
////
/// @type list
///
/// @require {function} _assign-inputs
///
/// @require {variable} $_buttons-list
////
/// A list of all HTML button elements. Please note that you must interpolate
/// the variable (`#{}`) to use it as a selector.
///
/// @example scss
/// #{$all-buttons} {
/// background-color: #f00;
/// }
///
/// // CSS Output
/// button,
/// [type='button'],
/// [type='reset'],
/// [type='submit'] {
/// background-color: #f00;
/// }
$all-buttons: _assign-inputs($_buttons-list);
/// A list of all HTML button elements with the `:active` pseudo-class applied.
/// Please note that you must interpolate the variable (`#{}`) to use it as a
/// selector.
///
/// @example scss
/// #{$all-buttons-active} {
/// background-color: #00f;
/// }
///
/// // CSS Output
/// button:active,
/// [type='button']:active,
/// [type='reset']:active,
/// [type='submit']:active {
/// background-color: #00f;
/// }
$all-buttons-active: _assign-inputs($_buttons-list, active);
/// A list of all HTML button elements with the `:focus` pseudo-class applied.
/// Please note that you must interpolate the variable (`#{}`) to use it as a
/// selector.
///
/// @example scss
/// #{$all-buttons-focus} {
/// background-color: #0f0;
/// }
///
/// // CSS Output
/// button:focus,
/// [type='button']:focus,
/// [type='reset']:focus,
/// [type='submit']:focus {
/// background-color: #0f0;
/// }
$all-buttons-focus: _assign-inputs($_buttons-list, focus);
/// A list of all HTML button elements with the `:hover` pseudo-class applied.
/// Please note that you must interpolate the variable (`#{}`) to use it as a
/// selector.
///
/// @example scss
/// #{$all-buttons-hover} {
/// background-color: #0f0;
/// }
///
/// // CSS Output
/// button:hover,
/// [type='button']:hover,
/// [type='reset']:hover,
/// [type='submit']:hover {
/// background-color: #0f0;
/// }
$all-buttons-hover: _assign-inputs($_buttons-list, hover);

View File

@ -0,0 +1,25 @@
@charset "UTF-8";
/// Provides an easy way to include a clearfix for containing floats.
///
/// @link https://goo.gl/yP5hiZ
///
/// @example scss
/// .element {
/// @include clearfix;
/// }
///
/// // CSS Output
/// .element::after {
/// clear: both;
/// content: "";
/// display: block;
/// }
@mixin clearfix {
&::after {
clear: both;
content: "";
display: block;
}
}

View File

@ -0,0 +1,81 @@
@charset "UTF-8";
/// Switches between two colors based on the contrast to another color. Its
/// like a [ternary operator] for color contrast and can be useful for building
/// a button system.
///
/// The calculation of the contrast ratio is based on the [WCAG 2.0
/// specification]. However, we cannot guarantee full compliance, though all of
/// our manual testing passed.
///
/// [ternary operator]: https://goo.gl/ccfLqi
/// [WCAG 2.0 specification]: https://goo.gl/zhQuYA
///
/// @argument {color} $base-color
/// The color to evaluate lightness against.
///
/// @argument {color} $dark-color [#000]
/// The color to be output when `$base-color` is light. Can also be set
/// globally using the `contrast-switch-dark-color` key in the
/// Bourbon settings.
///
/// @argument {color} $light-color [#fff]
/// The color to be output when `$base-color` is dark. Can also be set
/// globally using the `contrast-switch-light-color` key in the
/// Bourbon settings.
///
/// @return {color}
///
/// @example scss
/// .element {
/// color: contrast-switch(#bae6e6);
/// }
///
/// // CSS Output
/// .element {
/// color: #000;
/// }
///
/// @example scss
/// .element {
/// $button-color: #2d72d9;
/// background-color: $button-color;
/// color: contrast-switch($button-color, #222, #eee);
/// }
///
/// // CSS Output
/// .element {
/// background-color: #2d72d9;
/// color: #eee;
/// }
///
/// @require {function} _fetch-bourbon-setting
///
/// @require {function} _is-color
///
/// @require {function} _contrast-ratio
///
/// @since 5.0.0
@function contrast-switch(
$base-color,
$dark-color: _fetch-bourbon-setting("contrast-switch-dark-color"),
$light-color: _fetch-bourbon-setting("contrast-switch-light-color")
) {
@if not _is-color($base-color) {
@error "`#{$base-color}` is not a valid color for the `$base-color` " +
"argument in the `contrast-switch` function.";
} @else if not _is-color($dark-color) {
@error "`#{$dark-color}` is not a valid color for the `$dark-color` " +
"argument in the `contrast-switch` function.";
} @else if not _is-color($light-color) {
@error "`#{$light-color}` is not a valid color for the `$light-color` " +
"argument in the `contrast-switch` function.";
} @else {
$-contrast-to-dark: _contrast-ratio($base-color, $dark-color);
$-contrast-to-light: _contrast-ratio($base-color, $light-color);
$-prefer-dark: $-contrast-to-dark >= $-contrast-to-light;
@return if($-prefer-dark, $dark-color, $light-color);
}
}

View File

@ -0,0 +1,36 @@
@charset "UTF-8";
/// Truncates text and adds an ellipsis to represent overflow.
///
/// @argument {number} $width [100%]
/// The `max-width` for the string to respect before being truncated.
///
/// @argument {string} $display [inline-block]
/// Sets the display-value of the element.
///
/// @example scss
/// .element {
/// @include ellipsis;
/// }
///
/// // CSS Output
/// .element {
/// display: inline-block;
/// max-width: 100%;
/// overflow: hidden;
/// text-overflow: ellipsis;
/// white-space: nowrap;
/// word-wrap: normal;
/// }
@mixin ellipsis(
$width: 100%,
$display: inline-block
) {
display: $display;
max-width: $width;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-wrap: normal;
}

View File

@ -0,0 +1,65 @@
@charset "UTF-8";
/// Generates an `@font-face` declaration. You can choose the specific file
/// formats you need to output; the mixin supports `woff2`
/// and `woff`. The mixin also supports usage with the Rails Asset Pipeline,
/// which you can enable per use, or globally in the `$bourbon()` settings.
///
/// @argument {string} $font-family
///
/// @argument {string} $file-path
///
/// @argument {string | list} $file-formats [("woff2", "woff")]
/// List of the font file formats to include. Can also be set globally using
/// the `global-font-file-formats` key in the Bourbon settings.
///
/// @argument {boolean} $asset-pipeline [false]
/// Set to `true` if youre using the Rails Asset Pipeline (place the fonts
/// in `app/assets/fonts/`). Can also be set globally using the
/// `rails-asset-pipeline` key in the Bourbon settings.
///
/// @content
/// Any additional CSS properties that are included in the `@include`
/// directive will be output within the `@font-face` declaration, e.g. you can
/// pass in `font-weight`, `font-style` and/or `unicode-range`.
///
/// @example scss
/// @include font-face(
/// "source-sans-pro",
/// "fonts/source-sans-pro-regular",
/// ("woff2", "woff")
/// ) {
/// font-style: normal;
/// font-weight: 400;
/// }
///
/// // CSS Output
/// @font-face {
/// font-family: "source-sans-pro";
/// src: url("fonts/source-sans-pro-regular.woff2") format("woff2"),
/// url("fonts/source-sans-pro-regular.woff") format("woff");
/// font-style: normal;
/// font-weight: 400;
/// }
///
/// @require {function} _font-source-declaration
///
/// @require {function} _fetch-bourbon-setting
@mixin font-face(
$font-family,
$file-path,
$file-formats: _fetch-bourbon-setting("global-font-file-formats"),
$asset-pipeline: _fetch-bourbon-setting("rails-asset-pipeline")
) {
@font-face {
font-family: $font-family;
src: _font-source-declaration(
$font-family,
$file-path,
$asset-pipeline,
$file-formats
);
@content;
}
}

View File

@ -0,0 +1,248 @@
@charset "UTF-8";
/// A variable that outputs a Helvetica font stack.
///
/// @link https://goo.gl/uSJvZe
///
/// @type list
///
/// @example scss
/// .element {
/// font-family: $font-stack-helvetica;
/// }
///
/// // CSS Output
/// .element {
/// font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
/// }
$font-stack-helvetica: (
"Helvetica Neue",
"Helvetica",
"Arial",
sans-serif,
);
/// A variable that outputs a Lucida Grande font stack.
///
/// @link https://goo.gl/R5UyYE
///
/// @type list
///
/// @example scss
/// .element {
/// font-family: $font-stack-lucida-grande;
/// }
///
/// // CSS Output
/// .element {
/// font-family: "Lucida Grande", "Lucida Sans Unicode", "Geneva", "Verdana", sans-serif;
/// }
$font-stack-lucida-grande: (
"Lucida Grande",
"Lucida Sans Unicode",
"Geneva",
"Verdana",
sans-serif,
);
/// A variable that outputs a Verdana font stack.
///
/// @link https://goo.gl/yGXWSS
///
/// @type list
///
/// @example scss
/// .element {
/// font-family: $font-stack-verdana;
/// }
///
/// // CSS Output
/// .element {
/// font-family: "Verdana", "Geneva", sans-serif;
/// }
$font-stack-verdana: (
"Verdana",
"Geneva",
sans-serif,
);
/// A variable that outputs a system font stack.
///
/// @type list
///
/// @example scss
/// .element {
/// font-family: $font-stack-system;
/// }
///
/// // CSS Output
/// .element {
/// font-family: system-ui, -apple-system, BlinkMacSystemFont, "Avenir Next", "Avenir", "Segoe UI", "Lucida Grande", "Helvetica Neue", "Helvetica", "Fira Sans", "Roboto", "Noto", "Droid Sans", "Cantarell", "Oxygen", "Ubuntu", "Franklin Gothic Medium", "Century Gothic", "Liberation Sans", sans-serif;
/// }
$font-stack-system: (
system-ui,
-apple-system,
BlinkMacSystemFont,
"Avenir Next",
"Avenir",
"Segoe UI",
"Lucida Grande",
"Helvetica Neue",
"Helvetica",
"Fira Sans",
"Roboto",
"Noto",
"Droid Sans",
"Cantarell",
"Oxygen",
"Ubuntu",
"Franklin Gothic Medium",
"Century Gothic",
"Liberation Sans",
sans-serif,
);
/// A variable that outputs a Garamond font stack.
///
/// @link https://goo.gl/QQFEkV
///
/// @type list
///
/// @example scss
/// .element {
/// font-family: $font-stack-garamond;
/// }
///
/// // CSS Output
/// .element {
/// font-family: "Garamond", "Baskerville", "Baskerville Old Face", "Hoefler Text", "Times New Roman", serif;
/// }
$font-stack-garamond: (
"Garamond",
"Baskerville",
"Baskerville Old Face",
"Hoefler Text",
"Times New Roman",
serif,
);
/// A variable that outputs a Georgia font stack.
///
/// @link https://goo.gl/wtzVPy
///
/// @type list
///
/// @example scss
/// .element {
/// font-family: $font-stack-georgia;
/// }
///
/// // CSS Output
/// .element {
/// font-family: "Georgia", "Times", "Times New Roman", serif;
/// }
$font-stack-georgia: (
"Georgia",
"Times",
"Times New Roman",
serif,
);
/// A variable that outputs a Hoefler Text font stack.
///
/// @link https://goo.gl/n7U7zx
///
/// @type list
///
/// @example scss
/// .element {
/// font-family: $font-stack-hoefler-text;
/// }
///
/// // CSS Output
/// .element {
/// font-family: "Hoefler Text", "Baskerville Old Face", "Garamond", "Times New Roman", serif;
/// }
$font-stack-hoefler-text: (
"Hoefler Text",
"Baskerville Old Face",
"Garamond",
"Times New Roman",
serif,
);
/// A variable that outputs a Consolas font stack.
///
/// @link https://goo.gl/iKrtqv
///
/// @type list
///
/// @example scss
/// .element {
/// font-family: $font-stack-consolas;
/// }
///
/// // CSS Output
/// .element {
/// font-family: "Consolas", "monaco", monospace;
/// }
$font-stack-consolas: (
"Consolas",
"monaco",
monospace,
);
/// A variable that outputs a Courier New font stack.
///
/// @link https://goo.gl/bHfWMP
///
/// @type list
///
/// @example scss
/// .element {
/// font-family: $font-stack-courier-new;
/// }
///
/// // CSS Output
/// .element {
/// font-family: "Courier New", "Courier", "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
/// }
$font-stack-courier-new: (
"Courier New",
"Courier",
"Lucida Sans Typewriter",
"Lucida Typewriter",
monospace,
);
/// A variable that outputs a Monaco font stack.
///
/// @link https://goo.gl/9PgKDO
///
/// @type list
///
/// @example scss
/// .element {
/// font-family: $font-stack-monaco;
/// }
///
/// // CSS Output
/// .element {
/// font-family: "Monaco", "Consolas", "Lucida Console", monospace;
/// }
$font-stack-monaco: (
"Monaco",
"Consolas",
"Lucida Console",
monospace,
);

View File

@ -0,0 +1,24 @@
@charset "UTF-8";
/// Hides the text in an element, commonly used to show an image instead. Some
/// elements will need block-level styles applied.
///
/// @link https://goo.gl/EvLRIu
///
/// @example scss
/// .element {
/// @include hide-text;
/// }
///
/// // CSS Output
/// .element {
/// overflow: hidden;
/// text-indent: 101%;
/// white-space: nowrap;
/// }
@mixin hide-text {
overflow: hidden;
text-indent: 101%;
white-space: nowrap;
}

View File

@ -0,0 +1,70 @@
@charset "UTF-8";
/// Hides an element visually while still allowing the content to be accessible
/// to assistive technology, e.g. screen readers. Passing `unhide` will reverse
/// the affects of the hiding, which is handy for showing the element on focus,
/// for example.
///
/// @link https://goo.gl/Vf1TGn
///
/// @argument {string} $toggle [hide]
/// Accepts `hide` or `unhide`. `unhide` reverses the affects of `hide`.
///
/// @example scss
/// .element {
/// @include hide-visually;
///
/// &:active,
/// &:focus {
/// @include hide-visually("unhide");
/// }
/// }
///
/// // CSS Output
/// .element {
/// border: 0;
/// clip: rect(1px, 1px, 1px, 1px);
/// clip-path: inset(100%);
/// height: 1px;
/// overflow: hidden;
/// padding: 0;
/// position: absolute;
/// width: 1px;
/// }
///
/// .hide-visually:active,
/// .hide-visually:focus {
/// clip: auto;
/// clip-path: none;
/// height: auto;
/// overflow: visible;
/// position: static;
/// width: auto;
/// }
///
/// @since 5.0.0
@mixin hide-visually($toggle: "hide") {
@if not index("hide" "unhide", $toggle) {
@error "`#{$toggle}` is not a valid value for the `$toggle` argument in " +
"the `hide-visually` mixin. Must be either `hide` or `unhide`.";
} @else if $toggle == "hide" {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
clip-path: inset(100%);
height: 1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
} @else if $toggle == "unhide" {
clip: auto;
clip-path: none;
height: auto;
overflow: visible;
position: static;
white-space: inherit;
width: auto;
}
}

View File

@ -0,0 +1,37 @@
@charset "UTF-8";
/// Provides a concise, one-line method for setting `margin` on specific edges
/// of a box. Use a `null` value to skip edges of the box with standard
/// CSS shorthand.
///
/// @argument {list} $values
/// List of margin values; accepts CSS shorthand.
///
/// @example scss
/// .element {
/// @include margin(null auto);
/// }
///
/// // CSS Output
/// .element {
/// margin-left: auto;
/// margin-right: auto;
/// }
///
/// @example scss
/// .element {
/// @include margin(10px 3em 20vh null);
/// }
///
/// // CSS Output
/// .element {
/// margin-bottom: 20vh;
/// margin-right: 3em;
/// margin-top: 10px;
/// }
///
/// @require {mixin} _directional-property
@mixin margin($values) {
@include _directional-property(margin, null, $values);
}

View File

@ -0,0 +1,120 @@
@charset "UTF-8";
/// Increments up or down a defined scale and returns an adjusted value. This
/// helps establish consistent measurements and spacial relationships throughout
/// your project. We provide a list of commonly used scales as
/// [pre-defined variables][scales].
///
/// [scales]: https://github.com/thoughtbot/bourbon/blob/master/core/bourbon/helpers/_scales.scss
///
/// @argument {number (unitless)} $increment
/// How many steps to increment up or down the scale.
///
/// @argument {number (with unit) | list} $value [1em]
/// The base value the scale starts at. Can also be set globally using the
/// `modular-scale-base` key in the Bourbon settings.
///
/// @argument {number (unitless)} $ratio [1.25]
/// The ratio the scale is built on. Can also be set globally using the
/// `modular-scale-ratio` key in the Bourbon settings.
///
/// @return {number (with unit)}
///
/// @example scss
/// .element {
/// font-size: modular-scale(2);
/// }
///
/// // CSS Output
/// .element {
/// font-size: 1.5625em;
/// }
///
/// @example scss
/// .element {
/// margin-right: modular-scale(3, 2em);
/// }
///
/// // CSS Output
/// .element {
/// margin-right: 3.90625em;
/// }
///
/// @example scss
/// .element {
/// font-size: modular-scale(3, 1em 1.6em, $major-seventh);
/// }
///
/// // CSS Output
/// .element {
/// font-size: 3em;
/// }
///
/// @example scss
/// // Globally change the base ratio
/// $bourbon: (
/// "modular-scale-ratio": 1.2,
/// );
///
/// .element {
/// font-size: modular-scale(3);
/// }
///
/// // CSS Output
/// .element {
/// font-size: 1.728em;
/// }
///
/// @require {function} _fetch-bourbon-setting
@function modular-scale(
$increment,
$value: _fetch-bourbon-setting("modular-scale-base"),
$ratio: _fetch-bourbon-setting("modular-scale-ratio")
) {
$v1: nth($value, 1);
$v2: nth($value, length($value));
$value: $v1;
// scale $v2 to just above $v1
@while $v2 > $v1 {
$v2: ($v2 / $ratio); // will be off-by-1
}
@while $v2 < $v1 {
$v2: ($v2 * $ratio); // will fix off-by-1
}
// check AFTER scaling $v2 to prevent double-counting corner-case
$double-stranded: $v2 > $v1;
@if $increment > 0 {
@for $i from 1 through $increment {
@if $double-stranded and ($v1 * $ratio) > $v2 {
$value: $v2;
$v2: ($v2 * $ratio);
} @else {
$v1: ($v1 * $ratio);
$value: $v1;
}
}
}
@if $increment < 0 {
// adjust $v2 to just below $v1
@if $double-stranded {
$v2: ($v2 / $ratio);
}
@for $i from $increment through -1 {
@if $double-stranded and ($v1 / $ratio) < $v2 {
$value: $v2;
$v2: ($v2 / $ratio);
} @else {
$v1: ($v1 / $ratio);
$value: $v1;
}
}
}
@return $value;
}

View File

@ -0,0 +1,25 @@
@charset "UTF-8";
/// Outputs the `overflow-wrap` property and its legacy name `word-wrap` to
/// support browsers that do not yet use `overflow-wrap`.
///
/// @argument {string} $wrap [break-word]
/// Accepted CSS values are `normal`, `break-word`, `inherit`, `initial`,
/// or `unset`.
///
/// @example scss
/// .wrapper {
/// @include overflow-wrap;
/// }
///
/// // CSS Output
/// .wrapper {
/// word-wrap: break-word;
/// overflow-wrap: break-word;
/// }
@mixin overflow-wrap($wrap: break-word) {
word-wrap: $wrap;
// stylelint-disable-next-line order/properties-alphabetical-order
overflow-wrap: $wrap;
}

View File

@ -0,0 +1,36 @@
@charset "UTF-8";
/// Provides a concise method for targeting `padding` on specific sides of a
/// box. Use a `null` value to skip a side.
///
/// @argument {list} $values
/// List of padding values; accepts CSS shorthand.
///
/// @example scss
/// .element-one {
/// @include padding(null 1rem);
/// }
///
/// // CSS Output
/// .element-one {
/// padding-left: 1rem;
/// padding-right: 1rem;
/// }
///
/// @example scss
/// .element-two {
/// @include padding(10vh null 10px 5%);
/// }
///
/// // CSS Output
/// .element-two {
/// padding-bottom: 10px;
/// padding-left: 5%;
/// padding-top: 10vh;
/// }
///
/// @require {mixin} _directional-property
@mixin padding($values) {
@include _directional-property(padding, null, $values);
}

View File

@ -0,0 +1,62 @@
@charset "UTF-8";
/// Provides a concise, one-line method for setting an elements positioning
/// properties: `position`, `top`, `right`, `bottom` and `left`. Use a `null`
/// value to skip an edge of the box.
///
/// @argument {string} $position
/// A CSS position value.
///
/// @argument {list} $box-edge-values
/// List of lengths; accepts CSS shorthand.
///
/// @example scss
/// .element {
/// @include position(relative, 0 null null 10em);
/// }
///
/// // CSS Output
/// .element {
/// left: 10em;
/// position: relative;
/// top: 0;
/// }
///
/// @example scss
/// .element {
/// @include position(absolute, 0);
/// }
///
/// // CSS Output
/// .element {
/// position: absolute;
/// top: 0;
/// right: 0;
/// bottom: 0;
/// left: 0;
/// }
///
/// @require {function} _is-length
///
/// @require {function} _unpack-shorthand
@mixin position(
$position,
$box-edge-values
) {
$box-edge-values: _unpack-shorthand($box-edge-values);
$offsets: (
"top": nth($box-edge-values, 1),
"right": nth($box-edge-values, 2),
"bottom": nth($box-edge-values, 3),
"left": nth($box-edge-values, 4),
);
position: $position;
@each $offset, $value in $offsets {
@if _is-length($value) {
#{$offset}: $value;
}
}
}

View File

@ -0,0 +1,37 @@
@charset "UTF-8";
/// Generates vendor prefixes.
///
/// @argument {string} $property
/// Property to prefix.
///
/// @argument {string} $value
/// Value to use.
///
/// @argument {list} $prefixes
/// Vendor prefixes to output.
///
/// @example scss
/// .element {
/// @include prefixer(appearance, none, ("webkit", "moz"));
/// }
///
/// // CSS Output
/// .element {
/// -webkit-appearance: none;
/// -moz-appearance: none;
/// appearance: none;
/// }
///
/// @author Hugo Giraudel
@mixin prefixer(
$property,
$value,
$prefixes: ()
) {
@each $prefix in $prefixes {
#{"-" + $prefix + "-" + $property}: $value;
}
#{$property}: $value;
}

View File

@ -0,0 +1,32 @@
@charset "UTF-8";
/// Mixes a color with black.
///
/// @argument {color} $color
///
/// @argument {number (percentage)} $percent
/// The amount of black to be mixed in.
///
/// @return {color}
///
/// @example scss
/// .element {
/// background-color: shade(#ffbb52, 60%);
/// }
///
/// // CSS Output
/// .element {
/// background-color: #664a20;
/// }
@function shade(
$color,
$percent
) {
@if not _is-color($color) {
@error "`#{$color}` is not a valid color for the `$color` argument in " +
"the `shade` mixin.";
} @else {
@return mix(#000, $color, $percent);
}
}

50
sass/bourbon/bourbon/library/_size.scss vendored Normal file
View File

@ -0,0 +1,50 @@
@charset "UTF-8";
/// Sets the `width` and `height` of the element in one statement.
///
/// @argument {number (with unit) | string} $width
///
/// @argument {number (with unit) | string} $height [$width]
///
/// @example scss
/// .first-element {
/// @include size(2em);
/// }
///
/// // CSS Output
/// .first-element {
/// width: 2em;
/// height: 2em;
/// }
///
/// @example scss
/// .second-element {
/// @include size(auto, 10em);
/// }
///
/// // CSS Output
/// .second-element {
/// width: auto;
/// height: 10em;
/// }
///
/// @require {function} _is-size
@mixin size(
$width,
$height: $width
) {
@if _is-size($height) {
height: $height;
} @else {
@error "`#{$height}` is not a valid length for the `$height` argument " +
"in the `size` mixin.";
}
@if _is-size($width) {
width: $width;
} @else {
@error "`#{$width}` is not a valid length for the `$width` argument " +
"in the `size` mixin.";
}
}

View File

@ -0,0 +1,17 @@
@charset "UTF-8";
/// Strips the unit from a number.
///
/// @argument {number} $value
///
/// @return {number (unitless)}
///
/// @example scss
/// $dimension: strip-unit(10em);
///
/// // Output
/// $dimension: 10;
@function strip-unit($value) {
@return ($value / ($value * 0 + 1));
}

View File

@ -0,0 +1,163 @@
@charset "UTF-8";
////
/// @type list
///
/// @require {function} _assign-inputs
///
/// @require {variable} $_text-inputs-list
////
/// A list of all _text-based_ HTML inputs. Please note that you must
/// interpolate the variable (`#{}`) to use it as a selector.
///
/// @example scss
/// #{$all-text-inputs} {
/// border: 1px solid #ccc;
/// }
///
/// // CSS Output
/// [type='color'],
/// [type='date'],
/// [type='datetime'],
/// [type='datetime-local'],
/// [type='email'],
/// [type='month'],
/// [type='number'],
/// [type='password'],
/// [type='search'],
/// [type='tel'],
/// [type='text'],
/// [type='time'],
/// [type='url'],