neat 1.7.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.circleci/config.yml +34 -0
- data/.github/ISSUE_TEMPLATE.md +22 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +8 -0
- data/.gitignore +4 -2
- data/.hound.yml +5 -0
- data/.npmignore +20 -0
- data/.scss-lint.yml +239 -0
- data/.tool-versions +2 -0
- data/CHANGELOG.md +388 -0
- data/CODE_OF_CONDUCT.md +6 -0
- data/CONTRIBUTING.md +16 -1
- data/Gemfile +1 -2
- data/Gulpfile.js +42 -0
- data/{LICENSE → LICENSE.md} +8 -10
- data/README.md +138 -214
- data/RELEASING.md +27 -0
- data/Rakefile +3 -17
- data/bin/neat +2 -2
- data/contrib/base/_variables.scss +8 -0
- data/contrib/index.html +90 -0
- data/contrib/patterns/_box.scss +11 -0
- data/contrib/patterns/_global.scss +32 -0
- data/contrib/patterns/_grid-collapse.scss +3 -0
- data/contrib/patterns/_grid-media.scss +36 -0
- data/contrib/patterns/_grid-nested.scss +12 -0
- data/contrib/patterns/_grid-push.scss +7 -0
- data/contrib/patterns/_grid-shift.scss +7 -0
- data/contrib/patterns/_grid-visual.scss +3 -0
- data/contrib/patterns/_grid.scss +39 -0
- data/contrib/styles.scss +13 -0
- data/core/_neat.scss +26 -0
- data/core/neat/functions/_neat-append-grid-visual.scss +21 -0
- data/core/neat/functions/_neat-column-default.scss +23 -0
- data/core/neat/functions/_neat-column-ratio.scss +24 -0
- data/core/neat/functions/_neat-column-width.scss +25 -0
- data/core/neat/functions/_neat-float-direction.scss +22 -0
- data/core/neat/functions/_neat-merge-defaults.scss +23 -0
- data/core/neat/functions/_neat-opposite-direction.scss +22 -0
- data/core/neat/functions/_neat-parse-columns.scss +22 -0
- data/core/neat/functions/_neat-parse-media.scss +20 -0
- data/core/neat/functions/_retrieve-neat-settings.scss +19 -0
- data/core/neat/mixins/_grid-collapse.scss +35 -0
- data/core/neat/mixins/_grid-column.scss +39 -0
- data/core/neat/mixins/_grid-container.scss +31 -0
- data/core/neat/mixins/_grid-media.scss +88 -0
- data/core/neat/mixins/_grid-push.scss +37 -0
- data/core/neat/mixins/_grid-shift.scss +36 -0
- data/core/neat/mixins/_grid-visual.scss +41 -0
- data/core/neat/settings/_settings.scss +74 -0
- data/eyeglass-exports.js +7 -0
- data/index.js +7 -0
- data/lib/neat/generator.rb +43 -26
- data/lib/neat/version.rb +1 -1
- data/lib/neat.rb +6 -11
- data/neat.gemspec +26 -31
- data/package-lock.json +5960 -0
- data/package.json +47 -0
- data/spec/.keep +0 -0
- data/spec/fixtures/_setup.scss +1 -0
- data/spec/fixtures/functions/neat-column-default.scss +22 -0
- data/spec/fixtures/functions/neat-column-width.scss +30 -0
- data/spec/fixtures/functions/neat-float-direction.scss +17 -0
- data/spec/fixtures/functions/neat-opposite-direction.scss +17 -0
- data/spec/fixtures/functions/neat-parse-media.scss +9 -0
- data/spec/fixtures/functions/retrieve-neat-settings.scss +22 -0
- data/spec/fixtures/mixins/grid-collapse.scss +14 -0
- data/spec/fixtures/mixins/grid-column.scss +57 -0
- data/spec/fixtures/mixins/grid-container.scss +5 -0
- data/spec/fixtures/mixins/grid-media.scss +45 -0
- data/spec/fixtures/mixins/grid-push.scss +38 -0
- data/spec/fixtures/mixins/grid-shift.scss +38 -0
- data/spec/neat/functions/neat_column_default_spec.rb +35 -0
- data/spec/neat/functions/neat_column_width_spec.rb +47 -0
- data/spec/neat/functions/neat_float_direction_spec.rb +23 -0
- data/spec/neat/functions/neat_opposite_direction_spec.rb +23 -0
- data/spec/neat/functions/neat_parse_media_spec.rb +23 -0
- data/spec/neat/functions/retrieve_neat_settings_spec.rb +35 -0
- data/spec/neat/mixins/grid_collapse_spec.rb +26 -0
- data/spec/neat/mixins/grid_column_spec.rb +101 -0
- data/spec/neat/mixins/grid_container_spec.rb +17 -0
- data/spec/neat/mixins/grid_media_spec.rb +39 -0
- data/spec/neat/mixins/grid_push_spec.rb +59 -0
- data/spec/neat/mixins/grid_shift_spec.rb +59 -0
- data/spec/spec_helper.rb +5 -8
- data/spec/support/matchers/be_contained_in.rb +1 -1
- data/spec/support/matchers/have_rule.rb +8 -6
- data/spec/support/matchers/have_ruleset.rb +20 -0
- data/spec/support/matchers/have_value.rb +9 -7
- data/spec/support/parser_support.rb +8 -1
- data/spec/support/sass_support.rb +3 -3
- metadata +98 -148
- data/.rspec +0 -2
- data/.travis.yml +0 -5
- data/NEWS.md +0 -47
- data/app/assets/stylesheets/_neat-helpers.scss +0 -8
- data/app/assets/stylesheets/_neat.scss +0 -23
- data/app/assets/stylesheets/functions/_new-breakpoint.scss +0 -49
- data/app/assets/stylesheets/functions/_private.scss +0 -108
- data/app/assets/stylesheets/grid/_box-sizing.scss +0 -11
- data/app/assets/stylesheets/grid/_direction-context.scss +0 -31
- data/app/assets/stylesheets/grid/_display-context.scss +0 -26
- data/app/assets/stylesheets/grid/_fill-parent.scss +0 -22
- data/app/assets/stylesheets/grid/_media.scss +0 -92
- data/app/assets/stylesheets/grid/_omega.scss +0 -91
- data/app/assets/stylesheets/grid/_outer-container.scss +0 -36
- data/app/assets/stylesheets/grid/_pad.scss +0 -23
- data/app/assets/stylesheets/grid/_private.scss +0 -35
- data/app/assets/stylesheets/grid/_row.scss +0 -53
- data/app/assets/stylesheets/grid/_shift.scss +0 -48
- data/app/assets/stylesheets/grid/_span-columns.scss +0 -90
- data/app/assets/stylesheets/grid/_to-deprecate.scss +0 -105
- data/app/assets/stylesheets/grid/_visual-grid.scss +0 -40
- data/app/assets/stylesheets/settings/_disable-warnings.scss +0 -11
- data/app/assets/stylesheets/settings/_grid.scss +0 -53
- data/app/assets/stylesheets/settings/_visual-grid.scss +0 -25
- data/bower.json +0 -22
- data/lib/neat/engine.rb +0 -5
- data/lib/tasks/install.rake +0 -21
- data/sache.json +0 -5
- data/spec/neat/columns_spec.rb +0 -73
- data/spec/neat/container_spec.rb +0 -21
- data/spec/neat/default_spec.rb +0 -15
- data/spec/neat/direction_spec.rb +0 -19
- data/spec/neat/display_spec.rb +0 -19
- data/spec/neat/media_spec.rb +0 -55
- data/spec/neat/new_breakpoint_spec.rb +0 -17
- data/spec/neat/omega_spec.rb +0 -43
- data/spec/neat/pad_spec.rb +0 -32
- data/spec/neat/row_spec.rb +0 -39
- data/spec/neat/shift_spec.rb +0 -41
- data/spec/support/bourbon_support.rb +0 -9
- data/test/_setup.scss +0 -3
- data/test/default.scss +0 -1
- data/test/direction-context.scss +0 -13
- data/test/display-context.scss +0 -15
- data/test/media.scss +0 -39
- data/test/new-breakpoint.scss +0 -13
- data/test/omega.scss +0 -25
- data/test/outer-container.scss +0 -11
- data/test/pad.scss +0 -17
- data/test/row.scss +0 -26
- data/test/shift.scss +0 -36
- data/test/span-columns.scss +0 -21
@@ -0,0 +1,36 @@
|
|
1
|
+
$medium-screen: 1000px;
|
2
|
+
|
3
|
+
$custom-neat-grid: (
|
4
|
+
columns: 12,
|
5
|
+
gutter: 50px,
|
6
|
+
media: $medium-screen,
|
7
|
+
);
|
8
|
+
|
9
|
+
$specific-neat-grid: (
|
10
|
+
columns: 12,
|
11
|
+
gutter: 80px,
|
12
|
+
media: "only screen and (min-width: 1000px) and (max-width: 1100px)",
|
13
|
+
);
|
14
|
+
|
15
|
+
|
16
|
+
$print-neat-grid: (
|
17
|
+
columns: 10,
|
18
|
+
gutter: 20px,
|
19
|
+
media: print,
|
20
|
+
);
|
21
|
+
|
22
|
+
.grid-column--media-3-to-6 {
|
23
|
+
@include grid-column(3);
|
24
|
+
|
25
|
+
&::before {
|
26
|
+
content: "#{map-get($neat-grid, media)}";
|
27
|
+
}
|
28
|
+
|
29
|
+
@include grid-media($custom-neat-grid, $specific-neat-grid, $print-neat-grid) {
|
30
|
+
@include grid-column(6);
|
31
|
+
|
32
|
+
&::before {
|
33
|
+
content: "#{map-get($neat-grid, media)}";
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
$grid--rtl: (
|
2
|
+
direction: rtl,
|
3
|
+
);
|
4
|
+
|
5
|
+
.grid {
|
6
|
+
@include grid-container;
|
7
|
+
}
|
8
|
+
|
9
|
+
.grid__column {
|
10
|
+
@include grid-column(1);
|
11
|
+
}
|
12
|
+
|
13
|
+
.grid__column--thirds {
|
14
|
+
@include grid-column(4);
|
15
|
+
}
|
16
|
+
|
17
|
+
.grid--rtl__column--thirds {
|
18
|
+
@include grid-column(4, $grid--rtl);
|
19
|
+
}
|
20
|
+
|
21
|
+
.grid__column--4 {
|
22
|
+
@include grid-column(4);
|
23
|
+
}
|
24
|
+
|
25
|
+
.grid__column--8 {
|
26
|
+
@include grid-column(8);
|
27
|
+
}
|
28
|
+
|
29
|
+
.grid__column--full {
|
30
|
+
@include grid-column(12);
|
31
|
+
}
|
32
|
+
|
33
|
+
.grid__column--3-of-5 {
|
34
|
+
@include grid-column(3 of 5);
|
35
|
+
}
|
36
|
+
|
37
|
+
.grid__column--2-of-5 {
|
38
|
+
@include grid-column(2 of 5);
|
39
|
+
}
|
data/contrib/styles.scss
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
@import "../core/neat";
|
2
|
+
|
3
|
+
@import "base/variables";
|
4
|
+
|
5
|
+
@import "patterns/box";
|
6
|
+
@import "patterns/global";
|
7
|
+
@import "patterns/grid";
|
8
|
+
@import "patterns/grid-collapse";
|
9
|
+
@import "patterns/grid-nested";
|
10
|
+
@import "patterns/grid-push";
|
11
|
+
@import "patterns/grid-shift";
|
12
|
+
@import "patterns/grid-media";
|
13
|
+
@import "patterns/grid-visual";
|
data/core/_neat.scss
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
// Neat 4.0.0
|
3
|
+
// http://neat.bourbon.io
|
4
|
+
// Copyright 2012 thoughtbot, inc.
|
5
|
+
// MIT License
|
6
|
+
|
7
|
+
@import "neat/settings/settings";
|
8
|
+
|
9
|
+
@import "neat/functions/retrieve-neat-settings";
|
10
|
+
@import "neat/functions/neat-column-default";
|
11
|
+
@import "neat/functions/neat-column-width";
|
12
|
+
@import "neat/functions/neat-column-ratio";
|
13
|
+
@import "neat/functions/neat-float-direction";
|
14
|
+
@import "neat/functions/neat-merge-defaults";
|
15
|
+
@import "neat/functions/neat-opposite-direction";
|
16
|
+
@import "neat/functions/neat-parse-columns";
|
17
|
+
@import "neat/functions/neat-parse-media";
|
18
|
+
@import "neat/functions/neat-append-grid-visual";
|
19
|
+
|
20
|
+
@import "neat/mixins/grid-collapse";
|
21
|
+
@import "neat/mixins/grid-column";
|
22
|
+
@import "neat/mixins/grid-container";
|
23
|
+
@import "neat/mixins/grid-media";
|
24
|
+
@import "neat/mixins/grid-push";
|
25
|
+
@import "neat/mixins/grid-shift";
|
26
|
+
@import "neat/mixins/grid-visual";
|
@@ -0,0 +1,21 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Append attributes to a the `$_grid-visual` variable in `grid-visual` mixin
|
3
|
+
///
|
4
|
+
/// @argument {map} $grid
|
5
|
+
///
|
6
|
+
/// @argument {number (unitless) | null} $columns
|
7
|
+
///
|
8
|
+
/// @return {number}
|
9
|
+
///
|
10
|
+
/// @example scss
|
11
|
+
/// _neat-column-default($neat-grid, 4)
|
12
|
+
///
|
13
|
+
/// @access private
|
14
|
+
|
15
|
+
@function _neat-append-grid-visual($grid-visual-list, $attributes) {
|
16
|
+
@each $attribute in $attributes {
|
17
|
+
$grid-visual-list: append($grid-visual-list, $attribute, comma);
|
18
|
+
}
|
19
|
+
|
20
|
+
@return $grid-visual-list;
|
21
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Determine if a column count has been given.
|
3
|
+
/// If no columns have been given return the grid's total column count.
|
4
|
+
///
|
5
|
+
/// @argument {map} $grid
|
6
|
+
///
|
7
|
+
/// @argument {number (unitless) | null} $columns
|
8
|
+
///
|
9
|
+
/// @return {number}
|
10
|
+
///
|
11
|
+
/// @example scss
|
12
|
+
/// _neat-column-default($neat-grid, 4)
|
13
|
+
///
|
14
|
+
/// @access private
|
15
|
+
|
16
|
+
@function _neat-column-default($grid, $columns) {
|
17
|
+
@if $columns == null {
|
18
|
+
$_grid-columns: _retrieve-neat-setting($grid, columns);
|
19
|
+
@return $_grid-columns;
|
20
|
+
} @else {
|
21
|
+
@return $columns;
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Determine the ratio of `$columns` to the total column count.
|
3
|
+
/// If `$columns` is more than one value, they are handed to
|
4
|
+
/// `_neat-parse-columns()` which will determine the total columns and use this
|
5
|
+
/// value instead of `total-columns`.
|
6
|
+
///
|
7
|
+
/// @argument {map} $grid
|
8
|
+
///
|
9
|
+
/// @argument {number | list} $columns
|
10
|
+
///
|
11
|
+
/// @return {number}
|
12
|
+
///
|
13
|
+
/// @example scss
|
14
|
+
/// _neat-column-ratio($grid, 3)
|
15
|
+
///
|
16
|
+
/// @access private
|
17
|
+
|
18
|
+
@function _neat-column-ratio($grid, $columns) {
|
19
|
+
@if length($columns) > 1 {
|
20
|
+
@return nth($columns, 1) / _neat-parse-columns($columns);
|
21
|
+
} @else if $columns {
|
22
|
+
@return $columns / _retrieve-neat-setting($grid, columns);
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Return a calulated column width that can then be passed in to a `calc()`.
|
3
|
+
///
|
4
|
+
/// @argument {map} $grid
|
5
|
+
///
|
6
|
+
/// @argument {number} $columns
|
7
|
+
///
|
8
|
+
/// @return {string}
|
9
|
+
///
|
10
|
+
/// @example scss
|
11
|
+
/// _neat-column-width($neat-grid, 4)
|
12
|
+
///
|
13
|
+
/// @access private
|
14
|
+
|
15
|
+
@function _neat-column-width($grid, $columns) {
|
16
|
+
$_column-ratio: _neat-column-ratio($grid, $columns);
|
17
|
+
$_gutter: _retrieve-neat-setting($grid, gutter);
|
18
|
+
|
19
|
+
@if $_gutter == 0 {
|
20
|
+
@return unquote("#{percentage($_column-ratio)}");
|
21
|
+
} @else {
|
22
|
+
$_gutter-affordance: $_gutter + ($_gutter * $_column-ratio);
|
23
|
+
@return unquote("#{percentage($_column-ratio)} - #{$_gutter-affordance}");
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Return the float direction of the grid.
|
3
|
+
///
|
4
|
+
/// @argument {map} $grid
|
5
|
+
///
|
6
|
+
/// @return {string}
|
7
|
+
///
|
8
|
+
/// @example scss
|
9
|
+
/// _neat-float-direction($neat-grid)
|
10
|
+
///
|
11
|
+
/// @access private
|
12
|
+
|
13
|
+
@function _neat-float-direction($grid) {
|
14
|
+
$_direction: _retrieve-neat-setting($grid, direction);
|
15
|
+
$_float-direction: null;
|
16
|
+
@if $_direction == "ltr" {
|
17
|
+
$_float-direction: left;
|
18
|
+
} @else if $_direction == "rtl" {
|
19
|
+
$_float-direction: right;
|
20
|
+
}
|
21
|
+
@return $_float-direction;
|
22
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Apply Neat's default properties to undefined values within a map.
|
3
|
+
///
|
4
|
+
/// @argument {map} $grid
|
5
|
+
///
|
6
|
+
/// @return {map}
|
7
|
+
///
|
8
|
+
/// @example scss
|
9
|
+
/// _retrieve-neat-setting($neat-grid)
|
10
|
+
///
|
11
|
+
/// @access private
|
12
|
+
|
13
|
+
@function _neat-merge-defaults($grid) {
|
14
|
+
$_merged-grid: map-merge((
|
15
|
+
columns: 12,
|
16
|
+
gutter: 20px,
|
17
|
+
media: null,
|
18
|
+
color: rgba(#00d4ff, 0.25),
|
19
|
+
direction: ltr,
|
20
|
+
), $grid);
|
21
|
+
|
22
|
+
@return $_merged-grid;
|
23
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Return the oppoite of the float direction of the grid.
|
3
|
+
///
|
4
|
+
/// @argument {map} $grid
|
5
|
+
///
|
6
|
+
/// @return {string}
|
7
|
+
///
|
8
|
+
/// @example scss
|
9
|
+
/// _neat-opposite-direction($neat-grid)
|
10
|
+
///
|
11
|
+
/// @access private
|
12
|
+
|
13
|
+
@function _neat-opposite-direction($grid) {
|
14
|
+
$_direction: _retrieve-neat-setting($grid, direction);
|
15
|
+
$_float-direction: null;
|
16
|
+
@if $_direction == "ltr" {
|
17
|
+
$_float-direction: right;
|
18
|
+
} @else if $_direction == "rtl" {
|
19
|
+
$_float-direction: left;
|
20
|
+
}
|
21
|
+
@return $_float-direction;
|
22
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Parse a column count like `3 of 5` and retur the total coloumn count.
|
3
|
+
/// This is to allow a shorthand for custom grids without using a settings map.
|
4
|
+
///
|
5
|
+
///
|
6
|
+
/// @argument {list} $span
|
7
|
+
///
|
8
|
+
/// @return {number}
|
9
|
+
///
|
10
|
+
/// @example scss
|
11
|
+
/// _neat-parse-columns(3 of 5)
|
12
|
+
///
|
13
|
+
/// @access private
|
14
|
+
|
15
|
+
@function _neat-parse-columns($span) {
|
16
|
+
@if length($span) == 3 {
|
17
|
+
$_total-columns: nth($span, 3);
|
18
|
+
@return $_total-columns;
|
19
|
+
} @else if (length($span) == 2) or (length($span) >= 3) {
|
20
|
+
@error "`$column` should contain 2 values, seperated by an `of`";
|
21
|
+
}
|
22
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Parse media types. If the property is a string then return it, otherwise
|
3
|
+
/// assume screen and min-width.
|
4
|
+
///
|
5
|
+
/// @argument {string | number (with unit)} $media
|
6
|
+
///
|
7
|
+
/// @return {number}
|
8
|
+
///
|
9
|
+
/// @example scss
|
10
|
+
/// _neat-parse-media($grid, 1000px)
|
11
|
+
///
|
12
|
+
/// @access private
|
13
|
+
|
14
|
+
@function _neat-parse-media($media) {
|
15
|
+
@if type-of($media) == number {
|
16
|
+
@return "only screen and (min-width: #{$media})";
|
17
|
+
} @else if type-of($media) == string {
|
18
|
+
@return "#{$media}";
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// This function recives a grid map and merges it with Neat's defauls.
|
3
|
+
/// It then returns the value of the property that has been passed to it.
|
4
|
+
///
|
5
|
+
/// @argument {map} $grid
|
6
|
+
///
|
7
|
+
/// @argument {string} $setting
|
8
|
+
///
|
9
|
+
/// @return {boolean | color | list | number | string}
|
10
|
+
///
|
11
|
+
/// @example scss
|
12
|
+
/// _retrieve-neat-setting($neat-grid, columns)
|
13
|
+
///
|
14
|
+
/// @access private
|
15
|
+
|
16
|
+
@function _retrieve-neat-setting($grid, $setting) {
|
17
|
+
$_grid-settings: map-merge(_neat-merge-defaults($neat-grid), $grid);
|
18
|
+
@return map-get($_grid-settings, $setting);
|
19
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Creates collapsed grid object that consumes the gutters of its container,
|
3
|
+
/// for use in nested layouts.
|
4
|
+
///
|
5
|
+
/// @group features
|
6
|
+
///
|
7
|
+
/// @name Grid collapse
|
8
|
+
///
|
9
|
+
/// @argument {map} $grid [$neat-grid]
|
10
|
+
/// The grid to be used to generate the collapsed container.
|
11
|
+
/// By default, the global `$neat-grid` will be used.
|
12
|
+
///
|
13
|
+
/// @example scss
|
14
|
+
/// .element {
|
15
|
+
/// @include grid-collapse;
|
16
|
+
/// }
|
17
|
+
///
|
18
|
+
/// @example css
|
19
|
+
/// .element {
|
20
|
+
/// margin-left: -20px;
|
21
|
+
/// margin-right: -20px;
|
22
|
+
/// width: calc(100% + 40px);
|
23
|
+
/// }
|
24
|
+
|
25
|
+
@mixin grid-collapse($grid: $neat-grid) {
|
26
|
+
$_grid-gutter: _retrieve-neat-setting($grid, gutter);
|
27
|
+
|
28
|
+
@if unit($_grid-gutter) == "%" {
|
29
|
+
@warn "`grid-collapse` is not compatible with percentage based gutters.";
|
30
|
+
}
|
31
|
+
|
32
|
+
margin-#{_neat-float-direction($grid)}: -($_grid-gutter);
|
33
|
+
margin-#{_neat-opposite-direction($grid)}: -($_grid-gutter);
|
34
|
+
width: calc(100% + #{($_grid-gutter * 2)});
|
35
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Creates a grid column of requested size.
|
3
|
+
///
|
4
|
+
/// @group features
|
5
|
+
///
|
6
|
+
/// @name Grid column
|
7
|
+
///
|
8
|
+
/// @argument {number (unitless)} $columns [null]
|
9
|
+
/// Specifies the number of columns an element should span based on the total
|
10
|
+
/// columns of the grid.
|
11
|
+
///
|
12
|
+
/// This can also be defined in a shorthand syntax which also contains the
|
13
|
+
/// total column count such as `3 of 5`.
|
14
|
+
///
|
15
|
+
/// @argument {map} $grid [$neat-grid]
|
16
|
+
/// The grid to be used to generate the column.
|
17
|
+
/// By default, the global `$neat-grid` will be used.
|
18
|
+
///
|
19
|
+
/// @example scss
|
20
|
+
/// .element {
|
21
|
+
/// @include grid-column(3);
|
22
|
+
/// }
|
23
|
+
///
|
24
|
+
/// @example css
|
25
|
+
/// .element {
|
26
|
+
/// width: calc(25% - 25px);
|
27
|
+
/// float: left;
|
28
|
+
/// margin-left: 20px;
|
29
|
+
/// }
|
30
|
+
|
31
|
+
@mixin grid-column($columns: null, $grid: $neat-grid) {
|
32
|
+
$columns: _neat-column-default($grid, $columns);
|
33
|
+
$_grid-columns: _retrieve-neat-setting($grid, columns);
|
34
|
+
$_grid-gutter: _retrieve-neat-setting($grid, gutter);
|
35
|
+
|
36
|
+
width: calc(#{_neat-column-width($grid, $columns)});
|
37
|
+
float: _neat-float-direction($grid);
|
38
|
+
margin-#{_neat-float-direction($grid)}: $_grid-gutter;
|
39
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Creates a grid container with clearfix.
|
3
|
+
///
|
4
|
+
/// @group features
|
5
|
+
///
|
6
|
+
/// @name Grid container
|
7
|
+
///
|
8
|
+
/// @example scss
|
9
|
+
/// .element {
|
10
|
+
/// @include grid-container;
|
11
|
+
/// }
|
12
|
+
///
|
13
|
+
/// @example css
|
14
|
+
/// .element::after {
|
15
|
+
/// clear: both;
|
16
|
+
/// content: "";
|
17
|
+
/// display: block;
|
18
|
+
/// }
|
19
|
+
|
20
|
+
@mixin grid-container($grid: $neat-grid) {
|
21
|
+
@if $grid != $neat-grid {
|
22
|
+
@warn "`grid-container` does not use grid properties. " +
|
23
|
+
"Custom grids do not need to be passed in to this mixin.";
|
24
|
+
}
|
25
|
+
|
26
|
+
&::after {
|
27
|
+
clear: both;
|
28
|
+
content: "";
|
29
|
+
display: block;
|
30
|
+
}
|
31
|
+
}
|
@@ -0,0 +1,88 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// `grid-media` allows you to change your layout based on a media query.
|
3
|
+
/// For example, an object can span 3 columns on small screens and 6 columns
|
4
|
+
/// on large screens.
|
5
|
+
///
|
6
|
+
/// You can take this a step further and set different grid attributes like
|
7
|
+
/// gutter size and total column count for each media query. So, for example,
|
8
|
+
/// you can have a `1rem` gutter on small screens, and a `2rem` gutter on large
|
9
|
+
/// screens.
|
10
|
+
///
|
11
|
+
/// @group features
|
12
|
+
///
|
13
|
+
/// @name Grid media
|
14
|
+
///
|
15
|
+
/// @argument {map} $grid
|
16
|
+
/// The grid or grids to be used within the scope of the block.
|
17
|
+
/// These grids should include the `media` property to determine the expression
|
18
|
+
/// for the media query.
|
19
|
+
///
|
20
|
+
/// @content
|
21
|
+
/// Grid media will temporarily override the default grid with the attributes
|
22
|
+
/// of the custom grids. When `grid-media` is given a custom grid, it will
|
23
|
+
/// apply that grid to any of other Neat mixins within the `grid-media` block
|
24
|
+
/// (`{…}`). Once the mixin block has ended the default grid will revert to
|
25
|
+
/// its original state as defined by `$neat-grid`. This allows for different
|
26
|
+
/// gutter width and column count based on screen size or other properties.
|
27
|
+
///
|
28
|
+
/// If multiple grids are passed in to `grid-media`, it will loop through the
|
29
|
+
/// contents of the block, quickly allowing you to apply multiple grids in a
|
30
|
+
/// single mixin.
|
31
|
+
///
|
32
|
+
/// @example scss
|
33
|
+
/// $custom-neat-grid: (
|
34
|
+
/// columns: 12,
|
35
|
+
/// gutter: 50px,
|
36
|
+
/// media: "screen and (max-width: 999px)",
|
37
|
+
/// );
|
38
|
+
///
|
39
|
+
/// $custom-neat-grid-2: (
|
40
|
+
/// columns: 12,
|
41
|
+
/// gutter: 70px,
|
42
|
+
/// media: 1000px,
|
43
|
+
/// );
|
44
|
+
///
|
45
|
+
/// .element {
|
46
|
+
/// @include grid-column(3);
|
47
|
+
///
|
48
|
+
/// @include grid-media($custom-neat-grid, $custom-neat-grid-2){
|
49
|
+
/// @include grid-column(6);
|
50
|
+
/// }
|
51
|
+
/// }
|
52
|
+
///
|
53
|
+
/// @example css
|
54
|
+
/// .element {
|
55
|
+
/// width: calc(25% - 25px);
|
56
|
+
/// float: left;
|
57
|
+
/// margin-left: 20px;
|
58
|
+
/// }
|
59
|
+
///
|
60
|
+
/// @media only screen and (max-width: 999px) {
|
61
|
+
/// .element {
|
62
|
+
/// width: calc(50% - 75px);
|
63
|
+
/// float: left;
|
64
|
+
/// margin-left: 50px;
|
65
|
+
/// }
|
66
|
+
/// }
|
67
|
+
///
|
68
|
+
/// @media only screen and (min-width: 1000px) {
|
69
|
+
/// .element {
|
70
|
+
/// width: calc(50% - 75px);
|
71
|
+
/// float: left;
|
72
|
+
/// margin-left: 70px;
|
73
|
+
/// }
|
74
|
+
/// }
|
75
|
+
|
76
|
+
@mixin grid-media($grids...) {
|
77
|
+
@each $_grid in $grids {
|
78
|
+
$_media: _retrieve-neat-setting($_grid, media);
|
79
|
+
$_query: _neat-parse-media($_media);
|
80
|
+
|
81
|
+
@media #{$_query} {
|
82
|
+
$_default-neat-grid: $neat-grid;
|
83
|
+
$neat-grid: map-merge($neat-grid, $_grid) !global;
|
84
|
+
@content;
|
85
|
+
$neat-grid: $_default-neat-grid !global;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Push or pull a grid column by manipulating its left margin.
|
3
|
+
///
|
4
|
+
/// @group features
|
5
|
+
///
|
6
|
+
/// @name Grid push
|
7
|
+
///
|
8
|
+
/// @argument {number (unitless)} $push [false]
|
9
|
+
/// The number of columns to push the column.
|
10
|
+
///
|
11
|
+
/// @argument {map} $grid [$neat-grid]
|
12
|
+
/// The grid to be used to determine how far to push the column.
|
13
|
+
/// By default, the global `$neat-grid` will be used.
|
14
|
+
///
|
15
|
+
/// @example scss
|
16
|
+
/// .element {
|
17
|
+
/// @include grid-push(3);
|
18
|
+
/// }
|
19
|
+
///
|
20
|
+
/// @example css
|
21
|
+
/// .element {
|
22
|
+
/// margin-left: calc(25% - 25px + 40px);
|
23
|
+
/// }
|
24
|
+
|
25
|
+
@mixin grid-push($push: false, $grid: $neat-grid) {
|
26
|
+
$_grid-columns: _retrieve-neat-setting($grid, columns);
|
27
|
+
$_grid-gutter: _retrieve-neat-setting($grid, gutter);
|
28
|
+
|
29
|
+
@if $push {
|
30
|
+
$_gutter-affordance: $_grid-gutter * 2;
|
31
|
+
$_margin-value: calc(#{_neat-column-width($grid, $push)} + #{$_gutter-affordance});
|
32
|
+
margin-#{_neat-float-direction($grid)}: $_margin-value;
|
33
|
+
} @else {
|
34
|
+
$_margin-value: _retrieve-neat-setting($grid, gutter);
|
35
|
+
margin-#{_neat-float-direction($grid)}: $_margin-value;
|
36
|
+
}
|
37
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/// Shift columns and reorder them within their container using relative
|
3
|
+
/// positioning.
|
4
|
+
///
|
5
|
+
/// @group features
|
6
|
+
///
|
7
|
+
/// @name Grid shift
|
8
|
+
///
|
9
|
+
/// @argument {number (unitless)} $shift [false]
|
10
|
+
/// The number of columns to shift the column.
|
11
|
+
///
|
12
|
+
/// @argument {map} $grid [$neat-grid]
|
13
|
+
/// The grid to be used to determine how far to shift the column.
|
14
|
+
/// By default, the global `$neat-grid` will be used.
|
15
|
+
///
|
16
|
+
/// @example scss
|
17
|
+
/// .element {
|
18
|
+
/// @include grid-shift(3);
|
19
|
+
/// }
|
20
|
+
///
|
21
|
+
/// @example css
|
22
|
+
/// .element {
|
23
|
+
/// left: calc(25% - 25px + 20px);
|
24
|
+
/// position: relative;
|
25
|
+
/// }
|
26
|
+
|
27
|
+
@mixin grid-shift($shift: false, $grid: $neat-grid) {
|
28
|
+
@if $shift {
|
29
|
+
$_shift-value: calc(#{_neat-column-width($grid, $shift)} + #{_retrieve-neat-setting($grid, gutter)});
|
30
|
+
#{_neat-float-direction($grid)}: $_shift-value;
|
31
|
+
} @else {
|
32
|
+
#{_neat-float-direction($grid)}: auto;
|
33
|
+
}
|
34
|
+
|
35
|
+
position: relative;
|
36
|
+
}
|