singularitygs 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/singularitygs.rb +2 -2
- data/stylesheets/_singularitygs.scss +1 -1
- data/stylesheets/singularitygs/_math.scss +2 -1
- data/stylesheets/singularitygs/api/_float.scss +49 -1
- data/stylesheets/singularitygs/api/_isolation.scss +69 -12
- data/stylesheets/singularitygs/helpers/_background-grid.scss +79 -32
- data/stylesheets/singularitygs/helpers/_columns.scss +9 -0
- data/stylesheets/singularitygs/helpers/_find.scss +51 -42
- data/stylesheets/singularitygs/math/_columns.scss +18 -8
- data/stylesheets/singularitygs/math/_span.scss +3 -0
- metadata +4 -3
data/lib/singularitygs.rb
CHANGED
@@ -14,6 +14,8 @@
|
|
14
14
|
|
15
15
|
$gutter: find-gutter($gutter);
|
16
16
|
$end-row: end-row($span, $location, $columns);
|
17
|
+
$start-row: start-row($location);
|
18
|
+
|
17
19
|
|
18
20
|
width: column-span($span, $location-holder, $columns, $gutter);
|
19
21
|
|
@@ -31,7 +33,13 @@
|
|
31
33
|
}
|
32
34
|
@else {
|
33
35
|
float: $dir;
|
34
|
-
|
36
|
+
|
37
|
+
@if $start-row {
|
38
|
+
margin-#{$dir}: 0%;
|
39
|
+
}
|
40
|
+
@else {
|
41
|
+
margin-#{$opp}: gutter-span($gutter, $columns);
|
42
|
+
}
|
35
43
|
}
|
36
44
|
}
|
37
45
|
|
@@ -51,6 +59,14 @@
|
|
51
59
|
}
|
52
60
|
@else {
|
53
61
|
float: $dir;
|
62
|
+
|
63
|
+
@if $start-row {
|
64
|
+
margin-#{$dir}: 0%;
|
65
|
+
}
|
66
|
+
@else {
|
67
|
+
margin-#{$opp}: gutter-span($gutter, $columns);
|
68
|
+
}
|
69
|
+
|
54
70
|
margin-#{$dir}: 0;
|
55
71
|
margin-#{$opp}: gutter-span($gutter, $columns);
|
56
72
|
}
|
@@ -90,4 +106,36 @@
|
|
90
106
|
$gutter: (column-span($span, $location, $columns, $gutter) + gutter-span($gutter, $columns)) * -1;
|
91
107
|
|
92
108
|
margin-left: $gutter;
|
109
|
+
}
|
110
|
+
|
111
|
+
//////////////////////////////
|
112
|
+
// Happy Syntax for Float
|
113
|
+
//
|
114
|
+
// Makes working with Float easier, as it allows you to walk the grid for symmetric grids and easy applying of 'last' and 'first', as well as automatically building the verbose grid-span mixin call
|
115
|
+
//////////////////////////////
|
116
|
+
@mixin float-span($span, $location: false, $columns: false, $gutter: false) {
|
117
|
+
$grid: find-grid($columns);
|
118
|
+
$gutter: find-gutter($gutter);
|
119
|
+
$row: false;
|
120
|
+
|
121
|
+
@if type-of($grid) == 'number' or length($grid) == 1 {
|
122
|
+
@if $location == 'last' or $location == 'omega' {
|
123
|
+
$location: length($grid) - $span + 1;
|
124
|
+
}
|
125
|
+
@else {
|
126
|
+
@if $location == 'first' or $location == 'alpha' {
|
127
|
+
$row: true;
|
128
|
+
}
|
129
|
+
$location: 1;
|
130
|
+
}
|
131
|
+
|
132
|
+
@include grid-span($span, $location, $grid, $gutter, 'float');
|
133
|
+
|
134
|
+
@if $row {
|
135
|
+
clear: both;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
@else {
|
139
|
+
@warn 'Asymmetric Grids need a Location value as well as a span value in order to know where on the grid you are! Please include a location value!';
|
140
|
+
}
|
93
141
|
}
|
@@ -1,10 +1,11 @@
|
|
1
1
|
@mixin output-isolation($span, $location, $columns, $gutter, $options: false) {
|
2
2
|
|
3
|
-
@if $options == false {
|
4
|
-
$options: 'right';
|
5
|
-
}
|
6
|
-
|
7
3
|
$gutter: find-gutter($gutter);
|
4
|
+
$end-row: end-row($span, $location, $columns);
|
5
|
+
$start-row: start-row($location);
|
6
|
+
|
7
|
+
// @debug $options;
|
8
|
+
|
8
9
|
|
9
10
|
@if $direction == 'ltr' or $direction == 'both' {
|
10
11
|
// Set the CSS direction to ltr
|
@@ -14,10 +15,35 @@
|
|
14
15
|
$opp: opposite-direction($dir);
|
15
16
|
|
16
17
|
width: column-span($span, $location, $columns);
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
// If we are at the last item in the row, we float it the opposite direction
|
22
|
+
@if ($end-row) {
|
23
|
+
float: $opp;
|
24
|
+
margin-#{$dir}: 0;
|
25
|
+
margin-#{$opp}: 0;
|
26
|
+
}
|
27
|
+
@else {
|
28
|
+
float: $dir;
|
29
|
+
margin-#{$opp}: -100%;
|
30
|
+
|
31
|
+
@if $start-row {
|
32
|
+
margin-#{$dir}: 0%;
|
33
|
+
}
|
34
|
+
@else {
|
35
|
+
margin-#{$dir}: column-span(($location - 1), 1, $columns) + gutter-span($gutter, $columns);
|
36
|
+
}
|
37
|
+
|
38
|
+
}
|
39
|
+
|
40
|
+
// If options are set, we clear to that option, otherwise no clear!
|
41
|
+
@if ($options) {
|
42
|
+
clear: unquote($options);
|
43
|
+
}
|
44
|
+
@else {
|
45
|
+
clear: none;
|
46
|
+
}
|
21
47
|
}
|
22
48
|
|
23
49
|
@if $direction == 'rtl' or $direction == 'both' {
|
@@ -28,10 +54,29 @@
|
|
28
54
|
$opp: opposite-direction($dir);
|
29
55
|
|
30
56
|
[dir="#{$cssdir}"] & {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
57
|
+
// If we are at the last item in the row, we float it the opposite direction
|
58
|
+
@if ($end-row) {
|
59
|
+
float: $opp;
|
60
|
+
}
|
61
|
+
@else {
|
62
|
+
float: $dir;
|
63
|
+
margin-#{$opp}: -100%;
|
64
|
+
|
65
|
+
@if $start-row {
|
66
|
+
margin-#{$dir}: 0%;
|
67
|
+
}
|
68
|
+
@else {
|
69
|
+
margin-#{$dir}: column-span(($location - 1), 1, $columns) + gutter-span($gutter, $columns);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
// If options are set, we clear to that option, otherwise no clear!
|
74
|
+
@if ($options) {
|
75
|
+
clear: unquote($options);
|
76
|
+
}
|
77
|
+
@else {
|
78
|
+
clear: none;
|
79
|
+
}
|
35
80
|
}
|
36
81
|
}
|
37
82
|
|
@@ -45,4 +90,16 @@
|
|
45
90
|
|
46
91
|
@mixin pull-isolation($span, $location, $columns: false, $gutter: false) {
|
47
92
|
@include pull-float($span, $location, $columns, $gutter);
|
93
|
+
}
|
94
|
+
|
95
|
+
//////////////////////////////
|
96
|
+
// Happy Syntax for Isolation
|
97
|
+
//
|
98
|
+
// Makes working with Isolation easier, as it moves Clear to a 1st class citizen of the mixin, and automatically builds the verbose grid-span mixin call
|
99
|
+
//////////////////////////////
|
100
|
+
@mixin isolation-span($span, $location, $clear: false, $columns: false, $gutter: false) {
|
101
|
+
$grid: find-grid($columns);
|
102
|
+
$gutter: find-gutter($gutter);
|
103
|
+
|
104
|
+
@include grid-span($span, $location, $grid, $gutter, 'isolation', $clear);
|
48
105
|
}
|
@@ -120,67 +120,114 @@ $overlay-switch-position: left bottom !default;
|
|
120
120
|
@mixin background-grid(
|
121
121
|
$columns: false,
|
122
122
|
$gutter: false,
|
123
|
-
$color:
|
123
|
+
$color: Chocolate
|
124
124
|
) {
|
125
125
|
|
126
126
|
$background-length: length($grids);
|
127
127
|
|
128
|
-
@if not
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
@else {
|
128
|
+
@if (not $columns) {
|
129
|
+
$grid: find-grid($columns);
|
130
|
+
@include background-build($grid, $gutter, $color);
|
131
|
+
@if ($grid != $grids) {
|
132
|
+
@for $i from 2 through $background-length {
|
134
133
|
$mq: nth(nth($grids, $i), 2);
|
135
|
-
|
136
134
|
$grid: nth(nth($grids, $i), 1);
|
135
|
+
|
137
136
|
@include breakpoint($mq) {
|
138
137
|
@include background-build($grid, $gutter, $color);
|
139
138
|
}
|
140
139
|
}
|
141
140
|
}
|
142
141
|
}
|
142
|
+
@else {
|
143
|
+
@include background-build($columns, $gutter, $color);
|
144
|
+
}
|
143
145
|
}
|
144
146
|
|
145
147
|
@mixin background-build($columns, $gutter, $color) {
|
146
148
|
$columns: find-grid($columns);
|
147
149
|
$gutter: find-gutter($gutter);
|
148
150
|
|
149
|
-
$
|
151
|
+
$widths: ();
|
152
|
+
$colors: ();
|
150
153
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
}
|
154
|
+
$length: length($columns);
|
155
|
+
$symmetric: false;
|
156
|
+
@if type-of($columns) == 'number' or $length == 1 {
|
157
|
+
$symmetric: true;
|
158
|
+
$length: nth($columns, 1);
|
159
|
+
}
|
157
160
|
|
158
|
-
//////////////////////////////
|
159
|
-
// Get the stops of the gradient
|
160
|
-
//////////////////////////////
|
161
|
-
@function background-gradient-stops($columns, $gutter, $color) {
|
162
|
-
$bkg: ();
|
163
|
-
$count: column-count($columns);
|
164
161
|
|
165
|
-
@for $i from 1 through
|
166
|
-
$
|
162
|
+
@for $i from 1 through $length {
|
163
|
+
$column-span: column-span($i, 1, $columns);
|
164
|
+
$gutter-span: $column-span + gutter-span($gutter, $columns);
|
165
|
+
|
166
|
+
@if $i != $columns {
|
167
|
+
$widths: append($widths, $column-span);
|
168
|
+
$colors: append($colors, rgba($color, .5));
|
169
|
+
$widths: append($widths, $gutter-span);
|
170
|
+
$colors: append($colors, rgba($color, .25));
|
171
|
+
}
|
172
|
+
@else {
|
173
|
+
$widths: append($widths, $column-span);
|
174
|
+
$colors: append($colors, rgba($color, .5));
|
175
|
+
}
|
167
176
|
}
|
168
177
|
|
169
|
-
@
|
178
|
+
@include background-gradient-generate($widths, $colors);
|
179
|
+
|
170
180
|
}
|
171
181
|
|
172
182
|
//////////////////////////////
|
173
183
|
// Get the columns
|
174
184
|
//////////////////////////////
|
175
|
-
@
|
185
|
+
@mixin background-gradient-generate($widths, $colors, $direction: left) {
|
186
|
+
@if (length($widths) != length($colors)) and (length($widths) != length($colors) - 1) {
|
187
|
+
@warn 'You either need an equal number of widths and colors or one less width than color, in which case it is assumed that the last width goes to 100%. Please provide the correct amount of widths and colors.';
|
188
|
+
}
|
189
|
+
@else {
|
190
|
+
$stops: ();
|
191
|
+
|
192
|
+
@if length($widths) == (length($colors) - 1) {
|
193
|
+
$widths: append($widths, 100%);
|
194
|
+
}
|
195
|
+
|
196
|
+
$i: 1;
|
197
|
+
|
198
|
+
@each $width in $widths {
|
199
|
+
$width: nth($widths, $i);
|
200
|
+
$color: nth($colors, $i);
|
176
201
|
|
177
|
-
|
178
|
-
|
202
|
+
@if $i == 1 {
|
203
|
+
$stops: join($stops, build-gradient-piece($width, $color), comma);
|
204
|
+
}
|
205
|
+
@else {
|
206
|
+
$position: nth($widths, $i - 1);
|
207
|
+
$stops: join($stops, build-gradient-piece($width, $color, $position), comma);
|
208
|
+
}
|
209
|
+
|
210
|
+
$i: $i + 1;
|
211
|
+
}
|
212
|
+
|
213
|
+
// @debug $stops;
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
@include background-image(
|
218
|
+
linear-gradient($direction, $stops)
|
219
|
+
);
|
179
220
|
}
|
180
|
-
|
181
|
-
|
221
|
+
}
|
222
|
+
|
223
|
+
@function build-gradient-piece($width, $color, $position: false) {
|
224
|
+
@if ($position == 'last') {
|
225
|
+
@return ($color $width);
|
182
226
|
}
|
183
|
-
@if $
|
184
|
-
@return
|
227
|
+
@else if ($position != false) {
|
228
|
+
@return $color $position, $color $width;
|
185
229
|
}
|
186
|
-
|
230
|
+
@else {
|
231
|
+
@return $color, $color $width;
|
232
|
+
}
|
233
|
+
}
|
@@ -11,61 +11,70 @@
|
|
11
11
|
@return $user-object;
|
12
12
|
}
|
13
13
|
@else if $length > 1 {
|
14
|
-
|
15
|
-
|
14
|
+
//////////////////////////////
|
15
|
+
// @TODO! REplace with Native Sass Fucntion when vailable!
|
16
|
+
// https://github.com/nex3/sass/pull/689
|
17
|
+
//////////////////////////////
|
18
|
+
@if (is-breakpoint-list($haystack) != false) {
|
19
|
+
$query-min: breakpoint-get-context('min-width');
|
20
|
+
$query-max: breakpoint-get-context('max-width');
|
16
21
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
// If we've got a min-width or max-width
|
23
|
+
@if $query-min or $query-max {
|
24
|
+
// Reverse the grid so we can step through it
|
25
|
+
$reverse-haystack: ();
|
26
|
+
@for $i from 2 through $length {
|
27
|
+
$reverse-haystack: append($reverse-haystack, nth($haystack, $i), comma);
|
28
|
+
}
|
29
|
+
$reverse-haystack: reverse($reverse-haystack);
|
30
|
+
$rg-length: $length - 1;
|
26
31
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
32
|
+
// Grab the largest and smallest MQs
|
33
|
+
$smallest: nth(nth($haystack, 2), 2);
|
34
|
+
$largest: nth(nth($reverse-haystack, 1), 2);
|
35
|
+
$context: $query-min;
|
31
36
|
|
32
|
-
|
33
|
-
|
34
|
-
|
37
|
+
@if not ($mobile-first) {
|
38
|
+
$context: $query-max;
|
39
|
+
}
|
35
40
|
|
36
41
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
42
|
+
// If it's smallest than the smallest MQ, use the 1st grid
|
43
|
+
@if $context < $smallest {
|
44
|
+
@return nth($haystack, 1);
|
45
|
+
}
|
46
|
+
// If it's larger than or equal to the largest MQ, use the last grid
|
47
|
+
@else if $context >= $largest {
|
48
|
+
@return nth(nth($reverse-haystack, 1), 1);
|
49
|
+
}
|
50
|
+
// If it's in between the smallest and largest, go run a check.
|
51
|
+
@else {
|
52
|
+
// Loop through each MQ.
|
53
|
+
@for $j from 1 through $rg-length {
|
54
|
+
$query: nth(nth($reverse-haystack, $j), 2);
|
50
55
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
56
|
+
// If the MQ is greather than or equal to the the MQ in question, use it! (mobile first)
|
57
|
+
@if ($mobile-first) {
|
58
|
+
@if $context >= $query {
|
59
|
+
@return nth(nth($reverse-haystack, $j), 1);
|
60
|
+
}
|
55
61
|
}
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
62
|
+
// If the MQ is less than or equal to the the MQ in question, use it! (not mobile first)
|
63
|
+
@else {
|
64
|
+
@if $context <= $query {
|
65
|
+
@return nth(nth($reverse-haystack, $j), 1);
|
66
|
+
}
|
61
67
|
}
|
62
68
|
}
|
63
69
|
}
|
64
70
|
}
|
71
|
+
// All else fails, return the first grid
|
72
|
+
@else {
|
73
|
+
@return nth($haystack, 1);
|
74
|
+
}
|
65
75
|
}
|
66
|
-
// All else fails, return the first grid
|
67
76
|
@else {
|
68
|
-
@return
|
77
|
+
@return $haystack;
|
69
78
|
}
|
70
79
|
}
|
71
80
|
// All else fails, return the first grid
|
@@ -7,26 +7,36 @@
|
|
7
7
|
$columns: find-grid($columns);
|
8
8
|
$gutter: find-gutter($gutter);
|
9
9
|
|
10
|
+
// @debug $columns;
|
11
|
+
// @debug $gutter;
|
12
|
+
|
10
13
|
// Combine the columns and gutters
|
11
14
|
$columns-and-gutters: column-sum($columns, $gutter);
|
12
15
|
|
16
|
+
// @debug $columns-and-gutters;
|
17
|
+
|
13
18
|
// Equal width columns are easy! Deal with them!
|
14
19
|
@if type-of($columns) == 'number' or length($columns) == 1 {
|
15
|
-
$span-and-gutters: $span +
|
20
|
+
$span-and-gutters: $span + $gutter * ($span - 1);
|
16
21
|
@return $span-and-gutters / $columns-and-gutters * 100%;
|
17
22
|
}
|
18
23
|
// Asymmetric lists are harder, so we're going to treat them as their own columns
|
19
24
|
@else if type-of($columns) == 'list' or length($columns) > 1 {
|
20
|
-
|
21
|
-
$sum: 0;
|
22
|
-
$holder: ();
|
25
|
+
$span-and-gutters: 0;
|
23
26
|
|
24
|
-
@
|
25
|
-
|
27
|
+
@if $location == 1 and $span >= 1 {
|
28
|
+
@for $i from 1 through $span {
|
29
|
+
$span-and-gutters: $span-and-gutters + nth($columns, $i) + $gutter;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
@else {
|
33
|
+
$total: $location + $span - 1;
|
34
|
+
@for $i from $location through $total {
|
35
|
+
$span-and-gutters: $span-and-gutters + nth($columns, $i) + $gutter;
|
36
|
+
}
|
26
37
|
}
|
38
|
+
$span-and-gutters: $span-and-gutters - $gutter;
|
27
39
|
|
28
|
-
// Get sub-column sum
|
29
|
-
$span-and-gutters: column-sum($holder, $gutter);
|
30
40
|
@return $span-and-gutters / $columns-and-gutters * 100%;
|
31
41
|
}
|
32
42
|
@else {
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 2
|
9
|
+
version: 1.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Scott Kellum
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-04-
|
18
|
+
date: 2013-04-03 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- stylesheets/singularitygs/math/_columns.scss
|
100
100
|
- stylesheets/singularitygs/math/_context.scss
|
101
101
|
- stylesheets/singularitygs/math/_gutters.scss
|
102
|
+
- stylesheets/singularitygs/math/_span.scss
|
102
103
|
- templates/box-sizing/behaviors/box-sizing/boxsizing.htc
|
103
104
|
- templates/box-sizing/behaviors/box-sizing/boxsizing.php
|
104
105
|
- templates/box-sizing/manifest.rb
|