singularitygs 0.1.alpha → 1.0.alpha.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/lib/singularitygs.rb +2 -2
  2. data/stylesheets/_singularitygs.scss +68 -0
  3. data/stylesheets/singularitygs/_background-grid.scss +49 -0
  4. data/stylesheets/singularitygs/_column.scss +51 -0
  5. data/stylesheets/singularitygs/_grid-plugins.scss +3 -0
  6. data/stylesheets/singularitygs/{_grid-test.sass → _grid-test.scss} +22 -13
  7. data/stylesheets/singularitygs/_grid.scss +6 -0
  8. data/stylesheets/singularitygs/_gutter.scss +45 -0
  9. data/stylesheets/singularitygs/_helpers.scss +3 -0
  10. data/stylesheets/singularitygs/_mixins.scss +7 -0
  11. data/stylesheets/singularitygs/grid-plugins/_compound.scss +49 -0
  12. data/stylesheets/singularitygs/grid-plugins/_ratio-spiral.scss +42 -0
  13. data/stylesheets/singularitygs/grid-plugins/_ratio.scss +4 -0
  14. data/stylesheets/singularitygs/grid-structure/_display-table.scss +1 -0
  15. data/stylesheets/singularitygs/grid-structure/_flexbox.scss +0 -0
  16. data/stylesheets/singularitygs/grid-structure/_float.scss +94 -0
  17. data/stylesheets/singularitygs/grid-structure/_grid-layout.scss +1 -0
  18. data/stylesheets/singularitygs/grid-structure/_isolation.scss +145 -0
  19. data/stylesheets/singularitygs/helpers/_grids.scss +34 -0
  20. data/stylesheets/singularitygs/helpers/_gridsets.scss +362 -0
  21. data/stylesheets/singularitygs/helpers/_lists.scss +29 -0
  22. data/stylesheets/singularitygs/mixins/_base-font-size.scss +63 -0
  23. data/stylesheets/singularitygs/mixins/_container.scss +63 -0
  24. data/stylesheets/singularitygs/mixins/_grid-build.scss +16 -0
  25. data/stylesheets/singularitygs/mixins/_grid-objects.scss +26 -0
  26. data/stylesheets/singularitygs/mixins/_grid-padding.scss +8 -0
  27. data/stylesheets/singularitygs/mixins/_grid-span.scss +9 -0
  28. data/stylesheets/singularitygs/mixins/_push-pull.scss +41 -0
  29. data/templates/project/behaviors/box-sizing/boxsizing.htc +399 -0
  30. data/templates/project/behaviors/box-sizing/boxsizing.php +23 -0
  31. data/templates/project/manifest.rb +4 -0
  32. metadata +39 -22
  33. data/stylesheets/singularitygs.sass +0 -40
  34. data/stylesheets/singularitygs/_background-grid.sass +0 -19
  35. data/stylesheets/singularitygs/_column.sass +0 -25
  36. data/stylesheets/singularitygs/_grid-plugins.sass +0 -2
  37. data/stylesheets/singularitygs/_grid.sass +0 -2
  38. data/stylesheets/singularitygs/_gridsets.scss +0 -242
  39. data/stylesheets/singularitygs/_gutter.sass +0 -4
  40. data/stylesheets/singularitygs/_helpers.sass +0 -37
  41. data/stylesheets/singularitygs/_mixins.sass +0 -75
  42. data/stylesheets/singularitygs/grid-plugins/_compound.sass +0 -30
@@ -0,0 +1,145 @@
1
+ @mixin isolation-clear($dir) {
2
+ @if $dir == 'left' {
3
+ clear: right;
4
+ @if $grouped-styles {
5
+ margin-right: -100%;
6
+ float: left;
7
+ }
8
+ }
9
+ @else if $dir == 'right' {
10
+ clear: left;
11
+ @if $grouped-styles {
12
+ margin-left: -100%;
13
+ float: right;
14
+ }
15
+ }
16
+ @else if $dir == 'both' {
17
+ clear: both;
18
+ @if $grouped-styles {
19
+ margin-right: -100%;
20
+ float: left;
21
+ }
22
+ }
23
+
24
+ @include clearfix;
25
+ }
26
+
27
+ @mixin isolation-common($columns: $columns, $gutter: $gutter, $padding: $padding, $grouped-styles: $grouped-styles) {
28
+ @include box-sizing(border-box);
29
+ *behavior: url("../behaviors/box-sizing/boxsizing.php");
30
+ overflow: hidden;
31
+ *zoom: 1;
32
+
33
+ @if $grouped-styles and $padding != 0 {
34
+ padding-left: $padding;
35
+ padding-right: $padding;
36
+ }
37
+ @if $grouped-styles == false and $padding != 0 {
38
+
39
+ }
40
+ }
41
+
42
+
43
+
44
+ @mixin isolation-section($span, $location: $grid-counter, $columns: $columns, $gutter: $gutter, $padding: $padding, $grouped-styles: $grouped-styles) {
45
+ width: grid-span($span, $location, $columns, $gutter);
46
+ // add special left padding
47
+
48
+ @include grid-location($span, $location, $columns);
49
+
50
+ @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 {
60
+ margin-right: -100%;
61
+ float: left;
62
+ @include isolation-clear('left');
63
+ }
64
+ margin-left: 0;
65
+ }
66
+ @else if $grid-location == 'last' {
67
+ float: right;
68
+ margin-right: 0;
69
+ @include isolation-clear('left');
70
+ }
71
+ }
72
+ @if $dir == rtl {
73
+ @if $grid-location == 'middle' {
74
+ @if $grouped-styles == false {
75
+ margin-left: -100%;
76
+ float: right;
77
+ @include isolation-clear('right');
78
+ }
79
+ }
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
+ @else if $grid-location == 'last' {
89
+ float: left;
90
+ margin-left: 0;
91
+ @include isolation-clear('right');
92
+ }
93
+ }
94
+ @if $dir == both {
95
+ #{$rtl-selector} & {
96
+ @if $grid-location == 'middle' {
97
+ @if $grouped-styles {
98
+ margin-left: -100%;
99
+ float: right;
100
+ @include isolation-clear('right');
101
+ }
102
+ }
103
+ @if $grid-location == 'first' {
104
+ @if $grouped-styles {
105
+ margin-left: -100%;
106
+ float: right;
107
+ @include isolation-clear('right');
108
+ }
109
+ margin-right: 0;
110
+ }
111
+ @if $grid-location == 'last' {
112
+ float: left;
113
+ margin-left: 0;
114
+ @include isolation-clear('right');
115
+ }
116
+ }
117
+ }
118
+
119
+ @include push($location - 1, 1, $columns, $gutter);
120
+
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
+ }
137
+ }
138
+
139
+ @mixin isolation-structure($span, $location, $columns, $gutter, $padding) {
140
+ // common components
141
+ @include isolation-common($columns, $gutter);
142
+
143
+ // specific styles
144
+ @include isolation-section($span, $location, $columns, $gutter);
145
+ }
@@ -0,0 +1,34 @@
1
+ // Find column count
2
+ @function column-count($columns) {
3
+ @if type-of($columns) == number {
4
+ @return $columns;
5
+ }
6
+ @if type-of($columns) == list {
7
+ @return length($columns);
8
+ }
9
+ }
10
+
11
+ // Context of gutters
12
+ @function gutter-context($gutter, $context) {
13
+ @return $gutter * 100% / $context;
14
+ }
15
+
16
+ // First or last column?
17
+ $grid-location: '';
18
+
19
+ @mixin grid-location($span, $location, $columns) {
20
+ $grid-location: '';
21
+
22
+ @if ($span + $location) > column-count($columns) {
23
+ $grid-location: 'last';
24
+ }
25
+ @else if $location == 1 {
26
+ $grid-location: 'first';
27
+ }
28
+ @else if $location == column-count($columns) {
29
+ $grid-location: 'last';
30
+ }
31
+ @else {
32
+ $grid-location: 'middle';
33
+ }
34
+ }
@@ -0,0 +1,362 @@
1
+ //////////////////////////////
2
+ // Find Grid
3
+ //
4
+ // Finds the grid that you are on
5
+ //////////////////////////////
6
+ @function find-grid($user-columns: false) {
7
+ $length: length($grids);
8
+
9
+ @if $user-columns != false {
10
+ @return $user-columns;
11
+ }
12
+ @else if $length > 0 {
13
+ $query-min: breakpoint-get-context('min-width');
14
+ $query-max: breakpoint-get-context('max-width');
15
+
16
+ @if $query-min {
17
+ $query-min: breakpoint-to-base-em($query-min);
18
+ }
19
+ @if $query-max {
20
+ $query-max: breakpoint-to-base-em($query-max);
21
+ }
22
+
23
+ $ghr: () !default;
24
+
25
+ @if $query-min or $query-max {
26
+ @for $j from 2 through $length {
27
+ $ghr: append($ghr, nth($grids, $j), comma);
28
+ }
29
+
30
+ $ghr: reverse($ghr);
31
+
32
+ $holder-length: length($ghr);
33
+
34
+ @for $i from 1 through $holder-length {
35
+ $gridholder: nth($ghr, $i);
36
+
37
+ $grid-columns: nth($gridholder, 1);
38
+ $grid-query: nth($gridholder, 2);
39
+
40
+ $grid-query: breakpoint-to-base-em($grid-query);
41
+
42
+ @if length($gridholder) < 2 {
43
+ @warn 'Grid #{$gridholder} needs a breakpoint value!';
44
+ }
45
+ @else if $grids-mobile-first {
46
+ @if $query-min and not $query-max {
47
+ @if $query-min and $query-max {
48
+ @if $query-min >= $grid-query and $query-max < $grid-query {
49
+ @return $grid-columns;
50
+ }
51
+ }
52
+ @else if $query-min >= $grid-query {
53
+ @return $grid-columns;
54
+ }
55
+ }
56
+ @else {
57
+ @if $query-max < $grid-query {
58
+ @return $grid-columns;
59
+ }
60
+ }
61
+ }
62
+ @else {
63
+ @if $query-min and $query-max {
64
+ @if $query-min > $grid-query and $query-max <= $grid-query {
65
+ @return $grid-columns;
66
+ }
67
+ }
68
+ @else if $query-min and not $query-max {
69
+ @if $query-min > $grid-query {
70
+ @return $grid-columns;
71
+ }
72
+ }
73
+ @else {
74
+ @if $query-max <= $grid-query {
75
+ @return $grid-columns;
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ @else {
82
+ @return nth($grids, 1);
83
+ }
84
+ }
85
+ @else {
86
+ @return $columns;
87
+ }
88
+ }
89
+
90
+ //////////////////////////////
91
+ // Find Gutters
92
+ //
93
+ // Finds the gutter that you should be using
94
+ //////////////////////////////
95
+ @function find-gutter($user-gutter: false) {
96
+ $length: length($grids);
97
+
98
+ @if $user-gutter != false {
99
+ @return $user-gutter;
100
+ }
101
+ @else if $length > 0 {
102
+ $query-min: breakpoint-get-context('min-width');
103
+ $query-max: breakpoint-get-context('max-width');
104
+
105
+ @if $query-min {
106
+ $query-min: breakpoint-to-base-em($query-min);
107
+ }
108
+ @if $query-max {
109
+ $query-max: breakpoint-to-base-em($query-max);
110
+ }
111
+
112
+ $ghr: () !default;
113
+ $ghs: () !default;
114
+ $gutter-length: length($gutters);
115
+
116
+ @if $query-min or $query-max {
117
+ @for $j from 2 through $length {
118
+ $ghr: append($ghr, nth($grids, $j), comma);
119
+
120
+ @if $gutter-length == 0 {
121
+ $ghs: append($ghs, $gutter);
122
+ }
123
+ @else if $j > $gutter-length {
124
+ $ghs: append($ghs, nth($gutters, $gutter-length));
125
+ }
126
+ @else {
127
+ $ghs: append($ghs, nth($gutters, $j));
128
+ }
129
+ }
130
+
131
+ $ghr: reverse($ghr);
132
+ $gthr: reverse($ghs);
133
+
134
+ $holder-length: length($ghr);
135
+
136
+ @for $i from 1 through $holder-length {
137
+ $gridholder: nth($ghr, $i);
138
+
139
+ $grid-columns: nth($gridholder, 1);
140
+ $grid-query: nth($gridholder, 2);
141
+
142
+ $grid-query: breakpoint-to-base-em($grid-query);
143
+
144
+ @if length($gridholder) < 2 {
145
+ @warn 'Grid #{$gridholder} needs a breakpoint value!';
146
+ }
147
+ @else if $grids-mobile-first {
148
+ @if $query-min and not $query-max {
149
+ @if $query-min and $query-max {
150
+ @if $query-min >= $grid-query and $query-max < $grid-query {
151
+ @if $gutter-length > 0 {
152
+ @return nth($gthr, $i);
153
+ }
154
+ @else {
155
+ @return $gutter;
156
+ }
157
+ }
158
+ }
159
+ @else if $query-min >= $grid-query {
160
+ @if $gutter-length > 0 {
161
+ @return nth($gthr, $i);
162
+ }
163
+ @else {
164
+ @return $gutter;
165
+ }
166
+ }
167
+ }
168
+ @else {
169
+ @if $query-max < $grid-query {
170
+ @if $gutter-length > 0 {
171
+ @return nth($gthr, $i);
172
+ }
173
+ @else {
174
+ @return $gutter;
175
+ }
176
+ }
177
+ }
178
+ }
179
+ @else {
180
+ @if $query-min and $query-max {
181
+ @if $query-min > $grid-query and $query-max <= $grid-query {
182
+ @if $gutter-length > 0 {
183
+ @return nth($gthr, $i);
184
+ }
185
+ @else {
186
+ @return $gutter;
187
+ }
188
+ }
189
+ }
190
+ @else if $query-min and not $query-max {
191
+ @if $query-min > $grid-query {
192
+ @if $gutter-length > 0 {
193
+ $gutter-span: nth($gthr, $i);
194
+ }
195
+ @else {
196
+ $gutter-span: $gutter;
197
+ }
198
+ }
199
+ }
200
+ @else {
201
+ @if $query-max <= $grid-query {
202
+ @if $gutter-length > 0 {
203
+ $gutter-span: nth($gthr, $i);
204
+ }
205
+ @else {
206
+ $gutter-span: $gutter;
207
+ }
208
+ }
209
+ }
210
+ }
211
+ }
212
+ }
213
+ @else {
214
+ @if length($gutters) > 0 {
215
+ @return nth($gutters, 1);
216
+ }
217
+ @else {
218
+ @return $gutter;
219
+ }
220
+ }
221
+ }
222
+ @else {
223
+ @return $gutter;
224
+ }
225
+ }
226
+
227
+ //////////////////////////////
228
+ // Find Padding
229
+ //
230
+ // Finds the padding that you should be using
231
+ //////////////////////////////
232
+ @function find-padding($user-padding: false) {
233
+ $length: length($grids);
234
+
235
+ @if $user-padding != false {
236
+ @return $user-padding;
237
+ }
238
+ @else if $length > 0 {
239
+ $query-min: breakpoint-get-context('min-width');
240
+ $query-max: breakpoint-get-context('max-width');
241
+
242
+ @if $query-min {
243
+ $query-min: breakpoint-to-base-em($query-min);
244
+ }
245
+ @if $query-max {
246
+ $query-max: breakpoint-to-base-em($query-max);
247
+ }
248
+
249
+ $ghr: () !default;
250
+ $phs: () !default;
251
+ $padding-length: length($paddings);
252
+
253
+ @if $query-min or $query-max {
254
+ @for $j from 2 through $length {
255
+ $ghr: append($ghr, nth($grids, $j), comma);
256
+
257
+ @if $padding-length == 0 {
258
+ $phs: append($phs, $padding);
259
+ }
260
+ @else if $j > $padding-length {
261
+ $phs: append($phs, nth($paddings, $padding-length));
262
+ }
263
+ @else {
264
+ $phs: append($phs, nth($paddings, $j));
265
+ }
266
+ }
267
+
268
+ $ghr: reverse($ghr);
269
+ $phr: reverse($phs);
270
+
271
+ $holder-length: length($ghr);
272
+
273
+ @for $i from 1 through $holder-length {
274
+ $gridholder: nth($ghr, $i);
275
+
276
+ $grid-columns: nth($gridholder, 1);
277
+ $grid-query: nth($gridholder, 2);
278
+
279
+ $grid-query: breakpoint-to-base-em($grid-query);
280
+
281
+ @if length($gridholder) < 2 {
282
+ @warn 'Grid #{$gridholder} needs a breakpoint value!';
283
+ }
284
+ @else if $grids-mobile-first {
285
+ @if $query-min and not $query-max {
286
+ @if $query-min and $query-max {
287
+ @if $query-min >= $grid-query and $query-max < $grid-query {
288
+ @if $padding-length > 0 {
289
+ @return nth($phr, $i);
290
+ }
291
+ @else {
292
+ @return $padding;
293
+ }
294
+ }
295
+ }
296
+ @else if $query-min >= $grid-query {
297
+ @if $padding-length > 0 {
298
+ @return nth($phr, $i);
299
+ }
300
+ @else {
301
+ @return $padding;
302
+ }
303
+ }
304
+ }
305
+ @else {
306
+ @if $query-max < $grid-query {
307
+ @if $padding-length > 0 {
308
+ @return nth($phr, $i);
309
+ }
310
+ @else {
311
+ @return $padding;
312
+ }
313
+ }
314
+ }
315
+ }
316
+ @else {
317
+ @if $query-min and $query-max {
318
+ @if $query-min > $grid-query and $query-max <= $grid-query {
319
+ @if $padding-length > 0 {
320
+ @return nth($phr, $i);
321
+ }
322
+ @else {
323
+ @return $padding;
324
+ }
325
+ }
326
+ }
327
+ @else if $query-min and not $query-max {
328
+ @if $query-min > $grid-query {
329
+ @if $padding-length > 0 {
330
+ $padding-span: nth($phr, $i);
331
+ }
332
+ @else {
333
+ $padding-span: $padding;
334
+ }
335
+ }
336
+ }
337
+ @else {
338
+ @if $query-max <= $grid-query {
339
+ @if $padding-length > 0 {
340
+ $padding-span: nth($phr, $i);
341
+ }
342
+ @else {
343
+ $padding-span: $padding;
344
+ }
345
+ }
346
+ }
347
+ }
348
+ }
349
+ }
350
+ @else {
351
+ @if length($paddings) > 0 {
352
+ @return nth($paddings, 1);
353
+ }
354
+ @else {
355
+ @return $padding;
356
+ }
357
+ }
358
+ }
359
+ @else {
360
+ @return $padding;
361
+ }
362
+ }