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,19 @@
1
+ // Susy Prefix
2
+ // ===========
3
+
4
+ // Prefix
5
+ // ------
6
+ // Output simple prefixed properties.
7
+ // - $prop : <css property>
8
+ // - $val : <css value>
9
+ // - [$prefix] : <browser prefix list>
10
+ @mixin susy-prefix(
11
+ $prop,
12
+ $val,
13
+ $prefix: official
14
+ ) {
15
+ @each $fix in $prefix {
16
+ $fix: if($fix == official or not($fix), $prop, '-#{$fix}-#{$prop}');
17
+ @include susy-rem($fix, $val);
18
+ }
19
+ }
@@ -0,0 +1,22 @@
1
+ // rem Support
2
+ // ===========
3
+
4
+ // rem
5
+ // ---
6
+ // Check for an existing support mixin, or output directly.
7
+ // - $prop : <css property>
8
+ // - $val : <css value>
9
+ @mixin susy-rem(
10
+ $prop,
11
+ $val
12
+ ) {
13
+ $_reqs: (
14
+ variable: rhythm-unit rem-with-px-fallback,
15
+ mixin: rem,
16
+ );
17
+ @if susy-support(rem, $_reqs, $warn: false) and $rhythm-unit == rem {
18
+ @include rem($prop, $val);
19
+ } @else {
20
+ #{$prop}: $val;
21
+ }
22
+ }
@@ -0,0 +1,95 @@
1
+ // Browser Support
2
+ // ===============
3
+
4
+ // Susy Support Defaults
5
+ // ---------------------
6
+ @include susy-defaults((
7
+ use-custom: (
8
+ clearfix: false,
9
+ background-image: true,
10
+ background-options: false,
11
+ breakpoint: true,
12
+ box-sizing: true,
13
+ rem: true,
14
+ ),
15
+ ));
16
+
17
+
18
+ // Susy Support [mixin]
19
+ // --------------------
20
+ // Send property-value pairs to the proper support modules.
21
+ // - $prop : <css property>
22
+ // - $val : <css value>
23
+ @mixin susy-support(
24
+ $prop,
25
+ $val
26
+ ) {
27
+ // Background Support
28
+ @if $prop == background-image {
29
+ @include susy-background-image($val);
30
+ } @else if $prop == background-size {
31
+ @include susy-background-size($val);
32
+ } @else if $prop == background-origin {
33
+ @include susy-background-origin($val);
34
+ } @else if $prop == background-clip {
35
+ @include susy-background-clip($val);
36
+ }
37
+
38
+ // Box-Sizing Support
39
+ @else if $prop == box-sizing {
40
+ @include susy-box-sizing($val);
41
+ }
42
+
43
+ // Rem Support
44
+ @else {
45
+ @include susy-rem($prop, $val);
46
+ }
47
+ }
48
+
49
+
50
+ // Susy Support [function]
51
+ // -----------------------
52
+ // Check for support of a feature.
53
+ // - $feature : <string>
54
+ // - e.g "rem" or "box-sizing"
55
+ // - $requirements : <map>
56
+ // - e.g (variable: rem-with-px-fallback, mixin: rem)
57
+ // - $warn : <bool>
58
+ @function susy-support(
59
+ $feature,
60
+ $requirements: (),
61
+ $warn: true
62
+ ) {
63
+ $_support: susy-get(use-custom $feature);
64
+
65
+ @if $_support {
66
+ $_fail: false;
67
+
68
+ @each $_type, $_req in $requirements {
69
+ @each $_i in $_req {
70
+
71
+ $_pass : null;
72
+
73
+ // sass 3.5 or greater
74
+ @if function-exists('get-function') {
75
+ $_pass: call(get-function(unquote("#{$_type}-exists")), $_i);
76
+ }
77
+ // sass 3.4 or less
78
+ @else {
79
+ $_pass: call(unquote("#{$_type}-exists"), $_i);
80
+ }
81
+
82
+ @if not($_pass) {
83
+ $_fail: true;
84
+ @if $warn {
85
+ @warn "You requested custom support of #{$feature}, but the #{$_i} #{$_type} is not available.";
86
+ }
87
+ }
88
+ }
89
+ }
90
+
91
+ $_support: if($_fail, false, $_support);
92
+ }
93
+
94
+ @return $_support;
95
+ }
@@ -0,0 +1,103 @@
1
+ // Column math
2
+ // ===========
3
+
4
+
5
+ // Is Symmetrical
6
+ // --------------
7
+ // Returns true if a grid is symmetrical.
8
+ // - [$columns] : <number> | <list>
9
+ @function is-symmetrical(
10
+ $columns: susy-get(columns)
11
+ ) {
12
+ $columns: valid-columns($columns);
13
+ @return if(type-of($columns) == number, $columns, null);
14
+ }
15
+
16
+
17
+ // Susy Count
18
+ // ----------
19
+ // Find the number of columns in a given layout
20
+ // - [$columns] : <number> | <list>
21
+ @function susy-count(
22
+ $columns: susy-get(columns)
23
+ ) {
24
+ $columns: valid-columns($columns);
25
+ @return is-symmetrical($columns) or length($columns);
26
+ }
27
+
28
+
29
+ // Susy Sum
30
+ // --------
31
+ // Find the total sum of column-units in a layout
32
+ // - [$columns] : <number> | <list>
33
+ // - [$gutters] : <ratio>
34
+ // - [$spread] : false/narrow | wide | wider
35
+ @function susy-sum(
36
+ $columns : susy-get(columns),
37
+ $gutters : susy-get(gutters),
38
+ $spread : false
39
+ ) {
40
+ $columns: valid-columns($columns);
41
+ $gutters: valid-gutters($gutters);
42
+
43
+ $spread: if($spread == wide, 0, if($spread == wider, 1, -1));
44
+ $gutter-sum: (susy-count($columns) + $spread) * $gutters;
45
+ $column-sum: is-symmetrical($columns);
46
+
47
+ @if not($column-sum) {
48
+ @each $column in $columns {
49
+ $column-sum: ($column-sum or 0) + $column;
50
+ }
51
+ }
52
+
53
+ @return $column-sum + $gutter-sum;
54
+ }
55
+
56
+
57
+ // Susy Slice
58
+ // ----------
59
+ // Return a subset of columns at a given location.
60
+ // - $span : <number>
61
+ // - $location : <number>
62
+ // - [$columns] : <number> | <list>
63
+ @function susy-slice(
64
+ $span,
65
+ $location,
66
+ $columns: susy-get(columns)
67
+ ) {
68
+ $columns: valid-columns($columns);
69
+ $sub-columns: $span;
70
+
71
+ @if not(is-symmetrical($columns)) {
72
+ $location: $location or 1;
73
+ $sub-columns: ();
74
+ @for $i from $location to ($location + $span) {
75
+ $sub-columns: append($sub-columns, nth($columns, $i));
76
+ }
77
+ }
78
+
79
+ @return $sub-columns;
80
+ }
81
+
82
+
83
+ // Susy
84
+ // ----
85
+ // Find the sum of a column-span.
86
+ // - $span : <number>
87
+ // - $location : <number>
88
+ // - [$columns] : <number> | <list>
89
+ // - [$gutters] : <ratio>
90
+ // - [$spread] : false/narrow | wide | wider
91
+ @function susy(
92
+ $span,
93
+ $location : false,
94
+ $columns : susy-get(columns),
95
+ $gutters : susy-get(gutters),
96
+ $spread : false
97
+ ) {
98
+ $columns: valid-columns($columns);
99
+ $gutters: valid-gutters($gutters);
100
+ $span: susy-slice($span, $location, $columns);
101
+
102
+ @return susy-sum($span, $gutters, $spread);
103
+ }
@@ -0,0 +1,73 @@
1
+ // Settings
2
+ // ========
3
+
4
+ // Version
5
+ // -------
6
+ $su-version: 1.1;
7
+
8
+
9
+ // Default Settings
10
+ // ----------------
11
+ // PRIVATE: The basic settings
12
+ $susy-defaults: (
13
+ columns: 4,
14
+ gutters: .25,
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
+
26
+ // Susy Defaults
27
+ // -------------
28
+ // PRIVATE: Add defaults to Susy
29
+ @mixin susy-defaults(
30
+ $defaults
31
+ ) {
32
+ $susy-defaults: map-merge($susy-defaults, $defaults) !global;
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
+ }
@@ -0,0 +1,111 @@
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);
58
+ $_merge: ($_merge: $_value);
59
+ $_return: if($_level, map-merge($_level, $_merge), $_merge);
60
+ $_value: $_return;
61
+ }
62
+
63
+ @return $_return;
64
+ }
65
+
66
+
67
+ // Deep Merge
68
+ // ----------
69
+ // Return 2 objects of any depth, merged
70
+ @function _susy-deep-merge(
71
+ $map1,
72
+ $map2
73
+ ) {
74
+
75
+ @if type-of($map1) != map or type-of($map2) != map {
76
+ $map1: $map2;
77
+ } @else {
78
+ @each $key, $value in $map2 {
79
+ $_new: ($key: _susy_deep-merge(map-get($map1, $key), $value));
80
+ $map1: map-merge($map1, $_new);
81
+ }
82
+ }
83
+
84
+ @return $map1;
85
+ }
86
+
87
+
88
+ // Deep Has-Key
89
+ // ------------
90
+ // - Return true if a deep key exists
91
+ @function _susy-deep-has-key(
92
+ $map,
93
+ $keys...
94
+ ) {
95
+ $_return: null;
96
+ $_stop: false;
97
+
98
+ @each $key in $keys {
99
+ @if not($_stop) {
100
+ $_return: map-has-key($map, $key);
101
+ }
102
+
103
+ @if $_return {
104
+ $map: map-get($map, $key);
105
+ } @else {
106
+ $_stop: true;
107
+ }
108
+ }
109
+
110
+ @return $_return;
111
+ }
@@ -0,0 +1,57 @@
1
+ // Math Validation
2
+ // ===============
3
+
4
+
5
+ // Valid Columns
6
+ // -------------
7
+ // Check that a column setting is valid.
8
+ @function valid-columns(
9
+ $columns,
10
+ $silent: false
11
+ ) {
12
+ $type: type-of($columns);
13
+ $return: null;
14
+
15
+ @if $type == number and unitless($columns) {
16
+ $return: $columns;
17
+ } @else if $type == list {
18
+ $fail: null;
19
+ @each $col in $columns {
20
+ @if type-of($col) == number {
21
+ $fail: $fail or if(unitless($col), null, true);
22
+ } @else {
23
+ $fail: true;
24
+ }
25
+ }
26
+ $return: if($fail, $return, $columns);
27
+ }
28
+
29
+ @if $return != $columns and not($silent) {
30
+ $return: null;
31
+ $warn: '$columns must be a unitless number or list of unitless numbers.';
32
+ @warn $warn + ' Current value [#{$type}]: #{$columns}';
33
+ }
34
+
35
+ @return $return;
36
+ }
37
+
38
+
39
+ // Valid Gutters
40
+ // -------------
41
+ // Check that a gutter setting is valid.
42
+ @function valid-gutters(
43
+ $gutters,
44
+ $silent: false
45
+ ) {
46
+ $type: type-of($gutters);
47
+ $return: null;
48
+
49
+ @if $type == number and unitless($gutters) {
50
+ $return: $gutters;
51
+ } @else if not($silent) {
52
+ $warn: '$gutters must be a unitless number.';
53
+ @warn $warn + ' Current value [#{$type}]: #{$gutters}';
54
+ }
55
+
56
+ @return $return;
57
+ }