singularitygs 1.0.alpha.0 → 1.0.alpha.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.
data/lib/singularitygs.rb CHANGED
@@ -5,6 +5,6 @@ require 'breakpoint'
5
5
  Compass::Frameworks.register("singularitygs", :path => "#{File.dirname(__FILE__)}/..")
6
6
 
7
7
  module SingularityGS
8
- VERSION = "1.0.alpha.0"
8
+ VERSION = "1.0.alpha.1"
9
9
  DATE = "2012-11-06"
10
10
  end
@@ -38,10 +38,10 @@ $container-to-ems: false !default;
38
38
  $base-font-size: 1em !default;
39
39
 
40
40
  // Structural templates for grid
41
- $grouped-styles: false !default;
42
41
  $output: 'isolation' !default;
43
- @import "singularitygs/grid-structure/isolation";
44
- @import "singularitygs/grid-structure/float";
42
+
43
+
44
+ @import "singularitygs/grid-structure";
45
45
 
46
46
  // Helpers return think like list sums and column counts
47
47
  @import "singularitygs/helpers";
@@ -0,0 +1,14 @@
1
+ @import "grid-structure/float";
2
+ @import "grid-structure/isolation";
3
+
4
+ // main structure mixin
5
+ @mixin grid-structure($output, $span, $location, $columns, $gutter, $padding, $grid-output-block: both) {
6
+
7
+ @if $output == float {
8
+ @include float-structure($span, $location, $columns, $gutter, $padding, $grid-output-block)
9
+ }
10
+
11
+ @if $output == isolation {
12
+ @include isolation-structure($span, $location, $columns, $gutter, $padding, $grid-output-block)
13
+ }
14
+ }
@@ -8,7 +8,7 @@
8
8
  }
9
9
  @else {
10
10
  @each $column in $columns {
11
- $resolution: $resolution + $column;
11
+ $resolution: $resolution + nth($column, 1);
12
12
  }
13
13
  }
14
14
 
@@ -1,4 +1,4 @@
1
- @mixin float-clear($dir) {
1
+ @mixin float-clear($dir, $grid-output-block: both) {
2
2
  @if $dir == 'left' {
3
3
  clear: right;
4
4
  }
@@ -12,50 +12,47 @@
12
12
  @include clearfix;
13
13
  }
14
14
 
15
- @mixin float-common($columns: $columns, $gutter: $gutter, $padding: $padding, $grouped-styles: $grouped-styles) {
16
- @include box-sizing(border-box);
17
- *behavior: url("../behaviors/box-sizing/boxsizing.php");
18
- overflow: hidden;
19
- *zoom: 1;
20
-
21
- @if $grouped-styles and $padding != 0 {
22
- padding-left: $padding;
23
- padding-right: $padding;
24
- }
25
- @if $grouped-styles == false and $padding != 0 {
15
+ @mixin float-common($columns: $columns, $gutter: $gutter, $padding: $padding, $grid-output-block: common) {
16
+ @if $grid-output-block != section {
17
+ @include box-sizing(border-box);
18
+ *behavior: url("../behaviors/box-sizing/boxsizing.php");
19
+ overflow: hidden;
20
+ *zoom: 1;
26
21
 
22
+ @if $grid-output-block == both or $grid-output-block == common {
23
+ @if $padding != 0 {
24
+ @if type-of($padding) == 'list' {
25
+ padding-left: nth($padding, 1);
26
+ padding-right: nth($padding, 2);
27
+ }
28
+ @else {
29
+ padding-left: $padding;
30
+ padding-right: $padding;
31
+ }
32
+ }
33
+ }
27
34
  }
28
35
  }
29
36
 
30
37
 
31
38
 
32
- @mixin float-section($span, $location: $grid-counter, $columns: $columns, $gutter: $gutter, $padding: $padding, $grouped-styles: $grouped-styles) {
33
- width: grid-span($span, $location, $columns, $gutter);
34
- // add special left padding
35
- @include grid-location($span, $location, $columns);
36
-
37
- @if $dir == ltr or $dir == both {
38
- @if $grid-location == 'middle' or $grid-location == 'first'{
39
- float: left;
40
- margin-right: gutter-span($gutter, $columns);
41
- }
42
- @else if $grid-location == 'last' {
43
- float: right;
44
- }
45
- @include float-clear('left');
46
- }
47
- @if $dir == rtl {
48
- @if $grid-location == 'middle' or $grid-location == 'first' {
49
- float: right;
50
- margin-left: gutter-span($gutter, $columns);
51
- }
52
- @else if $grid-location == 'last' {
53
- float: left;
39
+ @mixin float-section($span, $location: $grid-counter, $columns: $columns, $gutter: $gutter, $padding: $padding, $grid-output-block: section) {
40
+ @if $grid-output-block == section or $grid-output-block == both {
41
+ width: grid-span($span, $location, $columns, $gutter);
42
+ // add special left padding
43
+ @include grid-location($span, $location, $columns);
44
+
45
+ @if $dir == ltr or $dir == both {
46
+ @if $grid-location == 'middle' or $grid-location == 'first'{
47
+ float: left;
48
+ margin-right: gutter-span($gutter, $columns);
49
+ }
50
+ @else if $grid-location == 'last' {
51
+ float: right;
52
+ }
53
+ @include float-clear('left');
54
54
  }
55
- @include float-clear('right');
56
- }
57
- @if $dir == both {
58
- #{$rtl-selector} & {
55
+ @if $dir == rtl {
59
56
  @if $grid-location == 'middle' or $grid-location == 'first' {
60
57
  float: right;
61
58
  margin-left: gutter-span($gutter, $columns);
@@ -65,30 +62,37 @@
65
62
  }
66
63
  @include float-clear('right');
67
64
  }
68
- }
69
-
70
- // Padding
71
- @if type-of($columns) == list {
72
- @if type-of(nth($columns, $location)) == list {
73
- padding-left: nth(nth($columns, $location), 2);
74
- }
75
- @else if $padding != 0 {
76
- padding-left: $padding;
77
- }
78
- // add special right padding
79
- @if type-of(nth($columns, $location + $span - 1)) == list {
80
- padding-right: nth(nth($columns, $location + $span - 1), 2);
81
- }
82
- @else if $padding != 0 {
83
- padding-right: $padding;
65
+ @if $dir == both {
66
+ #{$rtl-selector} & {
67
+ @if $grid-location == 'middle' or $grid-location == 'first' {
68
+ float: right;
69
+ margin-left: gutter-span($gutter, $columns);
70
+ }
71
+ @else if $grid-location == 'last' {
72
+ float: left;
73
+ }
74
+ @include float-clear('right');
75
+ }
84
76
  }
85
77
  }
86
78
  }
87
79
 
88
- @mixin float-structure($span, $location, $columns, $gutter, $padding) {
89
- // common components
90
- @include float-common($columns, $gutter);
80
+ // main structure mixin
81
+ @mixin float-structure($span, $location, $columns, $gutter, $padding, $grid-output-block: both) {
82
+
83
+ // Full output
84
+ @if $grid-output-block == both {
85
+ @include float-common($columns, $gutter, $padding, $grid-output-block);
86
+ @include float-section($span, $location, $columns, $gutter, $padding, $grid-output-block);
87
+ }
88
+
89
+ // Only the shared components
90
+ @if $grid-output-block == common {
91
+ @include float-common($columns, $gutter, $padding, $grid-output-block);
92
+ }
91
93
 
92
- // specific styles
93
- @include float-section($span, $location, $columns, $gutter);
94
+ // Only the section components
95
+ @if $grid-output-block == section {
96
+ @include float-section($span, $location, $columns, $gutter, $padding, $grid-output-block);
97
+ }
94
98
  }
@@ -1,21 +1,21 @@
1
- @mixin isolation-clear($dir) {
1
+ @mixin isolation-clear($dir, $grid-output-block: both) {
2
2
  @if $dir == 'left' {
3
3
  clear: right;
4
- @if $grouped-styles {
4
+ @if $grid-output-block == common {
5
5
  margin-right: -100%;
6
6
  float: left;
7
7
  }
8
8
  }
9
9
  @else if $dir == 'right' {
10
10
  clear: left;
11
- @if $grouped-styles {
11
+ @if $grid-output-block == common {
12
12
  margin-left: -100%;
13
13
  float: right;
14
14
  }
15
15
  }
16
16
  @else if $dir == 'both' {
17
17
  clear: both;
18
- @if $grouped-styles {
18
+ @if $grid-output-block == common {
19
19
  margin-right: -100%;
20
20
  float: left;
21
21
  }
@@ -24,44 +24,66 @@
24
24
  @include clearfix;
25
25
  }
26
26
 
27
- @mixin isolation-common($columns: $columns, $gutter: $gutter, $padding: $padding, $grouped-styles: $grouped-styles) {
27
+ @mixin isolation-common($columns: $columns, $gutter: $gutter, $padding: $padding, $grid-output-block: common) {
28
28
  @include box-sizing(border-box);
29
29
  *behavior: url("../behaviors/box-sizing/boxsizing.php");
30
30
  overflow: hidden;
31
- *zoom: 1;
32
31
 
33
- @if $grouped-styles and $padding != 0 {
34
- padding-left: $padding;
35
- padding-right: $padding;
32
+ @if $grid-output-block == both or $grid-output-block == common {
33
+ @if $padding != 0 {
34
+ @if type-of($padding) == 'list' {
35
+ padding-left: nth($padding, 1);
36
+ padding-right: nth($padding, 2);
37
+ }
38
+ @else {
39
+ padding-left: $padding;
40
+ padding-right: $padding;
41
+ }
42
+ }
36
43
  }
37
- @if $grouped-styles == false and $padding != 0 {
38
44
 
45
+
46
+ @if $dir == ltr or $dir == both {
47
+ @if $grid-output-block == common {
48
+ margin-right: -100%;
49
+ float: left;
50
+ @include isolation-clear('left');
51
+ }
52
+ }
53
+ @if $dir == rtl {
54
+ @if $grid-output-block == common {
55
+ margin-left: -100%;
56
+ float: right;
57
+ @include isolation-clear('right');
58
+ }
59
+ }
60
+ @if $dir == both {
61
+ #{$rtl-selector} & {
62
+ @if $grid-output-block == common {
63
+ margin-left: -100%;
64
+ float: right;
65
+ @include isolation-clear('right');
66
+ }
67
+ }
39
68
  }
69
+
40
70
  }
41
71
 
42
72
 
43
73
 
44
- @mixin isolation-section($span, $location: $grid-counter, $columns: $columns, $gutter: $gutter, $padding: $padding, $grouped-styles: $grouped-styles) {
74
+ @mixin isolation-section($span, $location: $grid-counter, $columns: $columns, $gutter: $gutter, $padding: $padding, $grid-output-block: section) {
45
75
  width: grid-span($span, $location, $columns, $gutter);
46
76
  // add special left padding
47
77
 
48
78
  @include grid-location($span, $location, $columns);
49
79
 
50
80
  @if $dir == ltr or $dir == both {
51
- @if $grid-location == 'middle' {
52
- @if $grouped-styles == false {
53
- margin-right: -100%;
54
- float: left;
55
- @include isolation-clear('left');
56
- }
57
- }
58
- @else if $grid-location == 'first' {
59
- @if $grouped-styles == false {
81
+ @if $grid-location == 'first' or $grid-location == 'middle' {
82
+ @if $grid-output-block == both {
60
83
  margin-right: -100%;
61
84
  float: left;
62
85
  @include isolation-clear('left');
63
86
  }
64
- margin-left: 0;
65
87
  }
66
88
  @else if $grid-location == 'last' {
67
89
  float: right;
@@ -70,21 +92,13 @@
70
92
  }
71
93
  }
72
94
  @if $dir == rtl {
73
- @if $grid-location == 'middle' {
74
- @if $grouped-styles == false {
95
+ @if grid-location == 'first' or $grid-location == 'middle' {
96
+ @if $grid-output-block == both {
75
97
  margin-left: -100%;
76
98
  float: right;
77
99
  @include isolation-clear('right');
78
100
  }
79
101
  }
80
- @else if grid-location == 'first' {
81
- @if $grouped-styles {
82
- margin-left: -100%;
83
- float: right;
84
- @include isolation-clear('right');
85
- }
86
- margin-right: 0;
87
- }
88
102
  @else if $grid-location == 'last' {
89
103
  float: left;
90
104
  margin-left: 0;
@@ -94,14 +108,14 @@
94
108
  @if $dir == both {
95
109
  #{$rtl-selector} & {
96
110
  @if $grid-location == 'middle' {
97
- @if $grouped-styles {
111
+ @if $grid-output-block == both {
98
112
  margin-left: -100%;
99
113
  float: right;
100
114
  @include isolation-clear('right');
101
115
  }
102
116
  }
103
117
  @if $grid-location == 'first' {
104
- @if $grouped-styles {
118
+ @if $grid-output-block == both {
105
119
  margin-left: -100%;
106
120
  float: right;
107
121
  @include isolation-clear('right');
@@ -115,31 +129,26 @@
115
129
  }
116
130
  }
117
131
  }
118
-
132
+
119
133
  @include push($location - 1, 1, $columns, $gutter);
134
+ }
120
135
 
121
- // Padding
122
- @if type-of($columns) == list {
123
- @if type-of(nth($columns, $location)) == list {
124
- padding-left: nth(nth($columns, $location), 2);
125
- }
126
- @else if $padding != 0 {
127
- padding-left: $padding;
128
- }
129
- // add special right padding
130
- @if type-of(nth($columns, $location + $span - 1)) == list {
131
- padding-right: nth(nth($columns, $location + $span - 1), 2);
132
- }
133
- @else if $padding != 0 {
134
- padding-right: $padding;
135
- }
136
+ // main structure mixin
137
+ @mixin isolation-structure($span, $location, $columns, $gutter, $padding, $grid-output-block: both) {
138
+
139
+ // Full output
140
+ @if $grid-output-block == both {
141
+ @include isolation-common($columns, $gutter, $padding, $grid-output-block);
142
+ @include isolation-section($span, $location, $columns, $gutter, $padding, $grid-output-block);
136
143
  }
137
- }
138
144
 
139
- @mixin isolation-structure($span, $location, $columns, $gutter, $padding) {
140
- // common components
141
- @include isolation-common($columns, $gutter);
145
+ // Only the shared components
146
+ @if $grid-output-block == common {
147
+ @include isolation-common($columns, $gutter, $padding, $grid-output-block);
148
+ }
142
149
 
143
- // specific styles
144
- @include isolation-section($span, $location, $columns, $gutter);
150
+ // Only the section components
151
+ @if $grid-output-block == section {
152
+ @include isolation-section($span, $location, $columns, $gutter, $padding, $grid-output-block);
153
+ }
145
154
  }
@@ -5,7 +5,7 @@
5
5
  //////////////////////////////
6
6
  @function find-grid($user-columns: false) {
7
7
  $length: length($grids);
8
-
8
+
9
9
  @if $user-columns != false {
10
10
  @return $user-columns;
11
11
  }
@@ -19,18 +19,18 @@
19
19
  @if $query-max {
20
20
  $query-max: breakpoint-to-base-em($query-max);
21
21
  }
22
-
22
+
23
23
  $ghr: () !default;
24
-
24
+
25
25
  @if $query-min or $query-max {
26
26
  @for $j from 2 through $length {
27
27
  $ghr: append($ghr, nth($grids, $j), comma);
28
28
  }
29
-
29
+
30
30
  $ghr: reverse($ghr);
31
-
31
+
32
32
  $holder-length: length($ghr);
33
-
33
+
34
34
  @for $i from 1 through $holder-length {
35
35
  $gridholder: nth($ghr, $i);
36
36
 
@@ -94,7 +94,7 @@
94
94
  //////////////////////////////
95
95
  @function find-gutter($user-gutter: false) {
96
96
  $length: length($grids);
97
-
97
+
98
98
  @if $user-gutter != false {
99
99
  @return $user-gutter;
100
100
  }
@@ -108,15 +108,15 @@
108
108
  @if $query-max {
109
109
  $query-max: breakpoint-to-base-em($query-max);
110
110
  }
111
-
111
+
112
112
  $ghr: () !default;
113
113
  $ghs: () !default;
114
114
  $gutter-length: length($gutters);
115
-
115
+
116
116
  @if $query-min or $query-max {
117
117
  @for $j from 2 through $length {
118
118
  $ghr: append($ghr, nth($grids, $j), comma);
119
-
119
+
120
120
  @if $gutter-length == 0 {
121
121
  $ghs: append($ghs, $gutter);
122
122
  }
@@ -127,12 +127,12 @@
127
127
  $ghs: append($ghs, nth($gutters, $j));
128
128
  }
129
129
  }
130
-
130
+
131
131
  $ghr: reverse($ghr);
132
132
  $gthr: reverse($ghs);
133
-
133
+
134
134
  $holder-length: length($ghr);
135
-
135
+
136
136
  @for $i from 1 through $holder-length {
137
137
  $gridholder: nth($ghr, $i);
138
138
 
@@ -229,13 +229,39 @@
229
229
  //
230
230
  // Finds the padding that you should be using
231
231
  //////////////////////////////
232
- @function find-padding($user-padding: false) {
232
+ @function find-padding($user-padding: false, $span: false, $location: false, $columns: false) {
233
233
  $length: length($grids);
234
-
234
+
235
235
  @if $user-padding != false {
236
236
  @return $user-padding;
237
237
  }
238
- @else if $length > 0 {
238
+
239
+ @if ($span and $location and $columns) {
240
+ @if type-of($columns) == list {
241
+ $padding-left: false;
242
+ $padding-right: false;
243
+
244
+ @if type-of(nth($columns, $location)) == 'list' {
245
+ $padding-left: nth(nth($columns, $location), 2);
246
+ }
247
+
248
+ @if type-of(nth($columns, $location + $span - 1)) == 'list' {
249
+ $padding-right: nth(nth($columns, $location + $span - 1), 2);
250
+ }
251
+
252
+ @if $padding-left and $padding-right {
253
+ $padding: join($padding-left, $padding-right);
254
+ }
255
+ @else if $padding-left {
256
+ @return $padding-left;
257
+ }
258
+ @else if $padding-right {
259
+ @return $padding-right;
260
+ }
261
+ }
262
+ }
263
+
264
+ @if $length > 0 {
239
265
  $query-min: breakpoint-get-context('min-width');
240
266
  $query-max: breakpoint-get-context('max-width');
241
267
 
@@ -245,15 +271,15 @@
245
271
  @if $query-max {
246
272
  $query-max: breakpoint-to-base-em($query-max);
247
273
  }
248
-
274
+
249
275
  $ghr: () !default;
250
276
  $phs: () !default;
251
277
  $padding-length: length($paddings);
252
-
278
+
253
279
  @if $query-min or $query-max {
254
280
  @for $j from 2 through $length {
255
281
  $ghr: append($ghr, nth($grids, $j), comma);
256
-
282
+
257
283
  @if $padding-length == 0 {
258
284
  $phs: append($phs, $padding);
259
285
  }
@@ -264,12 +290,12 @@
264
290
  $phs: append($phs, nth($paddings, $j));
265
291
  }
266
292
  }
267
-
293
+
268
294
  $ghr: reverse($ghr);
269
295
  $phr: reverse($phs);
270
-
296
+
271
297
  $holder-length: length($ghr);
272
-
298
+
273
299
  @for $i from 1 through $holder-length {
274
300
  $gridholder: nth($ghr, $i);
275
301
 
@@ -1,12 +1,7 @@
1
1
  @mixin grid-build($span, $location, $columns, $gutter, $padding, $output) {
2
2
 
3
3
 
4
- @if $output == 'isolation' {
5
- @include isolation-structure($span, $location, $columns, $gutter, $padding);
6
- }
7
- @else if $output == 'float' {
8
- @include float-structure($span, $location, $columns, $gutter, $padding);
9
- }
4
+ @include grid-structure($output, $span, $location, $columns, $gutter, $padding);
10
5
 
11
6
  // bump up the counter
12
7
  $grid-counter: $location + $span;
@@ -6,7 +6,9 @@
6
6
  // counter keeps track of the starting position
7
7
  $count: 0;
8
8
  %#{$prefix}column {
9
- @include structure-common($columns, $gutter, $padding, true);
9
+
10
+ @include grid-structure($output, 1, 1, $columns, $gutter, $padding, common);
11
+
10
12
  }
11
13
 
12
14
 
@@ -16,8 +18,8 @@
16
18
  #{$selector}#{$prefix}#{$n}-#{$count + 1} {
17
19
 
18
20
  @extend %#{$prefix}column;
19
-
20
- @include structure-section($n, $count + 1, $columns, $gutter, $padding, true);
21
+ @include grid-structure($output, $n, $count + 1, $columns, $gutter, $padding, section);
22
+
21
23
  }
22
24
  }
23
25
 
@@ -1,9 +1,12 @@
1
- // Converted old Gridset into Grid Span.
1
+ // The top-level mixin to use on adding elements to a grid.
2
+
3
+ // This step folds in multiple grids and figures out what should
4
+ // be loaded and figures out what breakpoint you are at.
2
5
  @mixin grid-span($span, $location, $columns: false, $gutter-span: false, $padding-span: false, $output: $output) {
3
-
6
+
4
7
  $columns: find-grid($columns);
5
8
  $gutter-span: find-gutter($gutter-span);
6
- $padding-span: find-padding($padding-span);
7
-
9
+ $padding-span: find-padding($padding-span, $span, $location, $columns);
10
+
8
11
  @include grid-build($span, $location, $columns, $gutter-span, $padding-span, $output);
9
12
  }
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 1
7
7
  - 0
8
8
  - alpha
9
- - 0
10
- version: 1.0.alpha.0
9
+ - 1
10
+ version: 1.0.alpha.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Scott Kellum
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-11-06 00:00:00 -08:00
19
+ date: 2012-11-06 00:00:00 -05:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -91,6 +91,7 @@ files:
91
91
  - stylesheets/singularitygs/_background-grid.scss
92
92
  - stylesheets/singularitygs/_column.scss
93
93
  - stylesheets/singularitygs/_grid-plugins.scss
94
+ - stylesheets/singularitygs/_grid-structure.scss
94
95
  - stylesheets/singularitygs/_grid-test.scss
95
96
  - stylesheets/singularitygs/_grid.scss
96
97
  - stylesheets/singularitygs/_gutter.scss