neat 1.7.0.pre → 1.7.0.rc
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -13
- data/README.md +133 -106
- data/app/assets/stylesheets/_neat.scss +3 -3
- data/app/assets/stylesheets/functions/_new-breakpoint.scss +33 -3
- data/app/assets/stylesheets/functions/_private.scss +16 -22
- data/app/assets/stylesheets/grid/{_direction.scss → _direction-context.scss} +7 -8
- data/app/assets/stylesheets/grid/{_display.scss → _display-context.scss} +4 -5
- data/app/assets/stylesheets/grid/_fill-parent.scss +16 -0
- data/app/assets/stylesheets/grid/_media.scss +66 -11
- data/app/assets/stylesheets/grid/_omega.scss +34 -3
- data/app/assets/stylesheets/grid/_outer-container.scss +20 -21
- data/app/assets/stylesheets/grid/_pad.scss +16 -0
- data/app/assets/stylesheets/grid/_private.scss +2 -10
- data/app/assets/stylesheets/grid/_row.scss +29 -0
- data/app/assets/stylesheets/grid/_shift.scss +34 -0
- data/app/assets/stylesheets/grid/_span-columns.scss +49 -1
- data/app/assets/stylesheets/grid/_to-deprecate.scss +36 -0
- data/app/assets/stylesheets/grid/_visual-grid.scss +1 -1
- data/app/assets/stylesheets/settings/_disable-warnings.scss +0 -1
- data/app/assets/stylesheets/settings/_grid.scss +53 -5
- data/app/assets/stylesheets/settings/_visual-grid.scss +26 -2
- data/bower.json +3 -1
- data/lib/neat/version.rb +1 -1
- data/sache.json +5 -0
- data/spec/neat/direction_spec.rb +2 -2
- data/spec/neat/display_spec.rb +2 -2
- data/test/{direction.scss → direction-context.scss} +2 -2
- data/test/{display.scss → display-context.scss} +3 -3
- metadata +9 -8
@@ -1,29 +1,28 @@
|
|
1
1
|
/**
|
2
2
|
* Changes the direction property used by other mixins called in the code block argument.
|
3
3
|
*
|
4
|
-
* @param {String} $direction (left-to-right)
|
4
|
+
* @param {String} $direction (left-to-right)
|
5
|
+
* Layout direction to be used within the block. Can be `left-to-right` or `right-to-left`.
|
5
6
|
*
|
6
|
-
* @example scss
|
7
|
+
* @example scss - Usage
|
7
8
|
* @include direction(right-to-left) {
|
8
9
|
* .right-to-left-block {
|
9
10
|
* @include span-columns(6);
|
10
11
|
* }
|
11
12
|
* }
|
12
13
|
*
|
13
|
-
* @example css
|
14
|
-
* // CSS
|
14
|
+
* @example css - CSS Output
|
15
15
|
* .right-to-left-block {
|
16
16
|
* float: right;
|
17
17
|
* ...
|
18
18
|
* }
|
19
19
|
*/
|
20
|
-
|
21
|
-
@mixin direction($direction: left-to-right) {
|
20
|
+
@mixin direction-context($direction: left-to-right) {
|
22
21
|
$scope-direction: $layout-direction;
|
23
22
|
|
24
|
-
@if $direction == left-to-right {
|
23
|
+
@if to-lower-case($direction) == "left-to-right" {
|
25
24
|
$layout-direction: LTR !global;
|
26
|
-
} @else if $direction == right-to-left {
|
25
|
+
} @else if to-lower-case($direction) == "right-to-left" {
|
27
26
|
$layout-direction: RTL !global;
|
28
27
|
}
|
29
28
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
/**
|
2
2
|
* Changes the display property used by other mixins called in the code block argument.
|
3
3
|
*
|
4
|
-
* @param {String} $display (block)
|
4
|
+
* @param {String} $display (block)
|
5
|
+
* Display value to be used within the block. Can be `table` or `block`.
|
5
6
|
*
|
6
7
|
* @example scss
|
7
8
|
* @include display(table) {
|
@@ -11,16 +12,14 @@
|
|
11
12
|
* }
|
12
13
|
*
|
13
14
|
* @example css
|
14
|
-
* // CSS
|
15
15
|
* .display-table {
|
16
16
|
* display: table-cell;
|
17
17
|
* ...
|
18
18
|
* }
|
19
19
|
*/
|
20
|
-
|
21
|
-
@mixin display($display: block) {
|
20
|
+
@mixin display-context($display: block) {
|
22
21
|
$scope-display: $container-display-table;
|
23
|
-
$container-display-table:
|
22
|
+
$container-display-table: $display == table !global;
|
24
23
|
|
25
24
|
@content;
|
26
25
|
|
@@ -1,3 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* Forces the element to fill its parent container.
|
3
|
+
*
|
4
|
+
* @example scss - Usage
|
5
|
+
* .element {
|
6
|
+
* @include fill-parent;
|
7
|
+
* }
|
8
|
+
*
|
9
|
+
* @example css - CSS Output
|
10
|
+
* .element {
|
11
|
+
* width: 100%;
|
12
|
+
* -webkit-box-sizing: border-box;
|
13
|
+
* -moz-box-sizing: border-box;
|
14
|
+
* box-sizing: border-box;
|
15
|
+
* }
|
16
|
+
*/
|
1
17
|
@mixin fill-parent() {
|
2
18
|
width: 100%;
|
3
19
|
|
@@ -1,4 +1,59 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Outputs a media-query block with an optional grid context (the total number of columns used in the grid).
|
3
|
+
*
|
4
|
+
* @param {List} $query
|
5
|
+
* A list of media query features and values, where each `$feature` should have a corresponding `$value`.
|
6
|
+
* For a list of valid values for `$feature`, click [here](http://www.w3.org/TR/css3-mediaqueries/#media1).
|
7
|
+
*
|
8
|
+
* If there is only a single `$value` in `$query`, `$default-feature` is going to be used.
|
9
|
+
*
|
10
|
+
* The number of total columns in the grid can be set by passing `$columns` at the end of the list (overrides `$total-columns`).
|
11
|
+
*
|
12
|
+
*
|
13
|
+
* @param {Number (unitless)} $total-columns ($grid-columns)
|
14
|
+
* - Number of columns to use in the new grid context. Can be set as a shorthand in the first parameter.
|
15
|
+
*
|
16
|
+
* @example scss - Usage
|
17
|
+
* .responsive-element {
|
18
|
+
* @include media(769px) {
|
19
|
+
* @include span-columns(6);
|
20
|
+
* }
|
21
|
+
* }
|
22
|
+
*
|
23
|
+
* .new-context-element {
|
24
|
+
* @include media(min-width 320px max-width 480px, 6) {
|
25
|
+
* @include span-columns(6);
|
26
|
+
* }
|
27
|
+
* }
|
28
|
+
*
|
29
|
+
* @example css - CSS Output
|
30
|
+
* @media screen and (min-width: 769px) {
|
31
|
+
* .responsive-element {
|
32
|
+
* display: block;
|
33
|
+
* float: left;
|
34
|
+
* margin-right: 2.35765%;
|
35
|
+
* width: 48.82117%;
|
36
|
+
* }
|
37
|
+
*
|
38
|
+
* .responsive-element:last-child {
|
39
|
+
* margin-right: 0;
|
40
|
+
* }
|
41
|
+
* }
|
42
|
+
*
|
43
|
+
* @media screen and (min-width: 320px) and (max-width: 480px) {
|
44
|
+
* .new-context-element {
|
45
|
+
* display: block;
|
46
|
+
* float: left;
|
47
|
+
* margin-right: 4.82916%;
|
48
|
+
* width: 100%;
|
49
|
+
* }
|
50
|
+
*
|
51
|
+
* .new-context-element:last-child {
|
52
|
+
* margin-right: 0;
|
53
|
+
* }
|
54
|
+
* }
|
55
|
+
*/
|
56
|
+
@mixin media($query: $feature $value $columns, $total-columns: $grid-columns) {
|
2
57
|
@if length($query) == 1 {
|
3
58
|
@media screen and ($default-feature: nth($query, 1)) {
|
4
59
|
$default-grid-columns: $grid-columns;
|
@@ -9,28 +64,28 @@
|
|
9
64
|
}
|
10
65
|
|
11
66
|
@else {
|
12
|
-
$
|
13
|
-
$
|
67
|
+
$loop-to: length($query);
|
68
|
+
$media-query: 'screen and ';
|
14
69
|
$default-grid-columns: $grid-columns;
|
15
70
|
$grid-columns: $total-columns !global;
|
16
71
|
|
17
|
-
@if length($query)
|
18
|
-
$grid-columns: nth($query, $
|
19
|
-
$
|
72
|
+
@if not is-even(length($query)) {
|
73
|
+
$grid-columns: nth($query, $loop-to) !global;
|
74
|
+
$loop-to: $loop-to - 1;
|
20
75
|
}
|
21
76
|
|
22
77
|
$i: 1;
|
23
|
-
@while $i <= $
|
24
|
-
$
|
78
|
+
@while $i <= $loop-to {
|
79
|
+
$media-query: $media-query + '(' + nth($query, $i) + ': ' + nth($query, $i + 1) + ') ';
|
25
80
|
|
26
|
-
@if ($i + 1) != $
|
27
|
-
$
|
81
|
+
@if ($i + 1) != $loop-to {
|
82
|
+
$media-query: $media-query + 'and ';
|
28
83
|
}
|
29
84
|
|
30
85
|
$i: $i + 2;
|
31
86
|
}
|
32
87
|
|
33
|
-
@media #{$
|
88
|
+
@media #{$media-query} {
|
34
89
|
@content;
|
35
90
|
$grid-columns: $default-grid-columns !global;
|
36
91
|
}
|
@@ -1,7 +1,38 @@
|
|
1
|
-
|
1
|
+
/**
|
2
|
+
* Removes the element's gutter margin, regardless of its position in the grid hierarchy or display property. It can target a specific element, or every `nth-child` occurrence. Works only with `block` layouts.
|
3
|
+
*
|
4
|
+
* @param {List} $query (block)
|
5
|
+
* List of arguments. Supported arguments are `nth-child` selectors (targets a specific pseudo element) and `auto` (targets `last-child`).
|
6
|
+
*
|
7
|
+
* When passed an `nth-child` argument of type `*n` with `block` display, the omega mixin automatically adds a clear to the `*n+1` th element. Note that composite arguments such as `2n+1` do not support this feature.
|
8
|
+
*
|
9
|
+
* **Deprecation warning**: The omega mixin will no longer take a `$direction` argument. To change the layout direction, use `row($direction)` or set `$default-layout-direction` instead.
|
10
|
+
*
|
11
|
+
* @example scss - Usage
|
12
|
+
* .element {
|
13
|
+
* @include omega;
|
14
|
+
* }
|
15
|
+
*
|
16
|
+
* .nth-element {
|
17
|
+
* @include omega(4n);
|
18
|
+
* }
|
19
|
+
*
|
20
|
+
* @example css - CSS Output
|
21
|
+
* .element {
|
22
|
+
* margin-right: 0;
|
23
|
+
* }
|
24
|
+
*
|
25
|
+
* .nth-element:nth-child(4n) {
|
26
|
+
* margin-right: 0;
|
27
|
+
* }
|
28
|
+
*
|
29
|
+
* .nth-element:nth-child(4n+1) {
|
30
|
+
* clear: left;
|
31
|
+
* }
|
32
|
+
*/
|
2
33
|
@mixin omega($query: block, $direction: default) {
|
3
|
-
$table:
|
4
|
-
$auto:
|
34
|
+
$table: belongs-to(table, $query);
|
35
|
+
$auto: belongs-to(auto, $query);
|
5
36
|
|
6
37
|
@if $direction != default {
|
7
38
|
@include -neat-warn("The omega mixin will no longer take a $direction argument. To change the layout direction, use the direction(){...} mixin.");
|
@@ -1,33 +1,32 @@
|
|
1
1
|
/**
|
2
2
|
* Makes an element a outer container by centring it in the viewport, clearing its floats, and setting its `max-width`.
|
3
|
-
*
|
4
3
|
* Although optional, using `outer-container` is recommended. The mixin can be called on more than one element per page, as long as they are not nested.
|
5
4
|
*
|
6
|
-
* @param {Number} $local-max-width ($max-width)
|
5
|
+
* @param {Number (unit)} $local-max-width ($max-width)
|
6
|
+
* Max width to be applied to the element. Can be a percentage or a measure.
|
7
7
|
*
|
8
|
-
* @example scss
|
9
|
-
*
|
10
|
-
*
|
11
|
-
*
|
8
|
+
* @example scss - Usage
|
9
|
+
* .element {
|
10
|
+
* @include outer-container(100%);
|
11
|
+
* }
|
12
12
|
*
|
13
|
-
* @example css
|
14
|
-
*
|
15
|
-
*
|
16
|
-
*
|
17
|
-
*
|
18
|
-
*
|
19
|
-
*
|
13
|
+
* @example css - CSS Output
|
14
|
+
* .element {
|
15
|
+
* *zoom: 1;
|
16
|
+
* max-width: 100%;
|
17
|
+
* margin-left: auto;
|
18
|
+
* margin-right: auto;
|
19
|
+
* }
|
20
20
|
*
|
21
|
-
*
|
22
|
-
*
|
23
|
-
*
|
24
|
-
*
|
21
|
+
* .element:before, .element:after {
|
22
|
+
* content: " ";
|
23
|
+
* display: table;
|
24
|
+
* }
|
25
25
|
*
|
26
|
-
*
|
27
|
-
*
|
28
|
-
*
|
26
|
+
* .element:after {
|
27
|
+
* clear: both;
|
28
|
+
* }
|
29
29
|
*/
|
30
|
-
|
31
30
|
@mixin outer-container($local-max-width: $max-width) {
|
32
31
|
@include clearfix;
|
33
32
|
max-width: $local-max-width;
|
@@ -1,3 +1,19 @@
|
|
1
|
+
/**
|
2
|
+
* Adds padding to the element.
|
3
|
+
*
|
4
|
+
* @param {List} $padding (flex-gutter())
|
5
|
+
* A list of padding value(s) to use. Passing `default` in the list will result in using the gutter width as a padding value.
|
6
|
+
*
|
7
|
+
* @example scss - Usage
|
8
|
+
* .element {
|
9
|
+
* @include pad(30px -20px 10px default);
|
10
|
+
* }
|
11
|
+
*
|
12
|
+
* @example css - CSS Output
|
13
|
+
* .element {
|
14
|
+
* padding: 30px -20px 10px 2.35765%;
|
15
|
+
* }
|
16
|
+
*/
|
1
17
|
@mixin pad($padding: flex-gutter()) {
|
2
18
|
$padding-list: null;
|
3
19
|
@each $value in $padding {
|
@@ -3,7 +3,7 @@ $fg-column: $column;
|
|
3
3
|
$fg-gutter: $gutter;
|
4
4
|
$fg-max-columns: $grid-columns;
|
5
5
|
$container-display-table: false !default;
|
6
|
-
$layout-direction:
|
6
|
+
$layout-direction: LTR !default;
|
7
7
|
|
8
8
|
@function flex-grid($columns, $container-columns: $fg-max-columns) {
|
9
9
|
$width: $columns * $fg-column + ($columns - 1) * $fg-gutter;
|
@@ -31,13 +31,5 @@ $layout-direction: nil !default;
|
|
31
31
|
}
|
32
32
|
|
33
33
|
@function is-display-table($container-is-display-table, $display) {
|
34
|
-
$display-table
|
35
|
-
|
36
|
-
@if $container-is-display-table == true {
|
37
|
-
$display-table: true;
|
38
|
-
} @else if $display == table {
|
39
|
-
$display-table: true;
|
40
|
-
}
|
41
|
-
|
42
|
-
@return $display-table;
|
34
|
+
@return $container-is-display-table == true or $display == table;
|
43
35
|
}
|
@@ -1,3 +1,32 @@
|
|
1
|
+
/**
|
2
|
+
* Designates the element as a row of columns in the grid layout. It clears the floats on the element and sets its display property. Rows can't be nested, but there can be more than one row element—with different display properties—per layout.
|
3
|
+
*
|
4
|
+
* @param {String} $display (default)
|
5
|
+
* Sets the display property of the element and the display context that will be used by its children. Can be `block` or `table`.
|
6
|
+
*
|
7
|
+
* @param {String} $direction ($default-layout-direction)
|
8
|
+
* Sets the layout direction. Can be `LTR` (left-to-right) or `RTL` (right-to-left).
|
9
|
+
*
|
10
|
+
* @example scss - Usage
|
11
|
+
* .element {
|
12
|
+
* @include row();
|
13
|
+
* }
|
14
|
+
*
|
15
|
+
* @example css - CSS Output
|
16
|
+
* .element {
|
17
|
+
* *zoom: 1;
|
18
|
+
* display: block;
|
19
|
+
* }
|
20
|
+
*
|
21
|
+
* .element:before, .element:after {
|
22
|
+
* content: " ";
|
23
|
+
* display: table;
|
24
|
+
* }
|
25
|
+
*
|
26
|
+
* .element:after {
|
27
|
+
* clear: both;
|
28
|
+
* }
|
29
|
+
*/
|
1
30
|
@mixin row($display: default, $direction: $default-layout-direction) {
|
2
31
|
@if $direction != $default-layout-direction {
|
3
32
|
@include -neat-warn("The $direction argument will be deprecated in future versions in favor of the direction(){...} mixin.");
|
@@ -1,7 +1,41 @@
|
|
1
|
+
/**
|
2
|
+
* 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.
|
3
|
+
*
|
4
|
+
* @param {Number (unitless)} $n-columns (1)
|
5
|
+
* Number of columns by which the element shifts.
|
6
|
+
*
|
7
|
+
* @example scss - Usage
|
8
|
+
* .element {
|
9
|
+
* @include shift(-3);
|
10
|
+
* }
|
11
|
+
*
|
12
|
+
* @example css - CSS output
|
13
|
+
* .element {
|
14
|
+
* margin-left: -25.58941%;
|
15
|
+
* }
|
16
|
+
*/
|
1
17
|
@mixin shift($n-columns: 1) {
|
2
18
|
@include shift-in-context($n-columns);
|
3
19
|
}
|
4
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
|
+
*/
|
5
39
|
@mixin shift-in-context($shift: $columns of $container-columns) {
|
6
40
|
$n-columns: nth($shift, 1);
|
7
41
|
$parent-columns: container-shift($shift) !global;
|
@@ -1,8 +1,56 @@
|
|
1
|
+
/**
|
2
|
+
* Specifies the number of columns an element should span. If the selector is nested the number of columns of its parent element should be passed as an argument as well.
|
3
|
+
*
|
4
|
+
* @param {List} $span
|
5
|
+
* A list containing `$columns`, the unitless number of columns the element spans (required), and `$container-columns`, the number of columns the parent element spans (optional).
|
6
|
+
*
|
7
|
+
* If only one value is passed, it is assumed that it's `$columns` and that that `$container-columns` is equal to `$grid-columns`, the total number of columns in the grid.
|
8
|
+
*
|
9
|
+
* The values can be separated with any string such as `of`, `/`, etc.
|
10
|
+
*
|
11
|
+
* @param {String} $display (block)
|
12
|
+
* Sets the display property of the element. By default it sets the display propert of the element to `block`.
|
13
|
+
*
|
14
|
+
* If passed `block-collapse`, it also removes the margin gutter by adding it to the element width.
|
15
|
+
*
|
16
|
+
* If passed `table`, it sets the display property to `table-cell` and calculates the width of the element without taking gutters into consideration. The result does not align with the block-based grid.
|
17
|
+
*
|
18
|
+
* @example scss - Usage
|
19
|
+
* .element {
|
20
|
+
* @include span-columns(6);
|
21
|
+
|
22
|
+
* .nested-element {
|
23
|
+
* @include span-columns(2 of 6);
|
24
|
+
* }
|
25
|
+
* }
|
26
|
+
*
|
27
|
+
* @example css - CSS Output
|
28
|
+
* .element {
|
29
|
+
* display: block;
|
30
|
+
* float: left;
|
31
|
+
* margin-right: 2.35765%;
|
32
|
+
* width: 48.82117%;
|
33
|
+
* }
|
34
|
+
*
|
35
|
+
* .element:last-child {
|
36
|
+
* margin-right: 0;
|
37
|
+
* }
|
38
|
+
*
|
39
|
+
* .element .nested-element {
|
40
|
+
* display: block;
|
41
|
+
* float: left;
|
42
|
+
* margin-right: 4.82916%;
|
43
|
+
* width: 30.11389%;
|
44
|
+
* }
|
45
|
+
*
|
46
|
+
* .element .nested-element:last-child {
|
47
|
+
* margin-right: 0;
|
48
|
+
* }
|
49
|
+
*/
|
1
50
|
@mixin span-columns($span: $columns of $container-columns, $display: block) {
|
2
51
|
$columns: nth($span, 1);
|
3
52
|
$container-columns: container-span($span);
|
4
53
|
|
5
|
-
// Set nesting context (used by shift())
|
6
54
|
$parent-columns: get-parent-columns($container-columns) !global;
|
7
55
|
|
8
56
|
$direction: get-direction($layout-direction, $default-layout-direction);
|