susy 2.0.0.beta.3 → 2.0.0.rc.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -29
  3. data/VERSION +1 -1
  4. data/docs/changelog.rst +32 -1
  5. data/sass/susy/_math.scss +1 -0
  6. data/sass/susy/language/_susy.scss +0 -2
  7. data/sass/susy/language/_susyone.scss +0 -4
  8. data/sass/susy/language/susy/_background.scss +31 -25
  9. data/sass/susy/language/susy/_bleed.scss +4 -4
  10. data/sass/susy/language/susy/_box-sizing.scss +1 -1
  11. data/sass/susy/language/susy/_container.scss +1 -1
  12. data/sass/susy/language/susy/_gallery.scss +2 -2
  13. data/sass/susy/language/susy/_gutters.scss +3 -3
  14. data/sass/susy/language/susy/_rows.scss +2 -2
  15. data/sass/susy/language/susy/_settings.scss +68 -116
  16. data/sass/susy/language/susy/_span.scss +2 -2
  17. data/sass/susy/language/susyone/_functions.scss +2 -2
  18. data/sass/susy/language/susyone/_grid.scss +5 -5
  19. data/sass/susy/math/_maps.scss +89 -0
  20. data/sass/susy/math/_settings.scss +51 -0
  21. data/sass/susy/math/_validation.scss +13 -7
  22. data/sass/susy/output/_float.scss +0 -1
  23. data/sass/susy/output/_shared.scss +3 -1
  24. data/sass/susy/output/_support.scss +9 -0
  25. data/sass/susy/output/float/_end.scss +11 -3
  26. data/sass/susy/output/float/_isolate.scss +10 -6
  27. data/sass/susy/output/float/_span.scss +10 -6
  28. data/sass/susy/output/shared/_background.scss +10 -20
  29. data/sass/susy/output/shared/_container.scss +7 -3
  30. data/sass/susy/output/shared/_margins.scss +6 -2
  31. data/sass/susy/output/shared/_output.scss +14 -0
  32. data/sass/susy/output/shared/_padding.scss +6 -2
  33. data/sass/susy/output/support/_background.scss +58 -0
  34. data/sass/susy/output/support/_box-sizing.scss +17 -0
  35. data/sass/susy/output/support/_clearfix.scss +18 -0
  36. data/sass/susy/output/support/_prefix.scss +19 -0
  37. data/sass/susy/output/support/_rem.scss +22 -0
  38. data/sass/susy/output/support/_support.scss +82 -0
  39. metadata +14 -14
  40. data/sass/susy/language/_shared.scss +0 -4
  41. data/sass/susy/language/shared/_maps.scss +0 -85
  42. data/sass/susy/language/susyone/_units.scss +0 -159
  43. data/sass/susy/output/float/_clearfix.scss +0 -15
  44. data/sass/susy/output/shared/_box-sizing.scss +0 -16
@@ -23,10 +23,10 @@
23
23
  @include nobreak;
24
24
  }
25
25
 
26
- @include susy-box-sizing($box);
26
+ @include output((box-sizing: $box));
27
27
  @include float-span-output($output...);
28
28
 
29
- @if type-of($nesting) == number and unitless($nesting) {
29
+ @if valid-columns($nesting, silent) {
30
30
  @include nested($span) { @content; }
31
31
  } @else {
32
32
  @content;
@@ -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
  }
@@ -335,7 +335,7 @@ $rem-with-px-fallback : true !default;
335
335
  // Return the nearest layout (column-count) above a given breakpoint.
336
336
  //
337
337
  // $min : The min-width media-query breakpoint above which to establish a new layout.
338
- @function get-layout (
338
+ @function get-layout(
339
339
  $min
340
340
  ) {
341
341
  $min : fix-ems($min);
@@ -27,12 +27,12 @@
27
27
  $width: container-outer-width($columns);
28
28
 
29
29
  @if $style == 'static' {
30
- @include if-rem(width, $width);
30
+ @include rem(width, $width);
31
31
  } @else {
32
32
  @if $style == 'fluid' {
33
- @if unit($width) == '%' { @include if-rem(width, $width); }
33
+ @if unit($width) == '%' { @include rem(width, $width); }
34
34
  } @else {
35
- @include if-rem(max-width, $width);
35
+ @include rem(max-width, $width);
36
36
  @include for-legacy-browser(ie,"6") {
37
37
  @if unit($width) == 'rem' {
38
38
  _width: round(convert-length($width, px));
@@ -52,8 +52,8 @@
52
52
  ){
53
53
  @include pie-clearfix;
54
54
  @include set-container-width($columns);
55
- @include if-rem(padding-left, $grid-padding);
56
- @include if-rem(padding-right, $grid-padding);
55
+ @include rem(padding-left, $grid-padding);
56
+ @include rem(padding-right, $grid-padding);
57
57
  margin: { left: auto; right: auto; }
58
58
  }
59
59
 
@@ -0,0 +1,89 @@
1
+ // Map Functions
2
+ // =============
3
+
4
+
5
+ // Truncate List
6
+ // -------------
7
+ // - Return a list, truncated to a given length
8
+ @function _susy-truncate-list(
9
+ $list,
10
+ $length
11
+ ) {
12
+ $_return: ();
13
+
14
+ @for $i from 1 through length($list) {
15
+ $_return: if($i <= $length, append($_return, nth($list, $i)), $_return);
16
+ }
17
+
18
+ @return $_return;
19
+ }
20
+
21
+
22
+ // Deep Get
23
+ // --------
24
+ // - Return a value deep in nested maps
25
+ @function _susy-deep-get(
26
+ $map,
27
+ $keys...
28
+ ) {
29
+ $_return: $map;
30
+
31
+ @each $key in $keys {
32
+ @if type-of($_return) == map {
33
+ $_return: map-get($_return, $key);
34
+ }
35
+ }
36
+
37
+ @return $_return;
38
+ }
39
+
40
+
41
+ // Deep Set
42
+ // --------
43
+ // - Set a value deep in nested maps
44
+ @function _susy-deep-set(
45
+ $map,
46
+ $keys-value...
47
+ ) {
48
+ $_value: nth($keys-value, -1);
49
+ $_keys: _susy-truncate-list($keys-value, length($keys-value) - 1);
50
+ $_length: length($_keys);
51
+ $_return: ();
52
+
53
+ @for $i from 1 through $_length {
54
+ $_n: 0 - $i;
55
+ $_level: _susy-truncate-list($_keys, $_length + $_n);
56
+ $_level: _susy-deep-get($map, $_level...);
57
+ $_merge: (nth($_keys, $_n): $_value);
58
+ $_return: if($_level, map-merge($_level, $_merge), $_merge);
59
+ $_value: $_return;
60
+ }
61
+
62
+ @return $_return;
63
+ }
64
+
65
+
66
+ // Deep Has-Key
67
+ // ------------
68
+ // - Return true if a deep key exists
69
+ @function _susy-deep-has-key(
70
+ $map,
71
+ $keys...
72
+ ) {
73
+ $_return: null;
74
+ $_stop: false;
75
+
76
+ @each $key in $keys {
77
+ @if not $_stop {
78
+ $_return: map-has-key($map, $key);
79
+ }
80
+
81
+ @if $_return {
82
+ $map: map-get($map, $key);
83
+ } @else {
84
+ $_stop: true;
85
+ }
86
+ }
87
+
88
+ @return $_return;
89
+ }
@@ -5,6 +5,7 @@
5
5
  // -------
6
6
  $susy-version: 2.0;
7
7
 
8
+
8
9
  // Default Settings
9
10
  // ----------------
10
11
  // PRIVATE: The basic settings
@@ -13,6 +14,15 @@ $susy-defaults: (
13
14
  gutters: 1/4,
14
15
  );
15
16
 
17
+
18
+ // User Settings
19
+ // -------------
20
+ // - Define the $susy variable with a map of your own settings.
21
+ // - Set EITHER $column-width OR $container
22
+ // - Use $column-width for static layouts
23
+ $susy: () !default;
24
+
25
+
16
26
  // Susy Defaults
17
27
  // -------------
18
28
  // PRIVATE: Add defaults to Susy
@@ -21,3 +31,44 @@ $susy-defaults: (
21
31
  ) {
22
32
  $susy-defaults: map-merge($susy-defaults, $defaults) !global;
23
33
  }
34
+
35
+
36
+ // Susy Set
37
+ // --------
38
+ // Change one setting
39
+ // - $key : setting name
40
+ // - $value : setting value
41
+ @mixin susy-set(
42
+ $key-value...
43
+ ) {
44
+ $susy: _susy-deep-set($susy, $key-value...) !global;
45
+ }
46
+
47
+
48
+ // Susy Get
49
+ // --------
50
+ // Return one setting from a grid
51
+ // - $key : <keyword>
52
+ // - $layout : <settings>
53
+ @function susy-get(
54
+ $key,
55
+ $layout: map-merge($susy-defaults, $susy)
56
+ ) {
57
+ $layout: parse-grid($layout);
58
+ $_options: $layout $susy $susy-defaults;
59
+ $_break: false;
60
+ $_return: null;
61
+
62
+ @each $opt in $_options {
63
+ @if type-of($opt) == map and not $_break {
64
+ $_keyset: _susy-deep-has-key($opt, $key...);
65
+ @if $_keyset {
66
+ $_return: _susy-deep-get($opt, $key...);
67
+ $_break: true;
68
+ }
69
+ }
70
+ }
71
+
72
+ @return $_return;
73
+ }
74
+
@@ -5,7 +5,8 @@
5
5
  // -------------
6
6
  // Check that a column setting is valid.
7
7
  @function valid-columns(
8
- $columns
8
+ $columns,
9
+ $silent: false
9
10
  ) {
10
11
  $type: type-of($columns);
11
12
  $return: null;
@@ -21,26 +22,31 @@
21
22
  $return: if($fail, $return, $columns);
22
23
  }
23
24
 
24
- @if $return != $columns {
25
+ @if $return != $columns and not $silent {
26
+ $return: null;
25
27
  $warn: '$columns must be a unitless number or list of unitless numbers.';
26
28
  @warn $warn + ' Current value [#{$type}]: #{$columns}';
27
- } @else {
28
- @return $return;
29
29
  }
30
+
31
+ @return $return;
30
32
  }
31
33
 
32
34
  // Valid Gutters
33
35
  // -------------
34
36
  // Check that a gutter setting is valid.
35
37
  @function valid-gutters(
36
- $gutters
38
+ $gutters,
39
+ $silent: false
37
40
  ) {
38
41
  $type: type-of($gutters);
42
+ $return: null;
39
43
 
40
44
  @if $type == number and unitless($gutters) {
41
- @return $gutters;
42
- } @else {
45
+ $return: $gutters;
46
+ } @else if not $silent {
43
47
  $warn: '$gutters must be a unitless number.';
44
48
  @warn $warn + ' Current value [#{$type}]: #{$gutters}';
45
49
  }
50
+
51
+ @return $return;
46
52
  }
@@ -3,7 +3,6 @@
3
3
 
4
4
  @import "shared";
5
5
 
6
- @import "float/clearfix";
7
6
  @import "float/container";
8
7
  @import "float/span";
9
8
  @import "float/end";
@@ -1,7 +1,9 @@
1
1
  // Shared API
2
2
  // ==========
3
3
 
4
- @import "shared/box-sizing";
4
+ @import "support";
5
+
6
+ @import "shared/output";
5
7
  @import "shared/direction";
6
8
  @import "shared/background";
7
9
  @import "shared/container";
@@ -0,0 +1,9 @@
1
+ // Susy Browser Support
2
+ // ====================
3
+
4
+ @import "support/prefix";
5
+ @import "support/background";
6
+ @import "support/box-sizing";
7
+ @import "support/rem";
8
+ @import "support/clearfix";
9
+ @import "support/support";
@@ -18,8 +18,12 @@
18
18
  ) {
19
19
  $to: to($flow);
20
20
 
21
- float: if($last-flow == to, $to, null);
22
- margin-#{$to}: $margin;
21
+ $output: (
22
+ float: if($last-flow == to, $to, null),
23
+ margin-#{$to}: $margin,
24
+ );
25
+
26
+ @include output($output);
23
27
  }
24
28
 
25
29
  // Float First
@@ -28,5 +32,9 @@
28
32
  @mixin float-first(
29
33
  $flow: map-get($susy-defaults, flow)
30
34
  ) {
31
- margin-#{from($flow)}: 0;
35
+ $output: (
36
+ margin-#{from($flow)}: 0,
37
+ );
38
+
39
+ @include output($output);
32
40
  }
@@ -7,12 +7,16 @@
7
7
  // - [$flow] : ltr | rtl
8
8
  @mixin isolate-output(
9
9
  $push,
10
- $flow : map-get($susy-defaults, flow)
10
+ $flow: map-get($susy-defaults, flow)
11
11
  ) {
12
- $to : to($flow);
13
- $from : from($flow);
12
+ $to: to($flow);
13
+ $from: from($flow);
14
14
 
15
- float: $from;
16
- margin-#{$from}: $push;
17
- margin-#{$to}: -100%;
15
+ $output: (
16
+ float: $from,
17
+ margin-#{$from}: $push,
18
+ margin-#{$to}: -100%,
19
+ );
20
+
21
+ @include output($output);
18
22
  }
@@ -22,10 +22,14 @@
22
22
  $to : to($flow);
23
23
  $from : from($flow);
24
24
 
25
- width: $width;
26
- float: if($float == to, $to, null) or if($float == from, $from, null);
27
- margin-#{$from}: $margin-before;
28
- margin-#{$to}: $margin-after;
29
- padding-#{$from}: $padding-before;
30
- padding-#{$to}: $padding-after;
25
+ $output: (
26
+ width: $width,
27
+ float: if($float == to, $to, null) or if($float == from, $from, null),
28
+ margin-#{$from}: $margin-before,
29
+ margin-#{$to}: $margin-after,
30
+ padding-#{$from}: $padding-before,
31
+ padding-#{$to}: $padding-after,
32
+ );
33
+
34
+ @include output($output);
31
35
  }
@@ -10,27 +10,17 @@
10
10
  // - [$flow]: ltr | rtl
11
11
  @mixin background-grid-output (
12
12
  $image,
13
- $size: false,
14
- $clip: false,
13
+ $size: null,
14
+ $clip: null,
15
15
  $flow: map-get($susy-defaults, flow)
16
16
  ) {
17
- @if mixin-exists(background-image) {
18
- @include background-image($image...);
19
- } @else {
20
- background-image: $image;
21
- }
17
+ $output: (
18
+ background-image: $image,
19
+ background-size: $size,
20
+ background-origin: $clip,
21
+ background-clip: $clip,
22
+ background-position: from($flow) top,
23
+ );
22
24
 
23
- @if $size {
24
- -webkit-background-size: $size;
25
- background-size: $size;
26
- }
27
-
28
- @if $clip {
29
- -webkit-background-origin: $clip;
30
- -webkit-background-clip: $clip;
31
- background-origin: $clip;
32
- background-clip: $clip;
33
- }
34
-
35
- background-position: from($flow) top;
25
+ @include output($output);
36
26
  }
@@ -11,7 +11,11 @@
11
11
  $justify: auto auto,
12
12
  $property: max-width
13
13
  ) {
14
- #{$property}: $width or 100%;
15
- margin-left: nth($justify, 1);
16
- margin-right: nth($justify, 2);
14
+ $output: (
15
+ #{$property}: $width or 100%,
16
+ margin-left: nth($justify, 1),
17
+ margin-right: nth($justify, 2),
18
+ );
19
+
20
+ @include output($output);
17
21
  }
@@ -14,6 +14,10 @@
14
14
  $to: to($flow);
15
15
  $from: from($flow);
16
16
 
17
- margin-#{$from}: $before;
18
- margin-#{$to}: $after;
17
+ $output: (
18
+ margin-#{$from}: $before,
19
+ margin-#{$to}: $after,
20
+ );
21
+
22
+ @include output($output);
19
23
  }
@@ -0,0 +1,14 @@
1
+ // Output
2
+ // ======
3
+
4
+ // Output
5
+ // ------
6
+ // Output CSS with proper browser support.
7
+ // - $styles : <map of css property-value pairs>
8
+ @mixin output(
9
+ $styles
10
+ ) {
11
+ @each $prop, $val in $styles {
12
+ @include susy-support($prop, $val);
13
+ }
14
+ }