neat 1.9.1 → 2.0.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -4
  3. data/.hound.yml +5 -0
  4. data/.npmignore +0 -4
  5. data/.scss-lint.yml +3 -1
  6. data/CHANGELOG.md +45 -23
  7. data/CONTRIBUTING.md +12 -0
  8. data/Gemfile +1 -2
  9. data/Gulpfile.js +5 -6
  10. data/LICENSE.md +1 -1
  11. data/README.md +26 -163
  12. data/RELEASING.md +27 -0
  13. data/Rakefile +3 -13
  14. data/bower.json +8 -9
  15. data/circle.yml +13 -0
  16. data/contrib/base/_grids.scss +4 -0
  17. data/contrib/base/_variables.scss +8 -0
  18. data/contrib/index.html +68 -223
  19. data/contrib/patterns/_box.scss +11 -0
  20. data/contrib/patterns/_global.scss +5 -0
  21. data/contrib/patterns/_grid-media.scss +52 -0
  22. data/contrib/patterns/_grid-nested.scss +7 -0
  23. data/contrib/patterns/_grid-push.scss +7 -0
  24. data/contrib/patterns/_grid-shift.scss +7 -0
  25. data/contrib/patterns/_grid.scss +31 -0
  26. data/contrib/styles.scss +12 -293
  27. data/core/_neat.scss +20 -0
  28. data/core/neat/functions/_neat-column-default.scss +23 -0
  29. data/core/neat/functions/_neat-column-ratio.scss +24 -0
  30. data/core/neat/functions/_neat-column-width.scss +25 -0
  31. data/core/neat/functions/_neat-parse-columns.scss +22 -0
  32. data/core/neat/functions/_neat-parse-media.scss +20 -0
  33. data/core/neat/functions/_retrieve-neat-settings.scss +18 -0
  34. data/core/neat/mixins/_grid-column.scss +29 -0
  35. data/{app/assets/stylesheets/mixins/_clearfix.scss → core/neat/mixins/_grid-container.scss} +5 -5
  36. data/core/neat/mixins/_grid-media.scss +50 -0
  37. data/core/neat/mixins/_grid-push.scss +32 -0
  38. data/core/neat/mixins/_grid-shift.scss +31 -0
  39. data/core/neat/settings/_settings.scss +41 -0
  40. data/index.js +1 -1
  41. data/lib/neat.rb +5 -18
  42. data/lib/neat/generator.rb +1 -1
  43. data/lib/neat/version.rb +1 -1
  44. data/neat.gemspec +27 -33
  45. data/package.json +5 -4
  46. data/spec/.keep +0 -0
  47. data/spec/fixtures/_setup.scss +1 -0
  48. data/spec/fixtures/functions/neat-column-default.scss +22 -0
  49. data/spec/fixtures/functions/neat-column-width.scss +30 -0
  50. data/spec/fixtures/functions/neat-parse-media.scss +9 -0
  51. data/spec/fixtures/functions/retrieve-neat-settings.scss +22 -0
  52. data/spec/fixtures/mixins/grid-column.scss +57 -0
  53. data/spec/fixtures/mixins/grid-container.scss +5 -0
  54. data/spec/fixtures/mixins/grid-push.scss +38 -0
  55. data/spec/fixtures/mixins/grid-shift.scss +38 -0
  56. data/spec/neat/functions/neat_column_default_spec.rb +35 -0
  57. data/spec/neat/functions/neat_column_width_spec.rb +47 -0
  58. data/spec/neat/functions/neat_parse_media_spec.rb +23 -0
  59. data/spec/neat/functions/retrieve_neat_settings_spec.rb +35 -0
  60. data/spec/neat/mixins/grid_column_spec.rb +101 -0
  61. data/spec/neat/mixins/grid_container_spec.rb +17 -0
  62. data/spec/neat/mixins/grid_push_spec.rb +59 -0
  63. data/spec/neat/mixins/grid_shift_spec.rb +59 -0
  64. data/spec/support/matchers/have_ruleset.rb +20 -0
  65. data/spec/support/matchers/have_value.rb +9 -7
  66. data/spec/support/parser_support.rb +8 -1
  67. data/spec/support/sass_support.rb +1 -1
  68. metadata +76 -153
  69. data/.rspec +0 -1
  70. data/.ruby-version +0 -1
  71. data/.travis.yml +0 -10
  72. data/app/assets/stylesheets/_neat-helpers.scss +0 -11
  73. data/app/assets/stylesheets/_neat.scss +0 -24
  74. data/app/assets/stylesheets/functions/_new-breakpoint.scss +0 -49
  75. data/app/assets/stylesheets/functions/_private.scss +0 -154
  76. data/app/assets/stylesheets/grid/_box-sizing.scss +0 -15
  77. data/app/assets/stylesheets/grid/_direction-context.scss +0 -33
  78. data/app/assets/stylesheets/grid/_display-context.scss +0 -28
  79. data/app/assets/stylesheets/grid/_fill-parent.scss +0 -22
  80. data/app/assets/stylesheets/grid/_media.scss +0 -92
  81. data/app/assets/stylesheets/grid/_omega.scss +0 -112
  82. data/app/assets/stylesheets/grid/_outer-container.scss +0 -34
  83. data/app/assets/stylesheets/grid/_pad.scss +0 -25
  84. data/app/assets/stylesheets/grid/_private.scss +0 -35
  85. data/app/assets/stylesheets/grid/_reset-display.scss +0 -14
  86. data/app/assets/stylesheets/grid/_row.scss +0 -45
  87. data/app/assets/stylesheets/grid/_shift.scss +0 -50
  88. data/app/assets/stylesheets/grid/_span-columns.scss +0 -94
  89. data/app/assets/stylesheets/grid/_to-deprecate.scss +0 -81
  90. data/app/assets/stylesheets/grid/_visual-grid.scss +0 -42
  91. data/app/assets/stylesheets/settings/_disable-warnings.scss +0 -13
  92. data/app/assets/stylesheets/settings/_grid.scss +0 -51
  93. data/app/assets/stylesheets/settings/_visual-grid.scss +0 -27
  94. data/lib/neat/engine.rb +0 -5
  95. data/lib/tasks/install.rake +0 -19
  96. data/sache.json +0 -5
  97. data/spec/neat/columns_spec.rb +0 -73
  98. data/spec/neat/container_spec.rb +0 -21
  99. data/spec/neat/default_spec.rb +0 -15
  100. data/spec/neat/direction_spec.rb +0 -19
  101. data/spec/neat/display_spec.rb +0 -19
  102. data/spec/neat/media_spec.rb +0 -55
  103. data/spec/neat/new_breakpoint_spec.rb +0 -17
  104. data/spec/neat/omega_spec.rb +0 -66
  105. data/spec/neat/pad_spec.rb +0 -32
  106. data/spec/neat/row_spec.rb +0 -39
  107. data/spec/neat/shift_spec.rb +0 -41
  108. data/test/_setup.scss +0 -2
  109. data/test/default.scss +0 -1
  110. data/test/direction-context.scss +0 -13
  111. data/test/display-context.scss +0 -15
  112. data/test/media.scss +0 -39
  113. data/test/new-breakpoint.scss +0 -13
  114. data/test/omega.scss +0 -29
  115. data/test/outer-container.scss +0 -11
  116. data/test/pad.scss +0 -17
  117. data/test/row.scss +0 -26
  118. data/test/shift.scss +0 -36
  119. data/test/span-columns.scss +0 -21
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
@@ -1 +0,0 @@
1
- 2.3.1
@@ -1,10 +0,0 @@
1
- language: ruby
2
- rvm: 2.0.0
3
- sudo: false
4
- branches:
5
- except:
6
- - gh-pages
7
- - gh-pages-dev
8
- notifications:
9
- slack:
10
- secure: ROE+Zo+A6JmTjxCRGG539YaoEcLrsInEIrTDQMgtn5ucLaiPiau96VO+GJ4MyxZm2M5qlSRMFCxb3jFexCRVZctuUF2hFcXVi6a/+JGhMmYLd6XMNezhlxWwOoSx6ufSAlrlXEalsdnkzqVHuH2Y50ao/3slNo58DdLoaRJiGAc=
@@ -1,11 +0,0 @@
1
- // Mixins
2
- @import "mixins/clearfix";
3
-
4
- // Functions
5
- @import "functions/private";
6
- @import "functions/new-breakpoint";
7
-
8
- // Settings
9
- @import "settings/grid";
10
- @import "settings/visual-grid";
11
- @import "settings/disable-warnings";
@@ -1,24 +0,0 @@
1
- // Neat 1.9.1
2
- // http://neat.bourbon.io
3
- // Copyright 2012-2015 thoughtbot, inc.
4
- // MIT License
5
-
6
- // Helpers
7
- @import "neat-helpers";
8
-
9
- // Grid
10
- @import "grid/private";
11
- @import "grid/box-sizing";
12
- @import "grid/omega";
13
- @import "grid/outer-container";
14
- @import "grid/span-columns";
15
- @import "grid/row";
16
- @import "grid/shift";
17
- @import "grid/pad";
18
- @import "grid/fill-parent";
19
- @import "grid/media";
20
- @import "grid/reset-display";
21
- @import "grid/to-deprecate";
22
- @import "grid/visual-grid";
23
- @import "grid/display-context";
24
- @import "grid/direction-context";
@@ -1,49 +0,0 @@
1
- @charset "UTF-8";
2
-
3
- /// Returns a media context (media query / grid context) that can be stored in a variable and passed to `media()` as a single-keyword argument. Media contexts defined using `new-breakpoint` are used by the visual grid, as long as they are defined before importing Neat.
4
- ///
5
- /// @param {List} $query
6
- /// A list of media query features and values. Each `$feature` should have a corresponding `$value`.
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`). For a list of valid values for `$feature`, click [here](http://www.w3.org/TR/css3-mediaqueries/#media1).
11
- ///
12
- /// @param {Number (unitless)} $total-columns [$grid-columns]
13
- /// - Number of columns to use in the new grid context. Can be set as a shorthand in the first parameter.
14
- ///
15
- /// @example scss - Usage
16
- /// $mobile: new-breakpoint(max-width 480px 4);
17
- ///
18
- /// .element {
19
- /// @include media($mobile) {
20
- /// @include span-columns(4);
21
- /// }
22
- /// }
23
- ///
24
- /// @example css - CSS Output
25
- /// @media screen and (max-width: 480px) {
26
- /// .element {
27
- /// display: block;
28
- /// float: left;
29
- /// margin-right: 7.42297%;
30
- /// width: 100%;
31
- /// }
32
- /// .element:last-child {
33
- /// margin-right: 0;
34
- /// }
35
- /// }
36
-
37
- @function new-breakpoint($query: $feature $value $columns, $total-columns: $grid-columns) {
38
- @if length($query) == 1 {
39
- $query: $default-feature nth($query, 1) $total-columns;
40
- } @else if is-even(length($query)) {
41
- $query: append($query, $total-columns);
42
- }
43
-
44
- @if is-not(belongs-to($query, $visual-grid-breakpoints)) {
45
- $visual-grid-breakpoints: append($visual-grid-breakpoints, $query, comma) !global;
46
- }
47
-
48
- @return $query;
49
- }
@@ -1,154 +0,0 @@
1
- // Not function for Libsass compatibility
2
- // https://github.com/sass/libsass/issues/368
3
- @function is-not($value) {
4
- @return if($value, false, true);
5
- }
6
-
7
- // Checks if a number is even
8
- @function is-even($int) {
9
- @return $int % 2 == 0;
10
- }
11
-
12
- // Checks if an element belongs to a list or not
13
- @function belongs-to($tested-item, $list) {
14
- @return is-not(not-belongs-to($tested-item, $list));
15
- }
16
-
17
- @function not-belongs-to($tested-item, $list) {
18
- @return is-not(index($list, $tested-item));
19
- }
20
-
21
- // Contains display value
22
- @function contains-display-value($query) {
23
- @return belongs-to(table, $query)
24
- or belongs-to(block, $query)
25
- or belongs-to(inline-block, $query)
26
- or belongs-to(inline, $query);
27
- }
28
-
29
- // Parses the first argument of span-columns()
30
- @function container-span($span: $span) {
31
- @if length($span) == 3 {
32
- $container-columns: nth($span, 3);
33
- @return $container-columns;
34
- } @else if length($span) == 2 {
35
- $container-columns: nth($span, 2);
36
- @return $container-columns;
37
- }
38
-
39
- @return $grid-columns;
40
- }
41
-
42
- @function container-shift($shift: $shift) {
43
- $parent-columns: $grid-columns !default !global;
44
-
45
- @if length($shift) == 3 {
46
- $container-columns: nth($shift, 3);
47
- @return $container-columns;
48
- } @else if length($shift) == 2 {
49
- $container-columns: nth($shift, 2);
50
- @return $container-columns;
51
- }
52
-
53
- @return $parent-columns;
54
- }
55
-
56
- // Generates a striped background
57
- @function gradient-stops($grid-columns, $color: $visual-grid-color) {
58
- $transparent: transparent;
59
- $alt-color: darken($color, 10%);
60
-
61
- $column-width: flex-grid(1, $grid-columns);
62
- $gutter-width: flex-gutter($grid-columns);
63
- $column-offset: $column-width;
64
- $alternate: false;
65
-
66
- $values: ($transparent 0, if($alternate, $color, $alt-color) 0);
67
-
68
- @for $i from 1 to $grid-columns*2 {
69
- @if is-even($i) {
70
- $values: append($values, $transparent $column-offset, comma);
71
- $values: append($values, if($alternate, $color, $alt-color) $column-offset, comma);
72
- $column-offset: $column-offset + $column-width;
73
- } @else {
74
- $values: append($values, if($alternate, $color, $alt-color) $column-offset, comma);
75
- $values: append($values, $transparent $column-offset, comma);
76
- $column-offset: $column-offset + $gutter-width;
77
-
78
- $alternate: not $alternate;
79
- }
80
- }
81
-
82
- @return $values;
83
- }
84
-
85
- // Layout direction
86
- @function get-direction($layout, $default) {
87
- $direction: null;
88
-
89
- @if to-upper-case($layout) == "LTR" or to-upper-case($layout) == "RTL" {
90
- $direction: direction-from-layout($layout);
91
- } @else {
92
- $direction: direction-from-layout($default);
93
- }
94
-
95
- @return $direction;
96
- }
97
-
98
- @function direction-from-layout($layout) {
99
- $direction: null;
100
-
101
- @if to-upper-case($layout) == "LTR" {
102
- $direction: right;
103
- } @else {
104
- $direction: left;
105
- }
106
-
107
- @return $direction;
108
- }
109
-
110
- @function get-opposite-direction($direction) {
111
- $opposite-direction: left;
112
-
113
- @if $direction == "left" {
114
- $opposite-direction: right;
115
- }
116
-
117
- @return $opposite-direction;
118
- }
119
-
120
-
121
- @function to-number($string) {
122
- $string: str-replace($string, " ", "");
123
- $strings: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9";
124
- $numbers: 0 1 2 3 4 5 6 7 8 9;
125
- $result: 0;
126
-
127
- @for $i from 1 through str-length($string) {
128
- $character: str-slice($string, $i, $i);
129
- $index: index($strings, $character);
130
-
131
- @if not $index {
132
- @warn "Unknown character `#{$character}`.";
133
- @return false;
134
- }
135
-
136
- $number: nth($numbers, $index);
137
- $result: $result * 10 + $number;
138
- }
139
-
140
- @return $result;
141
- }
142
-
143
- @function str-replace($string, $search, $replace: "") {
144
- $index: str-index($string, $search);
145
-
146
- @if $index {
147
- $first: str-slice($string, 1, $index - 1);
148
- $last-slice: str-slice($string, $index + str-length($search));
149
- $last: str-replace($last-slice, $search, $replace);
150
- @return $first + $replace + $last;
151
- }
152
-
153
- @return $string;
154
- }
@@ -1,15 +0,0 @@
1
- @charset "UTF-8";
2
-
3
- @if $border-box-sizing == true {
4
- html { // http://bit.ly/1qk2tVR
5
- box-sizing: border-box;
6
- }
7
-
8
- * {
9
- &,
10
- &::after,
11
- &::before {
12
- box-sizing: inherit;
13
- }
14
- }
15
- }
@@ -1,33 +0,0 @@
1
- @charset "UTF-8";
2
-
3
- /// Changes the direction property used by other mixins called in the code block argument.
4
- ///
5
- /// @param {String} $direction [left-to-right]
6
- /// Layout direction to be used within the block. Can be `left-to-right` or `right-to-left`.
7
- ///
8
- /// @example scss - Usage
9
- /// @include direction-context(right-to-left) {
10
- /// .right-to-left-block {
11
- /// @include span-columns(6);
12
- /// }
13
- /// }
14
- ///
15
- /// @example css - CSS Output
16
- /// .right-to-left-block {
17
- /// float: right;
18
- /// ...
19
- /// }
20
-
21
- @mixin direction-context($direction: left-to-right) {
22
- $scope-direction: $layout-direction;
23
-
24
- @if to-lower-case($direction) == "left-to-right" {
25
- $layout-direction: LTR !global;
26
- } @else if to-lower-case($direction) == "right-to-left" {
27
- $layout-direction: RTL !global;
28
- }
29
-
30
- @content;
31
-
32
- $layout-direction: $scope-direction !global;
33
- }
@@ -1,28 +0,0 @@
1
- @charset "UTF-8";
2
-
3
- /// Changes the display property used by other mixins called in the code block argument.
4
- ///
5
- /// @param {String} $display [block]
6
- /// Display value to be used within the block. Can be `table` or `block`.
7
- ///
8
- /// @example scss
9
- /// @include display-context(table) {
10
- /// .display-table {
11
- /// @include span-columns(6);
12
- /// }
13
- /// }
14
- ///
15
- /// @example css
16
- /// .display-table {
17
- /// display: table-cell;
18
- /// ...
19
- /// }
20
-
21
- @mixin display-context($display: block) {
22
- $scope-display: $container-display-table;
23
- $container-display-table: $display == table !global;
24
-
25
- @content;
26
-
27
- $container-display-table: $scope-display !global;
28
- }
@@ -1,22 +0,0 @@
1
- @charset "UTF-8";
2
-
3
- /// Forces the element to fill its parent container.
4
- ///
5
- /// @example scss - Usage
6
- /// .element {
7
- /// @include fill-parent;
8
- /// }
9
- ///
10
- /// @example css - CSS Output
11
- /// .element {
12
- /// width: 100%;
13
- /// box-sizing: border-box;
14
- /// }
15
-
16
- @mixin fill-parent() {
17
- width: 100%;
18
-
19
- @if $border-box-sizing == false {
20
- box-sizing: border-box;
21
- }
22
- }
@@ -1,92 +0,0 @@
1
- @charset "UTF-8";
2
-
3
- /// Outputs a media-query block with an optional grid context (the total number of columns used in the grid).
4
- ///
5
- /// @param {List} $query
6
- /// A list of media query features and values, where each `$feature` should have a corresponding `$value`.
7
- /// For a list of valid values for `$feature`, click [here](http://www.w3.org/TR/css3-mediaqueries/#media1).
8
- ///
9
- /// If there is only a single `$value` in `$query`, `$default-feature` is going to be used.
10
- ///
11
- /// The number of total columns in the grid can be set by passing `$columns` at the end of the list (overrides `$total-columns`).
12
- ///
13
- ///
14
- /// @param {Number (unitless)} $total-columns [$grid-columns]
15
- /// - Number of columns to use in the new grid context. Can be set as a shorthand in the first parameter.
16
- ///
17
- /// @example scss - Usage
18
- /// .responsive-element {
19
- /// @include media(769px) {
20
- /// @include span-columns(6);
21
- /// }
22
- /// }
23
- ///
24
- /// .new-context-element {
25
- /// @include media(min-width 320px max-width 480px, 6) {
26
- /// @include span-columns(6);
27
- /// }
28
- /// }
29
- ///
30
- /// @example css - CSS Output
31
- /// @media screen and (min-width: 769px) {
32
- /// .responsive-element {
33
- /// display: block;
34
- /// float: left;
35
- /// margin-right: 2.35765%;
36
- /// width: 48.82117%;
37
- /// }
38
- ///
39
- /// .responsive-element:last-child {
40
- /// margin-right: 0;
41
- /// }
42
- /// }
43
- ///
44
- /// @media screen and (min-width: 320px) and (max-width: 480px) {
45
- /// .new-context-element {
46
- /// display: block;
47
- /// float: left;
48
- /// margin-right: 4.82916%;
49
- /// width: 100%;
50
- /// }
51
- ///
52
- /// .new-context-element:last-child {
53
- /// margin-right: 0;
54
- /// }
55
- /// }
56
-
57
- @mixin media($query: $feature $value $columns, $total-columns: $grid-columns) {
58
- @if length($query) == 1 {
59
- @media screen and ($default-feature: nth($query, 1)) {
60
- $default-grid-columns: $grid-columns;
61
- $grid-columns: $total-columns !global;
62
- @content;
63
- $grid-columns: $default-grid-columns !global;
64
- }
65
- } @else {
66
- $loop-to: length($query);
67
- $media-query: "screen and ";
68
- $default-grid-columns: $grid-columns;
69
- $grid-columns: $total-columns !global;
70
-
71
- @if is-not(is-even(length($query))) {
72
- $grid-columns: nth($query, $loop-to) !global;
73
- $loop-to: $loop-to - 1;
74
- }
75
-
76
- $i: 1;
77
- @while $i <= $loop-to {
78
- $media-query: $media-query + "(" + nth($query, $i) + ": " + nth($query, $i + 1) + ") ";
79
-
80
- @if ($i + 1) != $loop-to {
81
- $media-query: $media-query + "and ";
82
- }
83
-
84
- $i: $i + 2;
85
- }
86
-
87
- @media #{$media-query} {
88
- @content;
89
- $grid-columns: $default-grid-columns !global;
90
- }
91
- }
92
- }