susy 1.0.9 → 2.2.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +1 -1
  3. data/README.md +20 -115
  4. data/VERSION +1 -1
  5. data/docs/changelog.rst +783 -0
  6. data/lib/compass-susy.rb +1 -0
  7. data/lib/susy.rb +14 -4
  8. data/sass/_su.scss +4 -0
  9. data/sass/_susy.scss +3 -15
  10. data/sass/_susyone.scss +4 -0
  11. data/sass/susy/_su.scss +7 -0
  12. data/sass/susy/language/_susy.scss +24 -0
  13. data/sass/susy/language/_susyone.scss +13 -0
  14. data/sass/susy/language/susy/_background.scss +385 -0
  15. data/sass/susy/language/susy/_bleed.scss +200 -0
  16. data/sass/susy/language/susy/_box-sizing.scss +47 -0
  17. data/sass/susy/language/susy/_breakpoint-plugin.scss +185 -0
  18. data/sass/susy/language/susy/_container.scss +81 -0
  19. data/sass/susy/language/susy/_context.scss +36 -0
  20. data/sass/susy/language/susy/_gallery.scss +94 -0
  21. data/sass/susy/language/susy/_grids.scss +64 -0
  22. data/sass/susy/language/susy/_gutters.scss +154 -0
  23. data/sass/susy/language/susy/_isolate.scss +77 -0
  24. data/sass/susy/language/susy/_margins.scss +94 -0
  25. data/sass/susy/language/susy/_padding.scss +74 -0
  26. data/sass/susy/language/susy/_rows.scss +138 -0
  27. data/sass/susy/language/susy/_settings.scss +216 -0
  28. data/sass/susy/language/susy/_span.scss +163 -0
  29. data/sass/susy/language/susy/_validation.scss +16 -0
  30. data/sass/susy/{_background.scss → language/susyone/_background.scss} +0 -0
  31. data/sass/susy/{_functions.scss → language/susyone/_functions.scss} +23 -22
  32. data/sass/susy/{_grid.scss → language/susyone/_grid.scss} +76 -50
  33. data/sass/susy/{_isolation.scss → language/susyone/_isolation.scss} +0 -0
  34. data/sass/susy/{_margin.scss → language/susyone/_margin.scss} +0 -0
  35. data/sass/susy/{_media.scss → language/susyone/_media.scss} +26 -33
  36. data/sass/susy/{_padding.scss → language/susyone/_padding.scss} +0 -0
  37. data/sass/susy/{_settings.scss → language/susyone/_settings.scss} +4 -0
  38. data/sass/susy/output/_float.scss +9 -0
  39. data/sass/susy/output/_shared.scss +15 -0
  40. data/sass/susy/output/_support.scss +9 -0
  41. data/sass/susy/output/float/_container.scss +16 -0
  42. data/sass/susy/output/float/_end.scss +40 -0
  43. data/sass/susy/output/float/_isolate.scss +22 -0
  44. data/sass/susy/output/float/_span.scss +35 -0
  45. data/sass/susy/output/shared/_background.scss +26 -0
  46. data/sass/susy/output/shared/_container.scss +21 -0
  47. data/sass/susy/output/shared/_direction.scss +42 -0
  48. data/sass/susy/output/shared/_inspect.scss +25 -0
  49. data/sass/susy/output/shared/_margins.scss +23 -0
  50. data/sass/susy/output/shared/_output.scss +14 -0
  51. data/sass/susy/output/shared/_padding.scss +23 -0
  52. data/sass/susy/output/support/_background.scss +58 -0
  53. data/sass/susy/output/support/_box-sizing.scss +19 -0
  54. data/sass/susy/output/support/_clearfix.scss +18 -0
  55. data/sass/susy/output/support/_prefix.scss +19 -0
  56. data/sass/susy/output/support/_rem.scss +22 -0
  57. data/sass/susy/output/support/_support.scss +95 -0
  58. data/sass/susy/su/_grid.scss +103 -0
  59. data/sass/susy/su/_settings.scss +73 -0
  60. data/sass/susy/su/_utilities.scss +111 -0
  61. data/sass/susy/su/_validation.scss +57 -0
  62. data/templates/project/_grids.scss +9 -0
  63. data/templates/project/manifest.rb +6 -10
  64. data/templates/project/style.scss +4 -0
  65. metadata +106 -111
  66. data/CHANGELOG.mkdn +0 -296
  67. data/Manifest +0 -39
  68. data/Rakefile +0 -19
  69. data/sass/susy/_support.scss +0 -198
  70. data/sass/susy/_units.scss +0 -159
  71. data/susy.gemspec +0 -35
  72. data/templates/project/_base.scss +0 -14
  73. data/templates/project/screen.scss +0 -12
  74. data/test/config.rb +0 -10
  75. data/test/css/background.css +0 -16
  76. data/test/css/bleed.css +0 -20
  77. data/test/css/functions.css +0 -7
  78. data/test/css/grid.css +0 -134
  79. data/test/css/isolation.css +0 -46
  80. data/test/css/margin.css +0 -20
  81. data/test/css/media.css +0 -101
  82. data/test/css/padding.css +0 -12
  83. data/test/scss/background.scss +0 -11
  84. data/test/scss/bleed.scss +0 -19
  85. data/test/scss/functions.scss +0 -15
  86. data/test/scss/grid.scss +0 -77
  87. data/test/scss/isolation.scss +0 -19
  88. data/test/scss/margin.scss +0 -27
  89. data/test/scss/media.scss +0 -50
  90. data/test/scss/padding.scss +0 -19
@@ -0,0 +1,16 @@
1
+ // Validation
2
+ // ==========
3
+
4
+
5
+ // Validate Column Math
6
+ // --------------------
7
+ @function valid-column-math(
8
+ $math,
9
+ $column-width
10
+ ) {
11
+ @if $math == static and not($column-width) {
12
+ @error 'Static math requires a valid column-width setting.';
13
+ }
14
+
15
+ @return $column-width;
16
+ }
@@ -57,8 +57,8 @@ $rem-with-px-fallback : true !default;
57
57
  $columns : $total-columns
58
58
  ) {
59
59
  @if round($columns) != $columns {
60
- @warn "Susy works best with integer column-spans.
61
- For partial-columns, you may need to finesse the math by hand using functions directly.";
60
+ @warn "Susy works best with integer column-spans." +
61
+ "For partial-columns, you may need to finesse the math by hand using functions directly.";
62
62
  }
63
63
  @return ($columns * $column-width) + (if($columns >= 1, ceil($columns - 1), 0) * $gutter-width);
64
64
  }
@@ -92,7 +92,7 @@ $rem-with-px-fallback : true !default;
92
92
  $outerwidth: if($width, $width, columns-width($columns));
93
93
 
94
94
  @if $width {
95
- @if not $border-box-sizing { $outerwidth: handle-grid-padding($outerwidth, subtract); }
95
+ @if not($border-box-sizing) { $outerwidth: handle-grid-padding($outerwidth, subtract); }
96
96
  } @else {
97
97
  @if $border-box-sizing { $outerwidth: handle-grid-padding($outerwidth, add); }
98
98
  }
@@ -190,7 +190,7 @@ $rem-with-px-fallback : true !default;
190
190
  @if $request == 'position' {
191
191
  @return $pos;
192
192
  } @else {
193
- @warn '"#{$request}"" is not a valid value for $request';
193
+ @warn '"#{$request}" is not a valid value for $request';
194
194
  }
195
195
  }
196
196
  }
@@ -245,7 +245,12 @@ $rem-with-px-fallback : true !default;
245
245
  }
246
246
 
247
247
  // This name will be deprecated...
248
- @function absolute-ems($ems, $font-size: $base-font-size){ @return base-ems($ems, $font-size); }
248
+ @function absolute-ems(
249
+ $ems,
250
+ $font-size: $base-font-size
251
+ ){
252
+ @return base-ems( $ems, $font-size);
253
+ }
249
254
 
250
255
  // Return a length, after any em-values have been sent through absolute-ems().
251
256
  //
@@ -288,7 +293,7 @@ $rem-with-px-fallback : true !default;
288
293
  $layout : $val;
289
294
  $has-layout : true;
290
295
  } @else {
291
- @if ($has-layout) and (not $media) {
296
+ @if ($has-layout) and not($media) {
292
297
  $max: $val;
293
298
  } @else {
294
299
  @if $media {
@@ -314,12 +319,12 @@ $rem-with-px-fallback : true !default;
314
319
  $min: nth($media,2);
315
320
  }
316
321
  } @else {
317
- @warn "Can't compare incompatible units.
318
- Using #{$min} for min-width, and #{$max} for max-width";
322
+ @warn "Can't compare incompatible units." +
323
+ "Using #{$min} for min-width, and #{$max} for max-width";
319
324
  }
320
325
  @if (length($media) > 2) {
321
- @warn "You can only send two lengths: a min-width and an (optional) max-width.
322
- You sent #{length($media)}: #{$media}";
326
+ @warn "You can only send two lengths: a min-width and an (optional) max-width." +
327
+ "You sent #{length($media)}: #{$media}";
323
328
  }
324
329
  }
325
330
  }
@@ -335,20 +340,16 @@ $rem-with-px-fallback : true !default;
335
340
  // Return the nearest layout (column-count) above a given breakpoint.
336
341
  //
337
342
  // $min : The min-width media-query breakpoint above which to establish a new layout.
338
- @function get-layout (
343
+ @function get-layout(
339
344
  $min
340
345
  ) {
341
- $columns : 1;
342
- $layout-width : container-outer-width($columns);
343
- $return : false;
344
- $min : fix-ems($min);
345
-
346
- @if comparable($min, $layout-width) {
347
- @while $min >= $layout-width {
348
- $columns : $columns + 1;
349
- $layout-width : container-outer-width($columns);
350
- }
351
- $return : $columns;
346
+ $min : fix-ems($min);
347
+ $return : false;
348
+
349
+ @if comparable($min, $column-width) {
350
+ $return : ceil(($min + $gutter-width) / ($column-width + $gutter-width));
351
+ } @else {
352
+ @warn "Can't determine a layout, becuse #{$min} and #{$column-width} are not comparable.";
352
353
  }
353
354
 
354
355
  @return $return;
@@ -10,7 +10,7 @@
10
10
  // Apply the border-box sizing model to all elements
11
11
  // and adjust the grid math appropriately.
12
12
  @mixin border-box-sizing {
13
- $border-box-sizing: true;
13
+ $border-box-sizing: true !global;
14
14
  * { @include box-sizing(border-box); }
15
15
  }
16
16
 
@@ -22,18 +22,34 @@
22
22
  // $columns : The number of columns in the Grid Layout.
23
23
  @mixin set-container-width(
24
24
  $columns : $total-columns,
25
- $style : $container-style
25
+ $style : $container-style,
26
+ $px-vals : $pixel-values-only
26
27
  ){
27
28
  $width: container-outer-width($columns);
28
29
 
29
30
  @if $style == 'static' {
30
- @include if-rem(width, $width);
31
+ @if $px-vals == true {
32
+ width: round(convert-length($width, px));
33
+ } @else {
34
+ @include rem(width, $width);
35
+ }
31
36
  } @else {
32
37
  @if $style == 'fluid' {
33
- @if unit($width) == '%' { @include if-rem(width, $width); }
38
+ @if unit($width) == '%' {
39
+ @if $px-vals == true {
40
+ width: round(convert-length($width, px));
41
+ } @else {
42
+ @include rem(width, $width);
43
+ }
44
+ }
34
45
  } @else {
35
- @include if-rem(max-width, $width);
36
- @if $legacy-support-for-ie6 {
46
+ @if $px-vals == true {
47
+ max-width: round(convert-length($width, px));
48
+ } @else {
49
+ @include rem(max-width, $width);
50
+ }
51
+
52
+ @include for-legacy-browser(ie,"6") {
37
53
  @if unit($width) == 'rem' {
38
54
  _width: round(convert-length($width, px));
39
55
  } @else {
@@ -48,12 +64,18 @@
48
64
  //
49
65
  // $columns : The number of columns in the container.
50
66
  @mixin apply-container(
51
- $columns : $total-columns
67
+ $columns : $total-columns,
68
+ $px-vals : $pixel-values-only
52
69
  ){
53
70
  @include pie-clearfix;
54
71
  @include set-container-width($columns);
55
- @include if-rem(padding-left, $grid-padding);
56
- @include if-rem(padding-right, $grid-padding);
72
+ @if $px-vals == true {
73
+ padding-left: round(convert-length($grid-padding, px));
74
+ padding-right: round(convert-length($grid-padding, px));
75
+ } @else {
76
+ @include rem(padding-left, $grid-padding);
77
+ @include rem(padding-right, $grid-padding);
78
+ }
57
79
  margin: { left: auto; right: auto; }
58
80
  }
59
81
 
@@ -64,31 +86,16 @@
64
86
  // : Two optional lengths (representing min and max-width media-query breakpoints).
65
87
  // $media-layout-2 ...-10 : [optional] Same as $media-layout-1
66
88
  @mixin container(
67
- $media-layout-1 : $total-columns,
68
- $media-layout-2 : false,
69
- $media-layout-3 : false,
70
- $media-layout-4 : false,
71
- $media-layout-5 : false,
72
- $media-layout-6 : false,
73
- $media-layout-7 : false,
74
- $media-layout-8 : false,
75
- $media-layout-9 : false,
76
- $media-layout-10 : false
89
+ $media-layouts...
77
90
  ){
78
- $media-layouts : compact($media-layout-2,$media-layout-3,$media-layout-4,$media-layout-5,$media-layout-6,$media-layout-7,$media-layout-8,$media-layout-9,$media-layout-10);
79
-
80
- @if is-default-layout($media-layout-1) {
81
- @include apply-container();
82
- } @else {
83
- @include at-breakpoint($media-layout-1) {
84
- @include apply-container();
85
- }
86
- }
91
+ $media-layouts: if(length($media-layouts) > 0, $media-layouts, $total-columns);
87
92
 
88
93
  @each $ml in $media-layouts {
89
- @if $ml {
94
+ @if is-default-layout($ml) {
95
+ @include apply-container;
96
+ } @else {
90
97
  @include at-breakpoint($ml) {
91
- @include set-container-width;
98
+ @include apply-container;
92
99
  }
93
100
  }
94
101
  }
@@ -144,7 +151,9 @@
144
151
  } @else {
145
152
  float: $from;
146
153
  margin-#{$to}: gutter($context, $style);
147
- @if $legacy-support-for-ie6 { display: inline; }
154
+ @include for-legacy-browser(ie, "6") {
155
+ display: inline;
156
+ }
148
157
  }
149
158
  }
150
159
 
@@ -162,9 +171,11 @@
162
171
  float: $omega-float;
163
172
  margin-#{$to}: 0;
164
173
 
165
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
174
+ @include for-legacy-browser(ie, "6", "7") {
166
175
  *margin-#{$hack}: - $gutter-width;
167
- @if $legacy-support-for-ie6 { display: inline; }
176
+ @include for-legacy-browser(ie, "6") {
177
+ display: inline;
178
+ }
168
179
  }
169
180
  }
170
181
 
@@ -179,12 +190,20 @@
179
190
  $from : $from-direction
180
191
  ) {
181
192
  $from : unquote($from);
182
- $ie: if($n == "first", true, false);
183
- @include adjust-support-for($ie6: $ie, $ie7: $ie, $ie8: $ie) {
184
- &:#{format-nth($n,$selector)} { @include omega($from); }
193
+
194
+ &:#{format-nth($n,$selector)} {
195
+ @if $n == "first" {
196
+ @include omega($from);
197
+ } @else {
198
+ @include with-browser-ranges(css-sel3) {
199
+ @include omega($from);
200
+ }
201
+ }
185
202
  }
186
203
  }
187
204
 
205
+
206
+
188
207
  // ---------------------------------------------------------------------------
189
208
  // Resets
190
209
 
@@ -202,9 +221,11 @@
202
221
  width: auto;
203
222
  margin-#{$to}: auto;
204
223
 
205
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
224
+ @include for-legacy-browser(ie, "6", "7") {
206
225
  *margin-#{$hack}: auto;
207
- @if $legacy-support-for-ie6 { display: block; }
226
+ @include for-legacy-browser(ie, "6") {
227
+ display: block;
228
+ }
208
229
  }
209
230
  }
210
231
 
@@ -226,7 +247,7 @@
226
247
  float: $from;
227
248
  margin-#{$to}: gutter($context, $style);
228
249
 
229
- @if $legacy-support-for-ie6 or $legacy-support-for-ie7 {
250
+ @include for-legacy-browser(ie, "6", "7") {
230
251
  *margin-#{$hack}: auto;
231
252
  }
232
253
  }
@@ -246,14 +267,19 @@
246
267
  $style : fix-static-misalignment()
247
268
  ) {
248
269
  $from : unquote($from);
249
- $ie: if($n == "first", true, false);
250
- @include adjust-support-for($ie6: $ie, $ie7: $ie, $ie8: $ie) {
251
- &:#{format-nth($n,$selector)} {
270
+
271
+ &:#{format-nth($n,$selector)} {
272
+ @if $n == "first" {
252
273
  @include remove-omega($context, $from, $style);
274
+ } @else {
275
+ @include with-browser-ranges(css-sel3) {
276
+ @include remove-omega($context, $from, $style);
277
+ }
253
278
  }
254
279
  }
255
280
  }
256
281
 
282
+
257
283
  // ---------------------------------------------------------------------------
258
284
  // Change Settings
259
285
 
@@ -270,17 +296,17 @@
270
296
  $default-padding: $grid-padding;
271
297
 
272
298
  // use the new settings
273
- $total-columns: $columns;
274
- $column-width: $width;
275
- $gutter-width: $gutter;
276
- $grid-padding: $padding;
299
+ $total-columns: $columns !global;
300
+ $column-width: $width !global;
301
+ $gutter-width: $gutter !global;
302
+ $grid-padding: $padding !global;
277
303
 
278
304
  // apply to contents
279
305
  @content;
280
306
 
281
307
  // re-instate the defaults
282
- $total-columns: $default-columns;
283
- $column-width: $default-width;
284
- $gutter-width: $default-gutter;
285
- $grid-padding: $default-padding;
308
+ $total-columns: $default-columns !global;
309
+ $column-width: $default-width !global;
310
+ $gutter-width: $default-gutter !global;
311
+ $grid-padding: $default-padding !global;
286
312
  }
@@ -9,13 +9,13 @@
9
9
  ) {
10
10
  // store default $total-columns setting for later, then change it.
11
11
  $default-layout : $total-columns;
12
- $total-columns : $layout-cols;
12
+ $total-columns : $layout-cols !global;
13
13
 
14
14
  // apply children in this new layout context.
15
15
  @content;
16
16
 
17
17
  // return to default $total-columns setting.
18
- $total-columns : $default-layout;
18
+ $total-columns : $default-layout !global;
19
19
  }
20
20
 
21
21
  // Nest a block of code inside a new media-query and layout context.
@@ -36,7 +36,7 @@
36
36
  $max : nth($media-layout,3);
37
37
  $ie : nth($media-layout,4);
38
38
 
39
- @if (not $breakpoint-media-output) and (not $breakpoint-ie-output) and (not $breakpoint-raw-output) {
39
+ @if not($breakpoint-media-output) and not($breakpoint-ie-output) and not($breakpoint-raw-output) {
40
40
  @warn "Either $breakpoint-media-output, $breakpoint-ie-output, or $breakpoint-raw-output must be true for at-breakpoint to work.";
41
41
  }
42
42
 
@@ -44,7 +44,7 @@
44
44
  @if $min or $layout or $max {
45
45
 
46
46
  // If we don't have a layout, we create one based on the min-width.
47
- @if not $layout {
47
+ @if not($layout) {
48
48
  $layout: get-layout($min);
49
49
  }
50
50
 
@@ -53,35 +53,31 @@
53
53
  // Set our new layout context.
54
54
  @include layout($layout) {
55
55
  @if $breakpoint-media-output {
56
- // Capture current state of ie support and set new
57
- $atbreak-legacy-ie-matrix: capture-legacy-ie-matrix();
58
- @include set-legacy-ie-support;
59
-
60
- @if $min and $max {
61
- // Both $min and $max
62
- @media (min-width: $min) and (max-width: $max) {
63
- @content;
64
- }
65
- } @else {
66
- @if (not $min) and (not $max) {
67
- // Neither $min nor $max:
68
- // We can create a breakpoint based on the number of columns in the layout.
69
- $min: fix-ems(container-outer-width($width: false));
70
- }
71
- @if $min {
72
- // Min only:
73
- @media (min-width: $min) {
56
+ @include with-browser-ranges(css-mediaqueries) {
57
+ @if $min and $max {
58
+ // Both $min and $max
59
+ @media (min-width: $min) and (max-width: $max) {
74
60
  @content;
75
61
  }
76
62
  } @else {
77
- // Max only:
78
- @media (max-width: $max) {
79
- @content;
63
+ @if not($min) and not($max) {
64
+ // Neither $min nor $max:
65
+ // We can create a breakpoint based on the number of columns in the layout.
66
+ $min: fix-ems(container-outer-width($width: false));
67
+ }
68
+ @if $min {
69
+ // Min only:
70
+ @media (min-width: $min) {
71
+ @content;
72
+ }
73
+ } @else {
74
+ // Max only:
75
+ @media (max-width: $max) {
76
+ @content;
77
+ }
80
78
  }
81
79
  }
82
80
  }
83
- // Return legacy-ie support to original
84
- @include set-legacy-ie-support($atbreak-legacy-ie-matrix...);
85
81
  }
86
82
  // Set an IE fallback
87
83
  @if $ie and $breakpoint-ie-output {
@@ -89,10 +85,7 @@
89
85
  $ie: 'lt-ie9';
90
86
  }
91
87
  .#{$ie} & {
92
- $atbreak-experimental-matrix: capture-experimental-matrix();
93
- @include set-experimental-support($ms: true);
94
88
  @content;
95
- @include set-experimental-support($atbreak-experimental-matrix...);
96
89
  }
97
90
  }
98
91
 
@@ -101,12 +94,12 @@
101
94
  }
102
95
  }
103
96
  } @else {
104
- @warn "Something went horribly wrong here. Try adjusting your variables.";
97
+ @warn "We were unable to determine a layout for your breakpoint.";
105
98
  }
106
99
 
107
100
  } @else {
108
- @warn "You need to provide either a valid layout (number of columns)
109
- or a valid media-query min-width breakpoint (length).";
101
+ @warn "You need to provide either a valid layout (number of columns)"
102
+ + "or a valid media-query min-width breakpoint (length).";
110
103
  }
111
104
 
112
105
  }