zen-grids 2.0.0.alpha.2 → 2.0.0.beta.1
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 +7 -0
- data/LICENSE.txt +333 -268
- data/README.txt +5 -5
- data/bower.json +25 -0
- data/templates/project/_init.scss +5 -5
- data/templates/project/_layout.scss +8 -8
- data/templates/unit-tests/manifest.rb +14 -13
- data/templates/unit-tests/sass/function-zen-direction-switch.scss +23 -0
- data/templates/unit-tests/sass/function-zen-grid-item-width.scss +12 -6
- data/templates/unit-tests/sass/function-zen-half-gutter.scss +6 -6
- data/templates/unit-tests/sass/function-zen-unit-width.scss +17 -5
- data/templates/unit-tests/sass/zen-float.scss +7 -7
- data/templates/unit-tests/sass/zen-grid-background.scss +41 -30
- data/templates/unit-tests/sass/zen-grid-container.scss +11 -4
- data/templates/unit-tests/sass/zen-grid-flow-item.scss +22 -25
- data/templates/unit-tests/sass/zen-grid-item-base.scss +18 -13
- data/templates/unit-tests/sass/zen-grid-item.scss +56 -38
- data/templates/unit-tests/sass/zen-new-row.scss +26 -0
- data/templates/unit-tests/test-results/function-zen-direction-switch.css +16 -0
- data/templates/unit-tests/test-results/function-zen-grid-item-width.css +7 -3
- data/templates/unit-tests/test-results/function-zen-half-gutter.css +4 -4
- data/templates/unit-tests/test-results/function-zen-unit-width.css +6 -2
- data/templates/unit-tests/test-results/zen-float.css +3 -3
- data/templates/unit-tests/test-results/zen-grid-background.css +23 -17
- data/templates/unit-tests/test-results/zen-grid-container.css +13 -2
- data/templates/unit-tests/test-results/zen-grid-flow-item.css +8 -8
- data/templates/unit-tests/test-results/zen-grid-item-base.css +9 -3
- data/templates/unit-tests/test-results/zen-grid-item.css +13 -3
- data/templates/unit-tests/test-results/zen-new-row.css +16 -0
- data/zen-grids.gemspec +8 -7
- data/zen-grids/_background.scss +83 -39
- data/zen-grids/_flow.scss +73 -46
- data/zen-grids/_grids.scss +137 -82
- metadata +13 -29
- data/component.json +0 -26
- data/templates/unit-tests/sass/function-zen-direction-flip.scss +0 -23
- data/templates/unit-tests/sass/zen-clear.scss +0 -26
- data/templates/unit-tests/test-results/function-zen-direction-flip.css +0 -16
- data/templates/unit-tests/test-results/zen-clear.css +0 -16
@@ -40,7 +40,7 @@
|
|
40
40
|
}
|
41
41
|
|
42
42
|
#test-zen-grid-container-4 {
|
43
|
-
/* Test zen-grid-container() with $context
|
43
|
+
/* Test zen-grid-container() with $context: grid-item */
|
44
44
|
padding-left: 0;
|
45
45
|
padding-right: 0;
|
46
46
|
}
|
@@ -53,7 +53,7 @@
|
|
53
53
|
}
|
54
54
|
|
55
55
|
#test-zen-grid-container-5 {
|
56
|
-
/* Test zen-grid-container() with $context
|
56
|
+
/* Test zen-grid-container() with $context: flow */
|
57
57
|
margin-left: -10px;
|
58
58
|
margin-right: -10px;
|
59
59
|
padding-left: 0;
|
@@ -66,3 +66,14 @@
|
|
66
66
|
#test-zen-grid-container-5:after {
|
67
67
|
clear: both;
|
68
68
|
}
|
69
|
+
|
70
|
+
#test-zen-grid-container-6 {
|
71
|
+
/* Test zen-grid-container() with $zen-gutter-method: margin */
|
72
|
+
}
|
73
|
+
#test-zen-grid-container-6:before, #test-zen-grid-container-6:after {
|
74
|
+
content: "";
|
75
|
+
display: table;
|
76
|
+
}
|
77
|
+
#test-zen-grid-container-6:after {
|
78
|
+
clear: both;
|
79
|
+
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
* Test zen-grid-flow-item()
|
4
4
|
*/
|
5
5
|
#test-zen-grid-flow-item {
|
6
|
-
/* Test zen-grid-flow-item(1) without setting $column-
|
6
|
+
/* Test zen-grid-flow-item(1) without setting $parent-column-span */
|
7
7
|
padding-left: 10px;
|
8
8
|
padding-right: 10px;
|
9
9
|
-moz-box-sizing: border-box;
|
@@ -72,7 +72,7 @@
|
|
72
72
|
width: 180px;
|
73
73
|
padding-left: 0;
|
74
74
|
padding-right: 0;
|
75
|
-
/* Test zen-grid-flow-item(1, 4) with 15px gutter and $zen-
|
75
|
+
/* Test zen-grid-flow-item(1, 4) with 15px gutter and $zen-direction: right */
|
76
76
|
padding-left: 8px;
|
77
77
|
padding-right: 7px;
|
78
78
|
-moz-box-sizing: border-box;
|
@@ -134,7 +134,7 @@
|
|
134
134
|
padding-left: 0;
|
135
135
|
padding-right: 5px;
|
136
136
|
margin-right: -5px;
|
137
|
-
/* Test zen-grid-flow-item(1, 4) with 15px gutter, $zen-
|
137
|
+
/* Test zen-grid-flow-item(1, 4) with 15px gutter, $zen-direction: right and $alpha-gutter: true */
|
138
138
|
padding-left: 8px;
|
139
139
|
padding-right: 7px;
|
140
140
|
-moz-box-sizing: border-box;
|
@@ -148,15 +148,15 @@
|
|
148
148
|
padding-left: 11.25px;
|
149
149
|
margin-left: 3.75px;
|
150
150
|
/* Test zen-grid-flow-item(1, 4) with $zen-box-sizing: content-box and 10% gutter */
|
151
|
-
padding-left:
|
152
|
-
padding-right:
|
151
|
+
padding-left: 7.14286%;
|
152
|
+
padding-right: 7.14286%;
|
153
153
|
border-left: 0 !important;
|
154
154
|
border-right: 0 !important;
|
155
155
|
word-wrap: break-word;
|
156
|
-
width:
|
156
|
+
width: 10.71429%;
|
157
157
|
padding-left: 0;
|
158
|
-
padding-right:
|
159
|
-
margin-right:
|
158
|
+
padding-right: 10.71429%;
|
159
|
+
margin-right: 3.57143%;
|
160
160
|
/* Test zen-grid-flow-item(1, 4) with $zen-auto-include-flow-item-base: false */
|
161
161
|
width: 25%;
|
162
162
|
padding-left: 0;
|
@@ -46,7 +46,7 @@
|
|
46
46
|
_display: inline;
|
47
47
|
_overflow: hidden;
|
48
48
|
_overflow-y: visible;
|
49
|
-
/* Test zen-grid-item-base() with $zen-
|
49
|
+
/* Test zen-grid-item-base() with $zen-gutters: 15px */
|
50
50
|
padding-left: 7px;
|
51
51
|
padding-right: 8px;
|
52
52
|
-moz-box-sizing: border-box;
|
@@ -54,7 +54,7 @@
|
|
54
54
|
-ms-box-sizing: border-box;
|
55
55
|
box-sizing: border-box;
|
56
56
|
word-wrap: break-word;
|
57
|
-
/* Test zen-grid-item-base() with $zen-
|
57
|
+
/* Test zen-grid-item-base() with $zen-gutters: 15px and $zen-direction: right */
|
58
58
|
padding-left: 8px;
|
59
59
|
padding-right: 7px;
|
60
60
|
-moz-box-sizing: border-box;
|
@@ -62,7 +62,7 @@
|
|
62
62
|
-ms-box-sizing: border-box;
|
63
63
|
box-sizing: border-box;
|
64
64
|
word-wrap: break-word;
|
65
|
-
/* Test zen-grid-item-base() with $zen-
|
65
|
+
/* Test zen-grid-item-base() with $zen-gutters: 15px and $zen-switch-direction: true */
|
66
66
|
padding-left: 8px;
|
67
67
|
padding-right: 7px;
|
68
68
|
-moz-box-sizing: border-box;
|
@@ -70,4 +70,10 @@
|
|
70
70
|
-ms-box-sizing: border-box;
|
71
71
|
box-sizing: border-box;
|
72
72
|
word-wrap: break-word;
|
73
|
+
/* Test zen-grid-item-base() with $zen-gutter-method: margin */
|
74
|
+
-moz-box-sizing: border-box;
|
75
|
+
-webkit-box-sizing: border-box;
|
76
|
+
-ms-box-sizing: border-box;
|
77
|
+
box-sizing: border-box;
|
78
|
+
word-wrap: break-word;
|
73
79
|
}
|
@@ -25,7 +25,7 @@
|
|
25
25
|
border-left: 0 !important;
|
26
26
|
border-right: 0 !important;
|
27
27
|
word-wrap: break-word;
|
28
|
-
/* Turn off $zen-auto-include-item-base */
|
28
|
+
/* Turn off $zen-auto-include-grid-item-base */
|
29
29
|
/* Test zen-grid-item(3, 3) with 5 column grid and 40px gutter */
|
30
30
|
float: left;
|
31
31
|
width: 60%;
|
@@ -36,12 +36,12 @@
|
|
36
36
|
width: 60%;
|
37
37
|
margin-right: 40%;
|
38
38
|
margin-left: -100%;
|
39
|
-
/* Test zen-grid-item(3, 3) with 5 column grid and 40px gutter and $zen-
|
39
|
+
/* Test zen-grid-item(3, 3) with 5 column grid and 40px gutter and $zen-switch-direction */
|
40
40
|
float: right;
|
41
41
|
width: 60%;
|
42
42
|
margin-right: 40%;
|
43
43
|
margin-left: -100%;
|
44
|
-
/* Test zen-grid-item(3, 3, right) with 5 column grid and 40px gutter and $zen-
|
44
|
+
/* Test zen-grid-item(3, 3, right) with 5 column grid and 40px gutter and $zen-switch-direction */
|
45
45
|
float: left;
|
46
46
|
width: 60%;
|
47
47
|
margin-left: 40%;
|
@@ -56,4 +56,14 @@
|
|
56
56
|
width: 600px;
|
57
57
|
margin-left: 400px;
|
58
58
|
margin-right: -100%;
|
59
|
+
/* Test zen-grid-item(3, 3) with $zen-gutter-method: margin, 5 column grid and 5% gutter */
|
60
|
+
float: left;
|
61
|
+
width: 58%;
|
62
|
+
margin-left: 42%;
|
63
|
+
margin-right: -100%;
|
64
|
+
/* Test zen-grid-item(3, 2.5) with $zen-gutter-method: margin, 5 column grid and 5% gutter */
|
65
|
+
float: left;
|
66
|
+
width: 58%;
|
67
|
+
margin-left: 29%;
|
68
|
+
margin-right: -100%;
|
59
69
|
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* @file
|
3
|
+
* Test zen-new-row()
|
4
|
+
*/
|
5
|
+
#test-zen-new-row {
|
6
|
+
/* Test zen-new-row() */
|
7
|
+
clear: left;
|
8
|
+
/* Test zen-new-row() with $zen-direction: right */
|
9
|
+
clear: right;
|
10
|
+
/* Test zen-new-row(left) */
|
11
|
+
clear: left;
|
12
|
+
/* Test zen-new-row(left, $switch-direction: TRUE) */
|
13
|
+
clear: right;
|
14
|
+
/* Test zen-new-row(left) with: $zen-switch-direction: TRUE; */
|
15
|
+
clear: right;
|
16
|
+
}
|
data/zen-grids.gemspec
CHANGED
@@ -9,8 +9,9 @@ Gem::Specification.new do |s|
|
|
9
9
|
s.homepage = 'http://zengrids.com'
|
10
10
|
s.rubyforge_project =
|
11
11
|
|
12
|
-
s.version = '2.0.0.
|
13
|
-
s.date = '2013-
|
12
|
+
s.version = '2.0.0.beta.1'
|
13
|
+
s.date = '2013-07-22'
|
14
|
+
s.licenses = ['GPL-2']
|
14
15
|
|
15
16
|
s.authors = ['John Albin Wilkins']
|
16
17
|
s.email = 'virtually.johnalbin@gmail.com'
|
@@ -18,7 +19,7 @@ Gem::Specification.new do |s|
|
|
18
19
|
s.add_runtime_dependency('sass', ">= 3.2")
|
19
20
|
|
20
21
|
s.files = %w[
|
21
|
-
|
22
|
+
bower.json
|
22
23
|
LICENSE.txt
|
23
24
|
README.txt
|
24
25
|
lib/zen-grids.rb
|
@@ -35,22 +36,22 @@ Gem::Specification.new do |s|
|
|
35
36
|
templates/project/styles.scss
|
36
37
|
templates/unit-tests/manifest.rb
|
37
38
|
templates/unit-tests/README.txt
|
38
|
-
templates/unit-tests/sass/function-zen-direction-
|
39
|
+
templates/unit-tests/sass/function-zen-direction-switch.scss
|
39
40
|
templates/unit-tests/sass/function-zen-grid-item-width.scss
|
40
41
|
templates/unit-tests/sass/function-zen-half-gutter.scss
|
41
42
|
templates/unit-tests/sass/function-zen-unit-width.scss
|
42
|
-
templates/unit-tests/sass/zen-
|
43
|
+
templates/unit-tests/sass/zen-new-row.scss
|
43
44
|
templates/unit-tests/sass/zen-float.scss
|
44
45
|
templates/unit-tests/sass/zen-grid-background.scss
|
45
46
|
templates/unit-tests/sass/zen-grid-container.scss
|
46
47
|
templates/unit-tests/sass/zen-grid-flow-item.scss
|
47
48
|
templates/unit-tests/sass/zen-grid-item-base.scss
|
48
49
|
templates/unit-tests/sass/zen-grid-item.scss
|
49
|
-
templates/unit-tests/test-results/function-zen-direction-
|
50
|
+
templates/unit-tests/test-results/function-zen-direction-switch.css
|
50
51
|
templates/unit-tests/test-results/function-zen-grid-item-width.css
|
51
52
|
templates/unit-tests/test-results/function-zen-half-gutter.css
|
52
53
|
templates/unit-tests/test-results/function-zen-unit-width.css
|
53
|
-
templates/unit-tests/test-results/zen-
|
54
|
+
templates/unit-tests/test-results/zen-new-row.css
|
54
55
|
templates/unit-tests/test-results/zen-float.css
|
55
56
|
templates/unit-tests/test-results/zen-grid-background.css
|
56
57
|
templates/unit-tests/test-results/zen-grid-container.css
|
data/zen-grids/_background.scss
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
+
//
|
2
|
+
// "Background grid image" module for the Zen Grids system.
|
3
|
+
//
|
4
|
+
|
5
|
+
|
1
6
|
@import "grids";
|
2
7
|
@import "compass/css3/images";
|
3
8
|
|
4
|
-
|
5
9
|
// Specify the color of the background grid.
|
6
10
|
$zen-grid-color : #ffdede !default;
|
7
11
|
|
@@ -69,54 +73,53 @@ $zen-grid-number-images : () !default;
|
|
69
73
|
|
70
74
|
|
71
75
|
//
|
72
|
-
// Add a grid to an element's background.
|
76
|
+
// Add a background grid image to an element's background.
|
73
77
|
// @see http://zengrids.com/help/#zen-grid-background
|
74
78
|
//
|
75
79
|
@mixin zen-grid-background(
|
76
|
-
$
|
77
|
-
$
|
80
|
+
$columns : $zen-columns,
|
81
|
+
$gutters : $zen-gutters,
|
82
|
+
$gutter-method : $zen-gutter-method,
|
78
83
|
$grid-width : $zen-grid-width,
|
79
84
|
$grid-color : $zen-grid-color,
|
80
85
|
$grid-numbers : $zen-grid-numbers,
|
81
|
-
$
|
86
|
+
$direction : $zen-direction,
|
87
|
+
$switch-direction : $zen-switch-direction
|
82
88
|
) {
|
83
89
|
|
84
|
-
// The CSS3 Gradient syntax doesn't allow for calc() to be used in color
|
85
|
-
// stops, so we can't express the columns as 20% + 10px. Instead we are going
|
86
|
-
// to divide all our columns in half and into 2 groups: one group for the left
|
87
|
-
// halves of the columns and one group for the right halves. Then we'll use
|
88
|
-
// background position to shift the left halves over to the right by a half
|
89
|
-
// gutter width and shift the right halves over to the left by a half gutter
|
90
|
-
// width and just let the two sets of gradients overlap in the middle. Easy.
|
91
|
-
|
92
90
|
$bg-images : ();
|
91
|
+
$gradient : ();
|
93
92
|
$left-half-gradient : ();
|
94
93
|
$right-half-gradient : ();
|
95
94
|
|
96
95
|
// Calculate half of the unit width.
|
97
|
-
$
|
96
|
+
$unit-width : zen-unit-width($columns, $gutters, $gutter-method, $grid-width);
|
97
|
+
$half-unit-width : $unit-width / 2;
|
98
98
|
|
99
99
|
// Determine the float direction.
|
100
|
-
$dir :
|
101
|
-
@if $
|
102
|
-
$dir : zen-direction-
|
100
|
+
$dir : $direction;
|
101
|
+
@if $switch-direction {
|
102
|
+
$dir : zen-direction-switch($dir);
|
103
103
|
}
|
104
104
|
|
105
|
-
@for $count from 1 through $
|
105
|
+
@for $count from 1 through $columns {
|
106
106
|
// First add the grid numbers to the background images list.
|
107
107
|
$position: (2 * $count - 1) * $half-unit-width;
|
108
|
-
|
108
|
+
@if $gutter-method == margin {
|
109
|
+
$position: $position + ($count - 1) * $gutters;
|
110
|
+
}
|
111
|
+
$reverse-count: $columns + 1 - $count;
|
109
112
|
|
110
113
|
@if $dir == left {
|
111
114
|
@if $grid-numbers == both or $grid-numbers == top {
|
112
115
|
$bg-images : append($bg-images, nth($zen-grid-number-images, $count) $position top no-repeat, comma);
|
113
116
|
}
|
114
|
-
@if $grid-numbers == both {
|
117
|
+
@if $grid-numbers == both or $grid-numbers == bottom {
|
115
118
|
$bg-images : append($bg-images, nth($zen-grid-number-images, $reverse-count) $position bottom no-repeat, comma);
|
116
119
|
}
|
117
120
|
}
|
118
121
|
@else {
|
119
|
-
@if $grid-numbers == both {
|
122
|
+
@if $grid-numbers == both or $grid-numbers == bottom {
|
120
123
|
$bg-images : append($bg-images, nth($zen-grid-number-images, $count) $position bottom no-repeat, comma);
|
121
124
|
}
|
122
125
|
@if $grid-numbers == both or $grid-numbers == top {
|
@@ -124,31 +127,72 @@ $zen-grid-number-images : () !default;
|
|
124
127
|
}
|
125
128
|
}
|
126
129
|
|
127
|
-
// Next, build the color stops for the
|
128
|
-
@if $
|
129
|
-
|
130
|
-
|
131
|
-
|
130
|
+
// Next, build the color stops for the column gradients.
|
131
|
+
@if $gutter-method == margin {
|
132
|
+
// If the gutter method is "margin", calculating the color stops is easy.
|
133
|
+
@if $count < $columns {
|
134
|
+
$stop: $count * $unit-width + ($count - 1) * $gutters;
|
135
|
+
$gradient: append($gradient, $grid-color $stop, comma);
|
136
|
+
$gradient: append($gradient, transparent $stop, comma);
|
137
|
+
|
138
|
+
$stop: $stop + $gutters;
|
139
|
+
$gradient: append($gradient, transparent $stop, comma);
|
140
|
+
$gradient: append($gradient, $grid-color $stop, comma);
|
141
|
+
}
|
132
142
|
}
|
143
|
+
@else if comparable($gutters, $grid-width) {
|
144
|
+
// If the gutter and grid width have the same units, calculating the color
|
145
|
+
// stops is easy.
|
146
|
+
$stop: ($count - 1) * $unit-width + zen-half-gutter($gutters);
|
147
|
+
$gradient: append($gradient, transparent $stop, comma);
|
148
|
+
$gradient: append($gradient, $grid-color $stop, comma);
|
149
|
+
|
150
|
+
$stop: $count * $unit-width - zen-half-gutter($gutters);
|
151
|
+
$gradient: append($gradient, $grid-color $stop, comma);
|
152
|
+
$gradient: append($gradient, transparent $stop, comma);
|
153
|
+
}
|
154
|
+
@else {
|
155
|
+
// If the gutter and grid width have different units, things are tricky.
|
156
|
+
// The CSS3 Gradient syntax doesn't allow for calc() to be used in color
|
157
|
+
// stops, so we can't express the columns as 20% + 10px. Instead we are
|
158
|
+
// going to divide all our columns in half and into 2 groups: one group
|
159
|
+
// for the left halves of the columns and one group for the right halves.
|
160
|
+
// Then we'll use background position to shift the left halves over to the
|
161
|
+
// right by a half gutter width and shift the right halves over to the
|
162
|
+
// left by a half gutter width and just let the two sets of gradients
|
163
|
+
// overlap in the middle. Easy.
|
164
|
+
|
165
|
+
// Build the color stops for the left halves of the column gradients.
|
166
|
+
@if $count > 1 {
|
167
|
+
$stop: (2 * $count - 2) * $half-unit-width;
|
168
|
+
$left-half-gradient: append($left-half-gradient, transparent $stop, comma);
|
169
|
+
$left-half-gradient: append($left-half-gradient, $grid-color $stop, comma);
|
170
|
+
}
|
133
171
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
// Next, build the color stops for the right halves of the column gradients.
|
139
|
-
$right-half-gradient: append($right-half-gradient, transparent $stop, comma);
|
140
|
-
$right-half-gradient: append($right-half-gradient, $grid-color $stop, comma);
|
172
|
+
$stop: (2 * $count - 1) * $half-unit-width;
|
173
|
+
$left-half-gradient: append($left-half-gradient, $grid-color $stop, comma);
|
174
|
+
$left-half-gradient: append($left-half-gradient, transparent $stop, comma);
|
141
175
|
|
142
|
-
|
143
|
-
$stop: (2 * $count) * $half-unit-width;
|
144
|
-
$right-half-gradient: append($right-half-gradient, $grid-color $stop, comma);
|
176
|
+
// Build the color stops for the right halves of the column gradients.
|
145
177
|
$right-half-gradient: append($right-half-gradient, transparent $stop, comma);
|
178
|
+
$right-half-gradient: append($right-half-gradient, $grid-color $stop, comma);
|
179
|
+
|
180
|
+
@if $count < $columns {
|
181
|
+
$stop: (2 * $count) * $half-unit-width;
|
182
|
+
$right-half-gradient: append($right-half-gradient, $grid-color $stop, comma);
|
183
|
+
$right-half-gradient: append($right-half-gradient, transparent $stop, comma);
|
184
|
+
}
|
146
185
|
}
|
147
186
|
}
|
148
187
|
|
149
|
-
// Last, add the gradient halves to the background images list.
|
150
|
-
$
|
151
|
-
|
188
|
+
// Last, add the gradient (or gradient halves) to the background images list.
|
189
|
+
@if $gutter-method == margin or comparable($gutters, $grid-width) {
|
190
|
+
$bg-images : append($bg-images, linear-gradient(left, $gradient) left top no-repeat, comma);
|
191
|
+
}
|
192
|
+
@else {
|
193
|
+
$bg-images : append($bg-images, linear-gradient(left, $left-half-gradient) zen-half-gutter($gutters) top no-repeat, comma);
|
194
|
+
$bg-images : append($bg-images, linear-gradient(left, $right-half-gradient) (-(zen-half-gutter($gutters))) top no-repeat, comma);
|
195
|
+
}
|
152
196
|
|
153
197
|
// Apply the full list of background images.
|
154
198
|
@include background($bg-images);
|
data/zen-grids/_flow.scss
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
@import "grids";
|
2
|
-
|
3
1
|
//
|
4
|
-
//
|
2
|
+
// "Flow" module for the Zen Grids system.
|
5
3
|
//
|
6
4
|
|
7
|
-
|
5
|
+
|
6
|
+
@import "grids";
|
7
|
+
|
8
|
+
// @see http://zengrids.com/help/#zen-auto-include-grid-item-base
|
8
9
|
$zen-auto-include-flow-item-base : true !default;
|
9
10
|
|
10
11
|
|
@@ -14,57 +15,88 @@ $zen-auto-include-flow-item-base : true !default;
|
|
14
15
|
//
|
15
16
|
@mixin zen-grid-flow-item(
|
16
17
|
$column-span,
|
17
|
-
$parent-column-
|
18
|
+
$parent-column-span : false,
|
18
19
|
$alpha-gutter : false,
|
19
20
|
$omega-gutter : true,
|
20
|
-
$
|
21
|
-
$
|
22
|
-
$
|
21
|
+
$direction : $zen-direction,
|
22
|
+
$columns : $zen-columns,
|
23
|
+
$gutters : $zen-gutters,
|
24
|
+
$gutter-method : $zen-gutter-method,
|
23
25
|
$grid-width : $zen-grid-width,
|
24
26
|
$box-sizing : $zen-box-sizing,
|
25
|
-
$
|
27
|
+
$switch-direction : $zen-switch-direction,
|
26
28
|
$auto-include-flow-item-base : $zen-auto-include-flow-item-base
|
27
29
|
) {
|
28
30
|
|
29
|
-
|
31
|
+
// Save the columns and gutters from the parent context.
|
32
|
+
$main-columns: $columns;
|
33
|
+
$main-gutters: $gutters;
|
34
|
+
$main-grid-width: $grid-width;
|
35
|
+
|
36
|
+
// Find the parent context for fluid layouts.
|
30
37
|
@if unit($grid-width) == "%" {
|
31
|
-
|
32
|
-
|
38
|
+
// The number of columns the parent element spans is our new column count.
|
39
|
+
@if $parent-column-span != false {
|
40
|
+
$columns: $parent-column-span;
|
33
41
|
}
|
34
42
|
@else {
|
35
|
-
|
43
|
+
// If we don't know the number of columns the parent element spans, then
|
44
|
+
// warn the user and force the flow item to span 100% of the parent.
|
45
|
+
@warn "For responsive layouts with a percentage-based grid width, you must set the $parent-column-span to the number of columns that the parent element spans.";
|
46
|
+
$column-span: $columns;
|
36
47
|
}
|
48
|
+
// We want our inner grid to span the entire width of the parent.
|
49
|
+
$grid-width: 100%;
|
50
|
+
}
|
51
|
+
|
52
|
+
// Determine the flow direction and its reverse.
|
53
|
+
$dir: $direction;
|
54
|
+
@if $switch-direction {
|
55
|
+
$dir: zen-direction-switch($dir);
|
37
56
|
}
|
57
|
+
$rev: zen-direction-switch($dir);
|
38
58
|
|
39
|
-
|
40
|
-
@if $
|
41
|
-
|
59
|
+
// Calculate the new gutters when the layout and gutters are both fluid.
|
60
|
+
@if unit($grid-width) == "%" and unit($gutters) == "%" {
|
61
|
+
// Calculate the parent's width.
|
62
|
+
$parent-width: zen-grid-item-width($parent-column-span, $main-columns, $main-gutters, $gutter-method, $main-grid-width, $box-sizing);
|
63
|
+
// Calculate the new gutters.
|
64
|
+
$gutters: $main-gutters * ($grid-width / $parent-width);
|
42
65
|
}
|
43
|
-
$rev: zen-direction-flip($dir);
|
44
66
|
|
45
67
|
// Auto-apply the unit base mixin.
|
46
68
|
@if $auto-include-flow-item-base {
|
47
|
-
@include zen-grid-item-base($gutter-
|
69
|
+
@include zen-grid-item-base($gutters, $gutter-method, $box-sizing, $direction, $switch-direction);
|
48
70
|
}
|
49
71
|
|
50
72
|
// Calculate the item's width.
|
51
|
-
$width: zen-grid-item-width($column-span, $columns, $gutter-
|
73
|
+
$width: zen-grid-item-width($column-span, $columns, $gutters, $gutter-method, $grid-width, $box-sizing);
|
74
|
+
@if $gutter-method == padding and unit($grid-width) != "%" and not $alpha-gutter and not $omega-gutter and $box-sizing == border-box {
|
75
|
+
$width: $width - $gutters;
|
76
|
+
}
|
77
|
+
width: $width;
|
52
78
|
|
53
|
-
@if
|
54
|
-
|
79
|
+
@if $gutter-method == margin {
|
80
|
+
@if $alpha-gutter {
|
81
|
+
margin-#{$dir}: $gutters;
|
82
|
+
}
|
83
|
+
@if $omega-gutter {
|
84
|
+
margin-#{$rev}: $gutters;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
@else if unit($grid-width) == "%" {
|
88
|
+
// Our percentage $width is off since the parent has $main-gutters padding.
|
55
89
|
// Calculate an adjusted gutter to fix the width.
|
56
|
-
$adjusted-gutter: ($columns - $column-span) * $
|
57
|
-
|
58
|
-
width: $width;
|
90
|
+
$adjusted-gutter: ($columns - $column-span) * $gutters / $columns;
|
59
91
|
|
60
92
|
// Ensure the HTML item either has a full gutter or no gutter on each side.
|
61
93
|
padding-#{$dir}: 0;
|
62
94
|
@if $alpha-gutter {
|
63
|
-
margin-#{$dir}: $
|
95
|
+
margin-#{$dir}: $gutters;
|
64
96
|
}
|
65
97
|
padding-#{$rev}: $adjusted-gutter;
|
66
98
|
@if $omega-gutter {
|
67
|
-
margin-#{$rev}: $
|
99
|
+
margin-#{$rev}: $gutters - $adjusted-gutter;
|
68
100
|
}
|
69
101
|
@else {
|
70
102
|
margin-#{$rev}: -($adjusted-gutter);
|
@@ -72,33 +104,28 @@ $zen-auto-include-flow-item-base : true !default;
|
|
72
104
|
}
|
73
105
|
@else {
|
74
106
|
@if $alpha-gutter and $omega-gutter {
|
75
|
-
|
76
|
-
@if $gutter-width != 0 {
|
107
|
+
@if $gutters != 0 {
|
77
108
|
margin: {
|
78
|
-
#{$dir}: zen-half-gutter($
|
79
|
-
#{$rev}: zen-half-gutter($
|
109
|
+
#{$dir}: zen-half-gutter($gutters, left, $dir);
|
110
|
+
#{$rev}: zen-half-gutter($gutters, right, $dir);
|
80
111
|
}
|
81
112
|
}
|
82
113
|
}
|
83
114
|
@else if not $alpha-gutter and not $omega-gutter {
|
84
|
-
|
85
|
-
@if $gutter-width != 0 {
|
115
|
+
@if $gutters != 0 {
|
86
116
|
padding: {
|
87
117
|
left: 0;
|
88
118
|
right: 0;
|
89
119
|
}
|
90
120
|
}
|
91
121
|
}
|
122
|
+
@else if $omega-gutter {
|
123
|
+
padding-#{$dir}: 0;
|
124
|
+
padding-#{$rev}: $gutters;
|
125
|
+
}
|
92
126
|
@else {
|
93
|
-
|
94
|
-
|
95
|
-
padding-#{$dir}: 0;
|
96
|
-
padding-#{$rev}: $gutter-width;
|
97
|
-
}
|
98
|
-
@else {
|
99
|
-
padding-#{$dir}: $gutter-width;
|
100
|
-
padding-#{$rev}: 0;
|
101
|
-
}
|
127
|
+
padding-#{$dir}: $gutters;
|
128
|
+
padding-#{$rev}: 0;
|
102
129
|
}
|
103
130
|
}
|
104
131
|
}
|
@@ -108,13 +135,13 @@ $zen-auto-include-flow-item-base : true !default;
|
|
108
135
|
// @see http://zengrids.com/help/#zen-float
|
109
136
|
//
|
110
137
|
@mixin zen-float(
|
111
|
-
$
|
112
|
-
$
|
138
|
+
$direction : $zen-direction,
|
139
|
+
$switch-direction : $zen-switch-direction
|
113
140
|
) {
|
114
141
|
// Determine the float direction.
|
115
|
-
$dir: $
|
116
|
-
@if $
|
117
|
-
$dir: zen-direction-
|
142
|
+
$dir: $direction;
|
143
|
+
@if $switch-direction {
|
144
|
+
$dir: zen-direction-switch($dir);
|
118
145
|
}
|
119
146
|
float: $dir;
|
120
147
|
}
|