Debian Codegraph @

debian/missing-sources/bourbon-neat/app/assets/stylesheets/grid/_shift.scss

raw
1 @charset "UTF-8";
2
3 /// Translates an element horizontally by a number of columns. Positive arguments shift the element to the active layout direction, while negative ones shift it to the opposite direction.
4 ///
5 /// @param {Number (unitless)} $n-columns [1]
6 /// Number of columns by which the element shifts.
7 ///
8 /// @example scss - Usage
9 /// .element {
10 /// @include shift(-3);
11 /// }
12 ///
13 /// @example css - CSS output
14 /// .element {
15 /// margin-left: -25.58941%;
16 /// }
17
18 @mixin shift($n-columns: 1) {
19 @include shift-in-context($n-columns);
20 }
21
22 /// Translates an element horizontally by a number of columns, in a specific nesting context.
23 ///
24 /// @param {List} $shift
25 /// A list containing the number of columns to shift (`$columns`) and the number of columns of the parent element (`$container-columns`).
26 ///
27 /// The two values can be separated with any string such as `of`, `/`, etc.
28 ///
29 /// @example scss - Usage
30 /// .element {
31 /// @include shift(-3 of 6);
32 /// }
33 ///
34 /// @example css - CSS output
35 /// .element {
36 /// margin-left: -52.41458%;
37 /// }
38
39 @mixin shift-in-context($shift: $columns of $container-columns) {
40 $n-columns: nth($shift, 1);
41 $parent-columns: container-shift($shift) !global;
42
43 $direction: get-direction($layout-direction, $default-layout-direction);
44 $opposite-direction: get-opposite-direction($direction);
45
46 margin-#{$opposite-direction}: $n-columns * flex-grid(1, $parent-columns) + $n-columns * flex-gutter($parent-columns);
47
48 // Reset nesting context
49 $parent-columns: $grid-columns !global;
50 }