singularitygs 0.0.17 → 0.1.alpha
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.sass +40 -0
- data/stylesheets/singularitygs/_background-grid.sass +19 -0
- data/stylesheets/singularitygs/_column.sass +25 -0
- data/stylesheets/singularitygs/_grid-plugins.sass +2 -0
- data/stylesheets/singularitygs/{_grid-test.scss → _grid-test.sass} +13 -22
- data/stylesheets/singularitygs/_grid.sass +2 -0
- data/stylesheets/singularitygs/_gridsets.scss +242 -0
- data/stylesheets/singularitygs/_gutter.sass +4 -0
- data/stylesheets/singularitygs/_helpers.sass +37 -0
- data/stylesheets/singularitygs/_mixins.sass +75 -0
- data/stylesheets/singularitygs/grid-plugins/_compound.sass +30 -0
- data/stylesheets/singularitygs/grid-plugins/_ratio.scss +0 -4
- metadata +24 -40
- data/stylesheets/_singularitygs.scss +0 -68
- data/stylesheets/singularitygs/_background-grid.scss +0 -26
- data/stylesheets/singularitygs/_column.scss +0 -51
- data/stylesheets/singularitygs/_grid-plugins.scss +0 -3
- data/stylesheets/singularitygs/_grid.scss +0 -3
- data/stylesheets/singularitygs/_gutter.scss +0 -45
- data/stylesheets/singularitygs/_helpers.scss +0 -3
- data/stylesheets/singularitygs/_mixins.scss +0 -7
- data/stylesheets/singularitygs/grid-plugins/_compound.scss +0 -49
- data/stylesheets/singularitygs/grid-plugins/_ratio-spiral.scss +0 -42
- data/stylesheets/singularitygs/grid-structure/_display-table.scss +0 -1
- data/stylesheets/singularitygs/grid-structure/_flexbox.scss +0 -0
- data/stylesheets/singularitygs/grid-structure/_float.scss +0 -94
- data/stylesheets/singularitygs/grid-structure/_grid-layout.scss +0 -1
- data/stylesheets/singularitygs/grid-structure/_isolation.scss +0 -145
- data/stylesheets/singularitygs/helpers/_grids.scss +0 -34
- data/stylesheets/singularitygs/helpers/_gridsets.scss +0 -362
- data/stylesheets/singularitygs/helpers/_lists.scss +0 -29
- data/stylesheets/singularitygs/mixins/_base-font-size.scss +0 -63
- data/stylesheets/singularitygs/mixins/_container.scss +0 -63
- data/stylesheets/singularitygs/mixins/_grid-build.scss +0 -16
- data/stylesheets/singularitygs/mixins/_grid-objects.scss +0 -26
- data/stylesheets/singularitygs/mixins/_grid-padding.scss +0 -8
- data/stylesheets/singularitygs/mixins/_grid-span.scss +0 -9
- data/stylesheets/singularitygs/mixins/_push-pull.scss +0 -41
- data/templates/project/behaviors/box-sizing/boxsizing.htc +0 -399
- data/templates/project/behaviors/box-sizing/boxsizing.php +0 -23
- data/templates/project/manifest.rb +0 -4
data/lib/singularitygs.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
/*! SINGULARITY -- http://singularity.gs/ */
|
2
|
+
@import compass
|
3
|
+
@import modular-scale
|
4
|
+
@import breakpoint
|
5
|
+
|
6
|
+
// Can be a number or a list of non-uniform column widths
|
7
|
+
$columns: 12 !default
|
8
|
+
|
9
|
+
// Must be % or 0
|
10
|
+
$gutter: 2% !default
|
11
|
+
|
12
|
+
// Grid padding can be any type of unit
|
13
|
+
$padding: 0 !default
|
14
|
+
|
15
|
+
// Helpers return think like list sums and column counts
|
16
|
+
@import singularitygs/helpers
|
17
|
+
|
18
|
+
// Compound grid calculation function
|
19
|
+
@import singularitygs/grid-plugins
|
20
|
+
|
21
|
+
// Column math is isolated
|
22
|
+
@import singularitygs/column
|
23
|
+
|
24
|
+
// Gutter math is isolated
|
25
|
+
@import singularitygs/gutter
|
26
|
+
|
27
|
+
// Grid math combines column and gutter math
|
28
|
+
@import singularitygs/grid
|
29
|
+
|
30
|
+
// Mixins to write
|
31
|
+
@import singularitygs/mixins
|
32
|
+
|
33
|
+
// Mixins to write
|
34
|
+
@import singularitygs/grid-test
|
35
|
+
|
36
|
+
// Mixins to write
|
37
|
+
@import singularitygs/background-grid
|
38
|
+
|
39
|
+
// Gridsets
|
40
|
+
@import singularitygs/gridsets
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// Write stops for single columns
|
2
|
+
@function grid-gradient-stop($location, $columns, $gutter, $color)
|
3
|
+
@if $location == 1
|
4
|
+
@return ($color 0%, $color grid-span(1, 1, $columns, $gutter), transparentize($color, 1) grid-span(1, 1, $columns, $gutter))
|
5
|
+
@if $location == column-count($columns)
|
6
|
+
@return (transparentize($color, 1) grid-span($location - 1, 1, $columns, $gutter) + $gutter, $color grid-span($location - 1, 1, $columns, $gutter) + $gutter, $color 100%)
|
7
|
+
@if $location > 1
|
8
|
+
@return (transparentize($color, 1) grid-span($location - 1, 1, $columns, $gutter) + $gutter, $color grid-span($location - 1, 1, $columns, $gutter) + $gutter, $color grid-span($location, 1, $columns, $gutter), transparentize($color, 1) grid-span($location, 1, $columns, $gutter))
|
9
|
+
|
10
|
+
// Compiling grid stops
|
11
|
+
@function grid-gradient-stops($columns, $gutter, $color)
|
12
|
+
$list: ()
|
13
|
+
@for $i from 1 through column-count($columns)
|
14
|
+
$list: join($list, grid-gradient-stop($i, $columns, $gutter, $color), comma)
|
15
|
+
@return $list
|
16
|
+
|
17
|
+
// Pull in grid stops to make a background gradient
|
18
|
+
=background-grid($columns, $gutter, $color: rgba(#69AEDB, .5))
|
19
|
+
+background(linear-gradient(left, grid-gradient-stops($columns, $gutter, $color)))
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// calculate the width of individual columns
|
2
|
+
@function list-column-width($location, $columns)
|
3
|
+
// send a warning if this is used when $columns is not a list
|
4
|
+
@if type-of($columns) != list
|
5
|
+
@warn "The column-list-sum function requires the variable $columns to be a list."
|
6
|
+
@else
|
7
|
+
// divide the column from its context
|
8
|
+
@return nth(nth($columns, $location), 1) / list-sum($columns)
|
9
|
+
|
10
|
+
|
11
|
+
// Calculate the width spanning multiple columns
|
12
|
+
@function column-span($span, $location: 1, $columns: $columns)
|
13
|
+
|
14
|
+
// Equal width columns
|
15
|
+
@if type-of($columns) == number
|
16
|
+
@return $span * (100% / $columns)
|
17
|
+
|
18
|
+
// Variable width columns
|
19
|
+
@if type-of($columns) == list
|
20
|
+
// zero out initial sum
|
21
|
+
$sum: 0
|
22
|
+
// from start point to end point
|
23
|
+
@for $i from $location to ($location + $span)
|
24
|
+
$sum: $sum + list-column-width($i, $columns)
|
25
|
+
@return percentage($sum)
|
@@ -1,25 +1,16 @@
|
|
1
|
-
|
2
|
-
.test-grid
|
3
|
-
height: 200px
|
4
|
-
width: 100
|
5
|
-
|
6
|
-
$
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
.inner {
|
15
|
-
height: 100%;
|
16
|
-
// ie fallback
|
17
|
-
background-color: lighten($color, 10%);
|
18
|
-
background-color: transparentize($color, 0.5);
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}
|
1
|
+
=test-grid($columns: $columns, $gutter: $gutter, $padding: $padding, $prefix: a, $color: #6bb)
|
2
|
+
.test-grid
|
3
|
+
height: 200px
|
4
|
+
width: 100%
|
5
|
+
$grid-counter: 1
|
6
|
+
@for $i from 1 through column-count($columns)
|
7
|
+
.test.#{$prefix}#{$i}
|
8
|
+
height: 100%
|
9
|
+
+grid-span(1, $i, $columns: $columns, $gutter: $gutter, $padding: $padding)
|
10
|
+
background-color: transparentize($color, .5)
|
11
|
+
.inner
|
12
|
+
height: 100%
|
13
|
+
background-color: transparentize($color, .5)
|
23
14
|
|
24
15
|
// Need this markup to test
|
25
16
|
//<div class="test-grid">
|
@@ -0,0 +1,242 @@
|
|
1
|
+
$gridset: () !default;
|
2
|
+
$gutterset: () !default;
|
3
|
+
$paddingset: () !default;
|
4
|
+
|
5
|
+
$gridset-mobile-first: true;
|
6
|
+
|
7
|
+
@mixin gridset-span($span, $location, $gutters: false, $paddings: false) {
|
8
|
+
$length: length($gridset);
|
9
|
+
|
10
|
+
$query-min: breakpoint-get-context('min-width');
|
11
|
+
$query-max: breakpoint-get-context('max-width');
|
12
|
+
|
13
|
+
@if $query-min {
|
14
|
+
$query-min: breakpoint-to-base-em($query-min);
|
15
|
+
}
|
16
|
+
@if $query-max {
|
17
|
+
$query-max: breakpoint-to-base-em($query-max);
|
18
|
+
}
|
19
|
+
|
20
|
+
$written: false;
|
21
|
+
|
22
|
+
$gutter-length: length($gutterset);
|
23
|
+
$padding-length: length($paddingset);
|
24
|
+
|
25
|
+
$ghr: () !default;
|
26
|
+
$ghs: () !default;
|
27
|
+
$phs: () !default;
|
28
|
+
|
29
|
+
@if $query-min or $query-max {
|
30
|
+
@for $j from 2 through $length {
|
31
|
+
$ghr: append($ghr, nth($gridset, $j), comma);
|
32
|
+
}
|
33
|
+
|
34
|
+
@for $j from 2 through $length {
|
35
|
+
@if $j > $gutter-length {
|
36
|
+
$ghs: append($ghs, nth($gutterset, $gutter-length));
|
37
|
+
}
|
38
|
+
@else {
|
39
|
+
$ghs: append($ghs, nth($gutterset, $j));
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
@for $j from 2 through $length {
|
44
|
+
@if $j > $padding-length {
|
45
|
+
$phs: append($phs, nth($paddingset, $padding-length));
|
46
|
+
}
|
47
|
+
@else {
|
48
|
+
$phs: append($phs, nth($paddingset, $j));
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
$ghr: reverse($ghr);
|
53
|
+
|
54
|
+
$gthr: reverse($ghs);
|
55
|
+
$phr: reverse($phs);
|
56
|
+
|
57
|
+
$holder-length: length($ghr);
|
58
|
+
|
59
|
+
@for $i from 1 through $holder-length {
|
60
|
+
$gridholder: nth($ghr, $i);
|
61
|
+
|
62
|
+
$grid-columns: nth($gridholder, 1);
|
63
|
+
$grid-query: nth($gridholder, 2);
|
64
|
+
|
65
|
+
$grid-query: breakpoint-to-base-em($grid-query);
|
66
|
+
|
67
|
+
@if length($gridholder) < 2 {
|
68
|
+
@warn 'Grid #{$gridholder} needs a breakpoint value!';
|
69
|
+
}
|
70
|
+
@else if not $written {
|
71
|
+
@if $gridset-mobile-first {
|
72
|
+
@if $query-min and not $query-max {
|
73
|
+
@if $query-min and $query-max {
|
74
|
+
@if $query-min >= $grid-query and $query-max < $grid-query {
|
75
|
+
@if $gutters == false {
|
76
|
+
@if $gutter-length > 0 {
|
77
|
+
$gutters: nth($gthr, $i);
|
78
|
+
}
|
79
|
+
@else {
|
80
|
+
$gutters: $gutter;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
@if $paddings == false {
|
84
|
+
@if $padding-length > 0 {
|
85
|
+
$paddings: nth($phr, $i);
|
86
|
+
}
|
87
|
+
@else {
|
88
|
+
$paddings: $padding;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
@include grid-span($span, $location, $grid-columns, $gutters, $paddings);
|
92
|
+
$written: true;
|
93
|
+
$gutters: false;
|
94
|
+
$paddings: false;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
@else if $query-min >= $grid-query {
|
98
|
+
@if $gutters == false {
|
99
|
+
@if $gutter-length > 0 {
|
100
|
+
$gutters: nth($gthr, $i);
|
101
|
+
}
|
102
|
+
@else {
|
103
|
+
$gutters: $gutter;
|
104
|
+
}
|
105
|
+
}
|
106
|
+
@if $paddings == false {
|
107
|
+
@if $padding-length > 0 {
|
108
|
+
$paddings: nth($phr, $i);
|
109
|
+
}
|
110
|
+
@else {
|
111
|
+
$paddings: $padding;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
@include grid-span($span, $location, $grid-columns, $gutters, $paddings);
|
115
|
+
$written: true;
|
116
|
+
$gutters: false;
|
117
|
+
$paddings: false;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
@else {
|
121
|
+
@if $query-max < $grid-query {
|
122
|
+
@if $gutters == false {
|
123
|
+
@if $gutter-length > 0 {
|
124
|
+
$gutters: nth($gthr, $i);
|
125
|
+
}
|
126
|
+
@else {
|
127
|
+
$gutters: $gutter;
|
128
|
+
}
|
129
|
+
}
|
130
|
+
@if $paddings == false {
|
131
|
+
@if $padding-length > 0 {
|
132
|
+
$paddings: nth($phr, $i);
|
133
|
+
}
|
134
|
+
@else {
|
135
|
+
$paddings: $padding;
|
136
|
+
}
|
137
|
+
}
|
138
|
+
@include grid-span($span, $location, $grid-columns, $gutters, $paddings);
|
139
|
+
$written: true;
|
140
|
+
$gutters: false;
|
141
|
+
$paddings: false;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
@else {
|
146
|
+
@if $query-min and $query-max {
|
147
|
+
@if $gutters == false {
|
148
|
+
@if $gutter-length > 0 {
|
149
|
+
$gutters: nth($gthr, $i);
|
150
|
+
}
|
151
|
+
@else {
|
152
|
+
$gutters: $gutter;
|
153
|
+
}
|
154
|
+
}
|
155
|
+
@if $paddings == false {
|
156
|
+
@if $padding-length > 0 {
|
157
|
+
$paddings: nth($phr, $i);
|
158
|
+
}
|
159
|
+
@else {
|
160
|
+
$paddings: $padding;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
@if $query-min > $grid-query and $query-max <= $grid-query {
|
164
|
+
@include grid-span($span, $location, $grid-columns, $gutters, $paddings);
|
165
|
+
$written: true;
|
166
|
+
$gutters: false;
|
167
|
+
$paddings: false;
|
168
|
+
}
|
169
|
+
}
|
170
|
+
@else if $query-min and not $query-max {
|
171
|
+
@if $query-min > $grid-query {
|
172
|
+
@if $gutters == false {
|
173
|
+
@if $gutter-length > 0 {
|
174
|
+
$gutters: nth($gthr, $i);
|
175
|
+
}
|
176
|
+
@else {
|
177
|
+
$gutters: $gutter;
|
178
|
+
}
|
179
|
+
}
|
180
|
+
@if $paddings == false {
|
181
|
+
@if $padding-length > 0 {
|
182
|
+
$paddings: nth($phr, $i);
|
183
|
+
}
|
184
|
+
@else {
|
185
|
+
$paddings: $padding;
|
186
|
+
}
|
187
|
+
}
|
188
|
+
@include grid-span($span, $location, $grid-columns, $gutters, $paddings);
|
189
|
+
$written: true;
|
190
|
+
$gutters: false;
|
191
|
+
$paddings: false;
|
192
|
+
}
|
193
|
+
}
|
194
|
+
@else {
|
195
|
+
@if $query-max <= $grid-query {
|
196
|
+
@if $gutters == false {
|
197
|
+
@if $gutter-length > 0 {
|
198
|
+
$gutters: nth($gthr, $i);
|
199
|
+
}
|
200
|
+
@else {
|
201
|
+
$gutters: $gutter;
|
202
|
+
}
|
203
|
+
}
|
204
|
+
@if $paddings == false {
|
205
|
+
@if $padding-length > 0 {
|
206
|
+
$paddings: nth($phr, $i);
|
207
|
+
}
|
208
|
+
@else {
|
209
|
+
$paddings: $padding;
|
210
|
+
}
|
211
|
+
}
|
212
|
+
@include grid-span($span, $location, $grid-columns, $gutters, $paddings);
|
213
|
+
$written: true;
|
214
|
+
$gutters: false;
|
215
|
+
$paddings: false;
|
216
|
+
}
|
217
|
+
}
|
218
|
+
}
|
219
|
+
}
|
220
|
+
}
|
221
|
+
}
|
222
|
+
@else {
|
223
|
+
@if $gutters == false {
|
224
|
+
@if $gutter-length > 0 {
|
225
|
+
$gutters: nth($gutterset, 1);
|
226
|
+
}
|
227
|
+
@else {
|
228
|
+
$gutters: $gutter;
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
232
|
+
@if $paddings == false {
|
233
|
+
@if $padding-length > 0 {
|
234
|
+
$paddings: nth($paddingset, 1);
|
235
|
+
}
|
236
|
+
@else {
|
237
|
+
$paddings: $padding;
|
238
|
+
}
|
239
|
+
}
|
240
|
+
@include grid-span($span, $location, nth($gridset, 1), $gutters, $paddings);
|
241
|
+
}
|
242
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
// Calculate the total sum of a list (context)
|
2
|
+
@function list-sum($list)
|
3
|
+
// zero out the initial sum
|
4
|
+
$sum: 0
|
5
|
+
// loop through each value in the list adding it to $list-sum
|
6
|
+
@for $i from 1 through length($list)
|
7
|
+
$sum: $sum + nth(nth($list, $i), 1)
|
8
|
+
@return nth($sum, 1)
|
9
|
+
|
10
|
+
|
11
|
+
// Find column count
|
12
|
+
@function column-count($columns)
|
13
|
+
@if type-of($columns) == number
|
14
|
+
@return $columns
|
15
|
+
@if type-of($columns) == list
|
16
|
+
@return length($columns)
|
17
|
+
|
18
|
+
|
19
|
+
// Context of gutters
|
20
|
+
@function gutter-context($gutter, $context)
|
21
|
+
@return $gutter * (100% / $context)
|
22
|
+
|
23
|
+
@function repeat($count, $repeat)
|
24
|
+
$list: $repeat
|
25
|
+
@for $i from 2 through $count
|
26
|
+
$list: join($repeat, $list)
|
27
|
+
@return $list
|
28
|
+
|
29
|
+
// Reverses direction of a list
|
30
|
+
@function reverse($list)
|
31
|
+
$length: length($list)
|
32
|
+
$return: ()
|
33
|
+
|
34
|
+
@for $i from 0 to $length
|
35
|
+
$return: append($return, nth($list, $length - $i), comma)
|
36
|
+
|
37
|
+
@return $return
|
@@ -0,0 +1,75 @@
|
|
1
|
+
// Grid location is automatically counted unless overridden
|
2
|
+
$grid-counter: 1
|
3
|
+
|
4
|
+
=grid-span($span, $location: $grid-counter, $columns: $columns, $gutter: $gutter, $padding: $padding)
|
5
|
+
@if $location < column-count($columns)
|
6
|
+
float: left
|
7
|
+
@else
|
8
|
+
float: right
|
9
|
+
width: grid-span($span, $location, $columns, $gutter)
|
10
|
+
$box-sizing: false
|
11
|
+
|
12
|
+
// add special left padding
|
13
|
+
@if type-of($columns) == list
|
14
|
+
@if type-of(nth($columns, $location)) == list
|
15
|
+
padding-left: nth(nth($columns, $location), 2)
|
16
|
+
$box-sizing: true
|
17
|
+
@else if $padding != 0
|
18
|
+
padding-left: $padding
|
19
|
+
$box-sizing: true
|
20
|
+
// add special right padding
|
21
|
+
@if type-of(nth($columns, ($location + $span - 1))) == list
|
22
|
+
padding-right: nth(nth($columns, ($location + $span - 1)), 2)
|
23
|
+
$box-sizing: true
|
24
|
+
@else if $padding != 0
|
25
|
+
padding-right: $padding
|
26
|
+
$box-sizing: true
|
27
|
+
|
28
|
+
@else if $padding != 0
|
29
|
+
padding: 0 $padding
|
30
|
+
$box-sizing: true
|
31
|
+
|
32
|
+
@if $box-sizing
|
33
|
+
+box-sizing(border-box)
|
34
|
+
|
35
|
+
// bump up the counter
|
36
|
+
$grid-counter: $location + $span
|
37
|
+
@if $grid-counter > column-count($columns)
|
38
|
+
$grid-counter: 1
|
39
|
+
margin-right: 0
|
40
|
+
@else
|
41
|
+
margin-right: $gutter
|
42
|
+
|
43
|
+
|
44
|
+
// This writes classes, IDs, or silent objects for you to extend or use in your HTML. They can be written to different breakpoints to extend or call into your HTML as needed.
|
45
|
+
=grid-objects($prefix: a, $columns: $columns, $gutter: $gutter, $padding: $padding, $selector: "%")
|
46
|
+
// counter keeps track of the starting position
|
47
|
+
$count: 0
|
48
|
+
%#{$prefix}column
|
49
|
+
float: left
|
50
|
+
+grid-padding($padding)
|
51
|
+
margin-right: $gutter
|
52
|
+
|
53
|
+
@for $i from 1 through column-count($columns)
|
54
|
+
@for $n from $count + 1 through column-count($columns)
|
55
|
+
#{$selector}#{$prefix}#{$count}-#{$n}
|
56
|
+
@extend %#{$prefix}column
|
57
|
+
width: grid-span($n - $count, $count + 1, $columns, $gutter)
|
58
|
+
@if $n == column-count($columns)
|
59
|
+
margin-right: 0
|
60
|
+
// add special padding
|
61
|
+
@if type-of($columns) == list
|
62
|
+
@if type-of(nth($columns, $count + 1)) == list
|
63
|
+
padding-left: nth(nth($columns, $count + 1), 2)
|
64
|
+
// add special right padding
|
65
|
+
@if type-of(nth($columns, ($n))) == list
|
66
|
+
padding-right: nth(nth($columns, ($n)), 2)
|
67
|
+
$count: $count + 1
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
// Add padding to an object on the grid.
|
72
|
+
=grid-padding($padding)
|
73
|
+
@if $padding != 0
|
74
|
+
padding: 0 $padding
|
75
|
+
+box-sizing(border-box)
|