singularitygs 1.1.2 → 1.2.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. checksums.yaml +7 -7
  2. data/lib/singularitygs.rb +2 -2
  3. data/stylesheets/_singularitygs.scss +13 -26
  4. data/stylesheets/singularitygs/_api.scss +89 -29
  5. data/stylesheets/singularitygs/_helpers.scss +6 -2
  6. data/stylesheets/singularitygs/api/_float.scss +87 -147
  7. data/stylesheets/singularitygs/api/_isolation.scss +81 -133
  8. data/stylesheets/singularitygs/grids/_add.scss +34 -16
  9. data/stylesheets/singularitygs/grids/_find.scss +6 -8
  10. data/stylesheets/singularitygs/gutter-styles/_add.scss +39 -16
  11. data/stylesheets/singularitygs/gutter-styles/_find.scss +10 -5
  12. data/stylesheets/singularitygs/gutter-styles/_helpers.scss +6 -10
  13. data/stylesheets/singularitygs/gutters/_add.scss +37 -14
  14. data/stylesheets/singularitygs/gutters/_find.scss +9 -5
  15. data/stylesheets/singularitygs/helpers/_background-grid.scss +155 -181
  16. data/stylesheets/singularitygs/helpers/_box-sizing.scss +17 -32
  17. data/stylesheets/singularitygs/helpers/_clearfix.scss +10 -95
  18. data/stylesheets/singularitygs/helpers/_columns.scss +4 -3
  19. data/stylesheets/singularitygs/helpers/_directions.scss +6 -0
  20. data/stylesheets/singularitygs/helpers/_find.scss +112 -64
  21. data/stylesheets/singularitygs/helpers/_layout.scss +39 -10
  22. data/stylesheets/singularitygs/helpers/_sass-lists.scss +1 -1
  23. data/stylesheets/singularitygs/helpers/_settings.scss +98 -0
  24. data/stylesheets/singularitygs/helpers/_sort.scss +56 -0
  25. data/stylesheets/singularitygs/helpers/_span-shared.scss +20 -2
  26. data/stylesheets/singularitygs/language/_parse-add.scss +52 -8
  27. data/stylesheets/singularitygs/language/_parse-list.scss +3 -3
  28. data/stylesheets/singularitygs/math/_columns.scss +5 -4
  29. data/stylesheets/singularitygs/math/_context.scss +1 -1
  30. data/stylesheets/singularitygs/math/_gutters.scss +2 -1
  31. metadata +63 -54
@@ -34,236 +34,210 @@
34
34
 
35
35
 
36
36
  // -----------------------------------------------
37
- // Imports
38
- @import "compass/css3";
39
37
 
40
38
  // -----------------------------------------------
41
39
  // Grid Overlay
42
-
43
- // The overlay is painted over your container's ::after pseudo-element, so we must
44
- // give position to the container itself, if relative doesn't suit your layout
45
- // it can be replaced by absolute/fixed.
46
- $overlay-position: relative !default;
47
-
48
- // Set the position of the switch.
49
- $overlay-switch-position: left bottom !default;
50
-
51
40
  $background-grid-color: Chocolate !default;
52
-
53
- // Global variable to show or hide the grid background at will.
54
41
  $show-grid-backgrounds: true !default;
55
42
 
56
- @mixin grid-overlay (
57
- $selector: 'body',
58
- $columns: false,
59
- $gutter: false,
60
- $color: $background-grid-color
61
- ) {
62
-
63
- $vert: nth($overlay-switch-position, 1);
64
- $horz: nth($overlay-switch-position, 2);
65
-
66
- head {
67
- display: block;
68
- position: fixed;
69
- #{$horz}: 10px;
70
- #{$vert}: 10px;
71
- z-index: 99;
72
- color: #333;
73
- text-shadow: 0 0 3px #fff;
74
- @include transition(all .4s);
75
- &::before {
76
- content: "||||";
77
- display: block;
78
- padding: 10px 14px;
79
- letter-spacing: -1;
80
- font: {
81
- family: sans-serif;
82
- size: 26px;
83
- weight: bold;
84
- }
85
- }
86
- &:hover {
87
- color: #333;
88
- text-shadow: 1px 1px #fff;
89
- ~ body #{$selector} {
90
- position: unquote($overlay-position);
91
- }
92
- ~ #{$selector}::after,
93
- ~ body #{$selector}::after {
94
- content: " ";
95
- position: absolute;
96
- top: 0;
97
- left: 0;
98
- right: 0;
99
- bottom: 0;
100
- height: 100%;
101
- width: 100%;
102
- @include background-grid($columns, $gutter, $color);
103
- }
104
- }
105
- }
106
- }
107
-
108
- // -----------------------------------------------
109
- // Grid Toggle
110
-
111
- @mixin grid-toggle(
112
- $columns: false,
113
- $gutter: false,
114
- $color: $background-grid-color
115
- ) {
116
-
117
- [data-development-grid="show"] {
118
- @include background-grid($columns, $gutter, $color);
119
- }
120
- }
121
-
122
43
  // -----------------------------------------------
123
44
  // Grid Background
124
45
 
125
46
  @mixin background-grid(
126
- $columns: false,
127
- $gutter: false,
47
+ $columns: null,
48
+ $gutter: null,
49
+ $gutter-style: null,
128
50
  $color: $background-grid-color
129
51
  ) {
130
52
 
131
53
  @if $show-grid-backgrounds {
132
- $background-length: length($grids);
133
-
134
- @if (not $columns) {
135
- $grid: find-grid($columns);
136
- @include background-build($grid, $gutter, $color);
137
- @if ($grid != $grids) {
138
- @for $i from 2 through $background-length {
139
- $mq: nth(nth($grids, $i), 2);
140
- $grid: nth(nth($grids, $i), 1);
141
-
142
- @include breakpoint($mq) {
143
- @include background-build($grid, $gutter, $color);
144
- }
145
- }
146
- }
147
- }
148
- @else {
149
- @include background-build($columns, $gutter, $color);
150
- }
151
-
54
+ $columns: if($columns != null, $columns, sgs-get('grids'));
55
+ $gutter: if($gutter != null, $gutter, sgs-get('gutters'));
56
+ $gutter-style: if($gutter-style != null, $gutter-style, sgs-get('gutter styles'));
152
57
 
58
+ @include background-build($columns, $gutter, $gutter-style, $color)
153
59
  }
154
60
  }
155
61
 
156
- @mixin background-build($columns, $gutter, $color) {
157
- $columns: find-grid($columns);
158
- $gutter: find-gutter($gutter);
62
+ @function background-map($columns, $gutters, $gutter-styles) {
63
+ $Grids: ();
64
+ $Gutters: ();
65
+ $Styles: ();
159
66
 
160
- $gutter-style: find-gutter-style();
161
- $fixed-gutter: fixed-gutter($columns, $gutter);
162
- $split: index($gutter-style, split);
67
+ @if $columns and type-of($columns) != 'map' {
68
+ $Grids: (-1px: $columns);
69
+ }
70
+ @else {
71
+ $Grids: sgs-get('grids');
72
+ }
163
73
 
164
- $widths: ();
165
- $colors: ();
74
+ @if $gutters and type-of($gutters) != 'map' {
75
+ $Gutters: (-1px: $gutters);
76
+ }
77
+ @else {
78
+ $Gutters: sgs-get('gutters');
79
+ }
166
80
 
167
- $length: length($columns);
168
- $symmetric: false;
169
- @if type-of($columns) == 'number' or $length == 1 {
170
- $symmetric: true;
171
- $length: nth($columns, 1);
81
+ @if $gutter-styles and type-of($gutter-styles) != 'map' {
82
+ $Styles: (-1px: $gutter-styles);
83
+ }
84
+ @else {
85
+ $Styles: sgs-get('gutter styles');
172
86
  }
173
87
 
174
- @for $i from 1 through $length {
88
+ // Build 1st Depth Map
89
+ $Holder: ();
175
90
 
176
- @if ($fixed-gutter or $gutter == 0) and $i % 2 == 0 {
177
- $color: darken($color, 15%);
178
- }
179
- @else if ($fixed-gutter or $gutter == 0) and $i % 2 == 1 {
180
- $color: lighten($color, 15%);
91
+ // Grids
92
+ @each $k, $v in $Grids {
93
+ $Holder: map-merge($Holder, ($k: ('grid': $v)));
94
+ }
95
+ // Gutters
96
+ @each $k, $v in $Gutters {
97
+ $Grid: map-get($Holder, $k);
98
+
99
+ $Map: ('gutter': $v);
100
+ @if $Grid != null {
101
+ $Grid: map-get($Grid, 'grid');
102
+ @if $Grid != null {
103
+ $Map: map-merge($Map, ('grid': $Grid));
104
+ }
181
105
  }
182
106
 
183
- $column-span: column-span($i, 1, $columns);
184
- $gutter-span: 0;
185
- @if $fixed-gutter {
186
- $gutter-span: $column-span;
107
+ $Holder: map-merge($Holder, ($k: $Map));
108
+ }
109
+ // Style
110
+ @each $k, $v in $Styles {
111
+ $Grid: map-get($Holder, $k);
112
+ $Gutter: map-get($Holder, $k);
113
+
114
+ $Map: ('style': $v);
115
+ @if $Grid != null {
116
+ $Grid: map-get($Grid, 'grid');
117
+ @if $Grid != null {
118
+ $Map: map-merge($Map, ('grid': $Grid));
119
+ }
187
120
  }
188
- @else {
189
- $gutter-span: $column-span + gutter-span($gutter, $columns);
121
+ @if $Gutter != null {
122
+ $Gutter: map-get($Gutter, 'gutter');
123
+ @if $Gutter != null {
124
+ $Map: map-merge($Map, ('gutter': $Gutter));
125
+ }
190
126
  }
191
127
 
192
- @if $i == 1 and $split and not $fixed-gutter {
193
- $widths: append($widths, gutter-span($gutter, $columns) / 2);
194
- $colors: append($colors, rgba($color, .25));
128
+ $Holder: map-merge($Holder, ($k: $Map));
129
+ }
130
+
131
+ $Holder: sort-map($Holder);
132
+ $Return: ();
133
+
134
+ // Build full stack for each breakpoint
135
+ @for $i from 1 through length($Holder) {
136
+ $Key: nth(nth($Holder, $i), 1);
137
+ $Value: nth(nth($Holder, $i), 2);
138
+
139
+ $Previous: ();
140
+ @if $i > 1 {
141
+ $Previous: nth(nth($Return, $i - 1), 2);
195
142
  }
196
143
 
197
- @if $i != $columns {
198
- $widths: append($widths, $column-span);
199
- $colors: append($colors, rgba($color, .5));
200
- $widths: append($widths, $gutter-span);
201
- $colors: append($colors, rgba($color, .25));
144
+ @if not map-has-key($Value, 'grid') {
145
+ $Sort-Grid: map-get($Previous, 'grid');
146
+ $Value: map-merge($Value, ('grid': $Sort-Grid));
202
147
  }
203
- @else {
204
- $widths: append($widths, $column-span);
205
- $colors: append($colors, rgba($color, .5));
148
+
149
+ @if not map-has-key($Value, 'gutter') {
150
+ $Sort-Gutter: map-get($Previous, 'gutter');
151
+ $Value: map-merge($Value, ('gutter': $Sort-Gutter));
206
152
  }
207
153
 
208
- @if $i == $length and $split and not $fixed-gutter {
209
- $widths: append($widths, $column-span + gutter-span($gutter, $columns) / 2);
210
- $colors: append($colors, rgba($color, .25));
154
+ @if not map-has-key($Value, 'style') {
155
+ $Sort-Style: map-get($Previous, 'style');
156
+ $Value: map-merge($Value, ('style': $Sort-Style));
211
157
  }
212
- }
213
158
 
214
- @include background-gradient-generate($widths, $colors);
159
+ $Return: map-merge($Return, ($Key: $Value));
160
+ }
215
161
 
162
+ @return $Return;
216
163
  }
217
164
 
218
- //////////////////////////////
219
- // Get the columns
220
- //////////////////////////////
221
- @mixin background-gradient-generate($widths, $colors, $direction: left) {
222
- @if (length($widths) != length($colors)) and (length($widths) != length($colors) - 1) {
223
- @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.';
224
- }
225
- @else {
226
- $stops: ();
165
+ @mixin background-build($columns, $gutters, $gutter-styles, $color) {
166
+ $Background-Map: background-map($columns, $gutters, $gutter-styles);
227
167
 
228
- @if length($widths) == (length($colors) - 1) {
229
- $widths: append($widths, 100%);
230
- }
168
+ $Column-Color: $color;
169
+ $Inverse-Column-Color: mix(black, $color, 15%);
170
+ $Gutter-Color: mix(white, $color, 25%);
171
+ $Direction: named-direction(sgs-get('direction'));
231
172
 
232
- $i: 1;
173
+ @each $bkpt, $def in $Background-Map {
174
+ $Grid: map-get($def, 'grid');
175
+ $Gutter: map-get($def, 'gutter');
176
+ $Style: map-get($def, 'style');
233
177
 
234
- @each $width in $widths {
235
- $width: nth($widths, $i);
236
- $color: nth($colors, $i);
178
+ $Grid-Count: column-count($Grid);
237
179
 
238
- @if $i == 1 {
239
- $stops: join($stops, build-gradient-piece($width, $color), comma);
240
- }
241
- @else {
242
- $position: nth($widths, $i - 1);
243
- $stops: join($stops, build-gradient-piece($width, $color, $position), comma);
244
- }
180
+ $Gradient: ();
181
+
182
+ $Gutter-Width: gutter-span($Gutter, $Grid, $Style);
245
183
 
246
- $i: $i + 1;
184
+ @if $Style == 'fixed' {
185
+ $Gutter-Width: 0%;
247
186
  }
187
+ $Counter-Width: 0%;
188
+ $holder: ();
248
189
 
249
- // @debug $stops;
190
+ @for $i from 1 through $Grid-Count {
191
+ $Holder-Gradient: ();
192
+ $Loop-Width: column-span(1, $i, $Grid, $Gutter, $Style);
250
193
 
194
+ @if index($Style, 'split') and $i == 1 {
195
+ $Counter-Width: ($Gutter-Width / 2);
196
+ $Gradient: append($Gradient, ($Gutter-Color, $Gutter-Color $Counter-Width), 'comma');
197
+ }
251
198
 
199
+ $Loop-Color: $Column-Color;
200
+ @if (index($Style, 'fixed') or $Gutter == 0) and ($i % 2 == 0 ) {
201
+ $Loop-Color: $Inverse-Column-Color;
202
+ }
252
203
 
253
- @include background-image(
254
- linear-gradient($direction, $stops)
255
- );
256
- }
257
- }
204
+ @if $i != $Grid-Count {
205
+ $Gradient: append($Gradient, ($Loop-Color $Counter-Width, $Loop-Color ($Counter-Width + $Loop-Width)), 'comma');
206
+ $Counter-Width: $Counter-Width + $Loop-Width;
207
+ $Gradient: append($Gradient, ($Gutter-Color $Counter-Width, $Gutter-Color ($Counter-Width + $Gutter-Width)), 'comma');
208
+ $Counter-Width: $Counter-Width + $Gutter-Width;
209
+ }
210
+ @else if $i == 1 {
211
+ $Gradient: append($Gradient, ($Loop-Color, $Loop-Color $Counter-Width, $Gutter-Color $Counter-Width, $Gutter-Color ($Counter-Width + $Gutter-Width)), 'comma');
212
+ $Counter-Width: $Counter-Width + $Loop-Width + $Gutter-Width;
213
+ }
214
+ @else if $i == $Grid-Count and index($Style, 'split') {
215
+ $Gradient: append($Gradient, ($Loop-Color $Counter-Width, $Loop-Color ($Counter-Width + $Loop-Width)), 'comma');
216
+ $Counter-Width: $Counter-Width + $Loop-Width;
217
+ $Gradient: append($Gradient, ($Gutter-Color $Counter-Width, $Gutter-Color ($Counter-Width + ($Gutter-Width / 2))), 'comma');
218
+ }
219
+ @else {
220
+ $Gradient: append($Gradient, ($Loop-Color $Counter-Width, $Loop-Color), 'comma');
221
+ }
222
+ }
258
223
 
259
- @function build-gradient-piece($width, $color, $position: false) {
260
- @if ($position == 'last') {
261
- @return ($color $width);
262
- }
263
- @else if ($position != false) {
264
- @return $color $position, $color $width;
265
- }
266
- @else {
267
- @return $color, $color $width;
224
+ @if $bkpt != -1px {
225
+ @include breakpoint($bkpt) {
226
+ @if mixin-exists(background-image) and function-exists(linear-gradient) {
227
+ @include background-image(
228
+ linear-gradient($Direction, $Gradient)
229
+ );
230
+ }
231
+ background-image: linear-gradient(to opposite-direction($Direction), $Gradient);
232
+ }
233
+ }
234
+ @else {
235
+ @if mixin-exists(background-image) and function-exists(linear-gradient) {
236
+ @include background-image(
237
+ linear-gradient($Direction, $Gradient)
238
+ );
239
+ }
240
+ background-image: linear-gradient(to opposite-direction($Direction), $Gradient);
241
+ }
268
242
  }
269
243
  }
@@ -1,41 +1,26 @@
1
- @import "compass/css3/shared";
2
-
3
- $box-sizing-extend: true !default;
4
- $toolkit-box-sizing: false !default;
5
-
6
1
  //////////////////////////////
7
- // Updated Box Sizing mixin, allowing for behavior support
2
+ // Box Sizing Mixin
8
3
  //////////////////////////////
9
- @mixin box-sizing($bs, $extend: $box-sizing-extend) {
10
- @if $extend and $bs == 'border-box' {
11
- @extend %border-box;
12
- }
13
- @else if $extend and $bs == 'content-box' {
14
- @extend %content-box;
4
+ $box-sizing-extend: false !default;
5
+
6
+ @mixin box-sizing($value, $extend: $box-sizing-extend) {
7
+ @if $extend {
8
+ @extend %singularity-#{$value};
15
9
  }
16
10
  @else {
17
- $bs: unquote($bs);
18
- @include experimental(box-sizing, $bs,
19
- -moz, -webkit, not -o, not -ms, not -khtml, official
20
- );
21
-
22
- @if $bs == 'border-box' {
23
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
24
- *behavior: stylesheet-url("../behaviors/box-sizing/boxsizing.php");
25
- }
26
- }
27
- @else {
28
- *behavior: none;
29
- }
11
+ -moz-box-sizing: $value;
12
+ box-sizing: $value;
30
13
  }
31
14
  }
32
15
 
33
- @if not $toolkit-box-sizing {
34
- %border-box {
35
- @include box-sizing('border-box', false);
36
- }
16
+ %singularity-content-box {
17
+ @include box-sizing(content-box, false);
18
+ }
37
19
 
38
- %content-box {
39
- @include box-sizing('content-box', false);
40
- }
20
+ %singularity-border-box {
21
+ @include box-sizing(border-box, false);
22
+ }
23
+
24
+ %singularity-padding-box {
25
+ @include box-sizing(padding-box, false);
41
26
  }
@@ -1,106 +1,21 @@
1
- $legacy-support-for-ie6: false !default;
2
- $legacy-support-for-ie7: false !default;
3
- $legacy-support-for-mozilla: false !default;
4
-
5
1
  //////////////////////////////
6
- // Massive Clearfix Mixin
7
- //
8
- // Clearfix mixin for all of your clearfixing needs. Will choose the right mixin for you.
9
- // Can choose whether to extend or to write.
2
+ // Clearfix Mixin
10
3
  //////////////////////////////
11
4
  $clearfix-extend: false !default;
12
- $clearfix-direct: false !default;
13
- $toolkit-clearfix: false !default;
14
-
15
- @mixin clearfix($extend: $clearfix-extend, $direct: $clearfix-direct) {
16
- @if (($legacy-support-for-ie6 or $legacy-support-for-ie7) and not $legacy-support-for-mozilla and $direct != 'legacy' and $direct != 'modern') or ($direct == 'micro') {
17
- @if $extend {
18
- @extend %clearfix-micro;
19
- }
20
- @else {
21
- /* for IE 6/7 */
22
- *zoom: expression(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).style.cssText="clear:both;font:0/0 serif");
23
- /* non-JS fallback */
24
- *zoom: 1;
25
-
26
- &:before,
27
- &:after {
28
- content: "";
29
- display: table;
30
- }
31
-
32
- &:after {
33
- clear: both;
34
- }
35
- }
36
- }
37
- @else if (($legacy-support-for-ie6 or $legacy-support-for-ie7) and $legacy-support-for-mozilla and $direct != 'micro' and $direct != 'modern') or ($direct == 'legacy') {
38
- @if $extend {
39
- @extend %clearfix-legacy;
40
- }
41
- @else {
42
- /* for IE 6/7 */
43
- *zoom: expression(this.runtimeStyle.zoom="1", this.appendChild(document.createElement("br")).style.cssText="clear:both;font:0/0 serif");
44
- /* non-JS fallback */
45
- *zoom: 1;
46
5
 
47
- &:before,
48
- &:after {
49
- content: ".";
50
- display: block;
51
- height: 0;
52
- overflow: hidden;
53
- }
54
-
55
- &:after {
56
- clear: both;
57
- }
58
- }
6
+ @mixin clearfix($extend: $clearfix-extend) {
7
+ @if $extend {
8
+ @extend %singularity-clearfix;
59
9
  }
60
10
  @else {
61
- @if $extend {
62
- @extend %clearfix
63
- }
64
- @else {
65
- &:after {
66
- content: "";
67
- display: table;
68
- clear: both;
69
- }
11
+ &:after {
12
+ content: "";
13
+ display: table;
14
+ clear: both;
70
15
  }
71
16
  }
72
17
  }
73
18
 
74
- @if not $toolkit-clearfix {
75
- //////////////////////////////
76
- // Legacy Clearfix
77
- //
78
- // For when you need full Legacy support, including old IE and old Firefox
79
- //
80
- // From http://www.css-101.org/articles/clearfix/latest-new-clearfix-so-far.php
81
- //////////////////////////////
82
- %clearfix-legacy {
83
- @include clearfix(false, 'legacy');
84
- }
85
-
86
- //////////////////////////////
87
- // Micro Clearfix
88
- //
89
- // For when you need old IE support, but not concerned with old Firefox
90
- // From http://nicolasgallagher.com/better-float-containment-in-ie/
91
- //////////////////////////////
92
- %clearfix-micro {
93
- @include clearfix(false, 'micro');
94
- }
95
-
96
- //////////////////////////////
97
- // Modern Clearfix
98
- //
99
- // Clearfix for modern browsers, especiall when using border-box
100
- //
101
- // From http://www.css-101.org/articles/clearfix/latest-new-clearfix-so-far.php
102
- //////////////////////////////
103
- %clearfix {
104
- @include clearfix(false, 'modern');
105
- }
19
+ %singularity-clearfix {
20
+ @include clearfix(false);
106
21
  }
@@ -1,6 +1,4 @@
1
1
  @function end-row($span, $location, $columns) {
2
- $columns: find-grid($columns);
3
-
4
2
  @if $location == 'last' or $location == 'omega' {
5
3
  @return true;
6
4
  }
@@ -15,7 +13,10 @@
15
13
  }
16
14
 
17
15
  @function start-row($location) {
18
- @if $location == 1 {
16
+ @if $location == 'first' or $location == 'alpha' {
17
+ @return true;
18
+ }
19
+ @else if $location == 1 {
19
20
  @return true;
20
21
  }
21
22
  @else {
@@ -14,6 +14,12 @@
14
14
  @else if $dir == 'rtl' {
15
15
  @return ltr;
16
16
  }
17
+ @else if $dir == 'top' {
18
+ @return bottom;
19
+ }
20
+ @else if $dir == 'bottom' {
21
+ @return top;
22
+ }
17
23
  @else {
18
24
  @warn "#{$dir} is not a direction! Make sure your direction is all lowercase!";
19
25
  @return false;