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
@@ -1,161 +1,100 @@
1
- @mixin output-isolation($span, $location, $columns, $gutter, $options: false) {
1
+ @function output-isolation($Span-Map) {
2
+ // Set up Left/Right maps
3
+ $Return: ();
2
4
 
3
- $gutter: find-gutter($gutter);
4
- $gutter-span: gutter-span($gutter, $columns);
5
- $end-row: end-row($span, $location, $columns);
6
- $start-row: start-row($location);
5
+ $Span: map-get($Span-Map, 'span');
6
+ $Location: map-get($Span-Map, 'location');
7
7
 
8
- $gutter-style: find-gutter-style();
9
- $fixed-gutter: fixed-gutter($columns, $gutter);
10
- $gutter-property: gutter-property($columns, $gutter);
11
- $split: index($gutter-style, split);
8
+ $Grid: map-get($Span-Map, 'grid');
9
+ $Gutter: map-get($Span-Map, 'gutter');
10
+ $Style: map-get($Span-Map, 'style');
12
11
 
13
- $margin-span: column-span(($location - 1), 1, $columns, $gutter, $gutter-style);
12
+ $Start-Row: map-get($Span-Map, 'start row');
13
+ $End-Row: map-get($Span-Map, 'end row');
14
14
 
15
- @if not $fixed-gutter {
16
- $margin-span: $margin-span + $gutter-span;
15
+ $Fixed-Gutter: map-get($Span-Map, 'fixed gutter');
16
+ $Split-Gutter: map-get($Span-Map, 'split gutter');
17
+ $Gutter-Property: map-get($Span-Map, 'gutter property');
18
+
19
+ $Direction: map-get($Span-Map, 'direction');
20
+ $Options: map-get($Span-Map, 'options');
21
+
22
+ $Width: column-span($Span, $Location, $Grid, $Gutter, $Style);
23
+ $Margin-Span: column-span(($Location - 1), 1, $Grid, $Gutter, $Style);
24
+ $Gutter-Span: gutter-span($Gutter, $Grid);
25
+
26
+ // Backwards Compatibility for Options
27
+ @if type-of($Options) != 'map' and $Options != null {
28
+ $Options: ('clear': unquote(nth($Options, 1)));
17
29
  }
18
30
 
31
+ $Dir: $Direction;
32
+ $Opp: opposite-direction($Dir);
19
33
 
20
- @if $direction == 'ltr' or $direction == 'both' {
21
- // Set the CSS direction to ltr
22
- $cssdir: 'ltr';
23
- // Find the CSS named direction and opposite direction
24
- $dir: named-direction($cssdir);
25
- $opp: opposite-direction($dir);
34
+ $Return: map-merge($Return, ('width': $Width));
26
35
 
27
- width: column-span($span, $location, $columns, $gutter, $gutter-style);
36
+ @if ($End-Row) {
37
+ $Return: map-merge($Return, ('float': $Opp));
38
+ $Return: map-merge($Return, ('margin-#{$Dir}': 0));
28
39
 
29
- // If we are at the last item in the row, we float it the opposite direction
30
- @if ($end-row) {
31
- float: $opp;
32
- margin-#{$dir}: 0;
33
- @if $split and not $fixed-gutter {
34
- #{$gutter-property}-#{$opp}: $gutter-span / 2;
35
- }
36
- @else {
37
- margin-#{$opp}: 0;
38
- }
40
+ @if $Split-Gutter and not $Fixed-Gutter {
41
+ $Return: map-merge($Return, ('#{$Gutter-Property}-#{$Opp}': $Gutter-Span / 2));
39
42
  }
40
43
  @else {
41
- float: $dir;
42
- margin-#{$opp}: -100%;
43
-
44
- @if $start-row {
45
- @if $split and not $fixed-gutter {
46
- margin-#{$dir}: $gutter-span / 2;
47
- }
48
- @else {
49
- margin-#{$dir}: 0%;
50
- }
51
- }
52
- @else {
53
- @if $split and not $fixed-gutter {
54
- margin-#{$dir}: $margin-span + $gutter-span / 2;
55
- }
56
- @else {
57
- margin-#{$dir}: $margin-span;
58
- }
59
-
60
- }
44
+ $Return: map-merge($Return, ('margin-#{$Opp}': 0));
61
45
  }
46
+ }
47
+ @else {
48
+ $Return: map-merge($Return, ('float': $Dir));
49
+ $Return: map-merge($Return, ('margin-#{$Opp}': -100%));
62
50
 
63
- // If options are set, we clear to that option, otherwise no clear!
64
- @if ($options) {
65
- clear: unquote($options);
51
+ @if $Start-Row {
52
+ @if $Split-Gutter and not $Fixed-Gutter {
53
+ $Return: map-merge($Return, ('margin-#{$Dir}': $Gutter-Span / 2));
54
+ }
55
+ @else if not $Fixed-Gutter {
56
+ $Return: map-merge($Return, ('margin-#{$Dir}': 0));
57
+ }
66
58
  }
67
59
  @else {
68
- clear: none;
69
- }
70
-
71
- @if $fixed-gutter {
72
- @if index($gutter-style, split) {
73
- #{$gutter-property}-#{$dir}: $gutter-span / 2;
74
- #{$gutter-property}-#{$opp}: $gutter-span / 2;
60
+ @if $Split-Gutter and not $Fixed-Gutter {
61
+ $Return: map-merge($Return, ('margin-#{$Dir}': $Margin-Span + $Gutter-Span + $Gutter-Span / 2));
62
+ }
63
+ @else if not $Fixed-Gutter {
64
+ $Return: map-merge($Return, ('margin-#{$Dir}': $Margin-Span + $Gutter-Span));
75
65
  }
76
66
  @else {
77
- #{$gutter-property}-#{$opp}: $gutter-span;
67
+ $Return: map-merge($Return, ('margin-#{$Dir}': $Margin-Span));
78
68
  }
79
69
  }
80
70
  }
71
+ // If options are set, we merge them in!
72
+ @if ($Options) {
73
+ $Return: map-merge($Return, $Options);
74
+ }
81
75
 
82
- @if $direction == 'rtl' or $direction == 'both' {
83
- // Set the CSS direction to ltr
84
- $cssdir: 'rtl';
85
- // Find the CSS named direction and opposite direction
86
- $dir: named-direction($cssdir);
87
- $opp: opposite-direction($dir);
88
-
89
- [dir="#{$cssdir}"] & {
90
- // If we are at the last item in the row, we float it the opposite direction
91
- @if ($end-row) {
92
- float: $opp;
93
- margin-#{$dir}: 0;
94
- @if $split and not $fixed-gutter {
95
- #{$gutter-property}-#{$opp}: $gutter-span / 2;
96
- }
97
- @else {
98
- margin-#{$opp}: 0;
99
- }
100
- }
101
- @else {
102
- float: $dir;
103
- margin-#{$opp}: -100%;
104
-
105
- @if $start-row {
106
- @if $split and not $fixed-gutter {
107
- margin-#{$dir}: $gutter-span / 2;
108
- }
109
- @else {
110
- margin-#{$dir}: 0%;
111
- }
112
- }
113
- @else {
114
- @if $split and not $fixed-gutter {
115
- margin-#{$dir}: $margin-span + $gutter-span / 2;
116
- }
117
- @else {
118
- margin-#{$dir}: $margin-span;
119
- }
120
-
121
- }
122
- }
76
+ // If CLear isn't already available, set it!
77
+ @if not map-has-key($Return, 'clear') {
78
+ $Return: map-merge($Return, ('clear': none));
79
+ }
123
80
 
124
- // If options are set, we clear to that option, otherwise no clear!
125
- @if ($options) {
126
- clear: unquote($options);
81
+ // Left Fixed Gutters
82
+ @if $Fixed-Gutter {
83
+ @if index($Style, 'split') {
84
+ $Return: map-merge($Return, ('#{$Gutter-Property}-#{$Dir}': $Gutter-Span / 2));
85
+ $Return: map-merge($Return, ('#{$Gutter-Property}-#{$Opp}': $Gutter-Span / 2));
86
+ }
87
+ @else {
88
+ @if not $End-Row {
89
+ $Return: map-merge($Return, ('#{$Gutter-Property}-#{$Opp}': $Gutter-Span));
127
90
  }
128
91
  @else {
129
- clear: none;
130
- }
131
-
132
- @if $fixed-gutter {
133
- @if $direction == 'rtl' {
134
- @if index($gutter-style, split) {
135
- #{$gutter-property}-#{$dir}: $gutter-span / 2;
136
- #{$gutter-property}-#{$opp}: $gutter-span / 2;
137
- }
138
- @else {
139
- #{$gutter-property}-#{$opp}: $gutter-span;
140
- }
141
- }
142
- @else if not index($gutter-style, split) {
143
- #{$gutter-property}-#{$opp}: $gutter-span;
144
- }
92
+ $Return: map-merge($Return, ('#{$Gutter-Property}-#{$Opp}': 0));
145
93
  }
146
94
  }
147
95
  }
148
96
 
149
- @include span-shared;
150
-
151
- }
152
-
153
- @mixin push-isolation($span, $location, $columns: false, $gutter: false) {
154
- @include push-float($span, $location, $columns, $gutter);
155
- }
156
-
157
- @mixin pull-isolation($span, $location, $columns: false, $gutter: false) {
158
- @include pull-float($span, $location, $columns, $gutter);
97
+ @return $Return;
159
98
  }
160
99
 
161
100
  //////////////////////////////
@@ -163,6 +102,15 @@
163
102
  //
164
103
  // Makes working with Isolation easier, as it moves Clear to a 1st class citizen of the mixin, and automatically builds the verbose grid-span mixin call
165
104
  //////////////////////////////
166
- @mixin isolation-span($span, $location, $clear: false, $grid: false, $gutter: false) {
167
- @include grid-span($span, $location, $grid, $gutter, 'isolation', $clear);
168
- }
105
+ @mixin isolation-span($Span, $Location, $clear: false, $grid: false, $gutter: false, $gutter-style: false, $from: false) {
106
+ $Options: ();
107
+ @if $clear {
108
+ $Options: map-merge($Options, ('clear': $clear));
109
+ }
110
+ @if $from {
111
+ $Options: map-merge($Options, ('from': $from));
112
+ }
113
+
114
+ $Options: if(length($Options) > 0, $Options, null);
115
+ @include grid-span($Span, $Location, $grid, $gutter, 'isolation', $gutter-style, $Options);
116
+ }
@@ -8,28 +8,46 @@
8
8
  // https://github.com/Team-Sass/Singularity/wiki/Creating-Grids
9
9
  // - $append-to-list : [list] A list to append to.
10
10
  // Defaults to $grids if none is specified.
11
- @function add-grid($grid-definition, $append-to-list: $grids) {
12
- $parsed: parse-add($grid-definition); // Converts the definiton to a temporary format:
13
- // either `((<grid>))` or `((<grid>) (<breakpoint>))`
14
- $grid: nth($parsed, 1); // E. g. `(<grid>)`.
15
- $breakpoint: nth($parsed, 2); // Either `(<breakpoint>)` or false.
16
- $list-length: length($append-to-list);
17
-
11
+ @function add-grid($grid-definition, $custom-map: false) {
12
+ $Parsed: parse-add($grid-definition); // Parses grid definition to grid/breakpoint
13
+ $Grid: nth($Parsed, 1); // E. g. `(<grid>)`.
14
+ $Breakpoint: nth($Parsed, 2); // Either `(<breakpoint>)` or false.
15
+ $Mobile-First: sgs-get('mobile first');
16
+ $Grid-Map: ();
17
+
18
+ // Determine if a custom map or the default maps should be used.
19
+ @if $custom-map {
20
+ $Grid-Map: $custom-map;
21
+ }
22
+ @else {
23
+ @if sgs-has('grids') {
24
+ $Grid-Map: sgs-get('grids');
25
+ }
26
+ }
27
+ $Grid-Key-Length: length(map-keys($Grid-Map));
28
+
18
29
  // Check whether the definition will be the first one in the list
19
30
  // and whether it has no breakpoint specified.
20
- @if $breakpoint == false and $list-length == 0 {
31
+ @if $Breakpoint == null {
21
32
  // Returns the first item of the list, e. g. `(<grid>)`
22
- @return $grid;
33
+ $Grid-Map: map-merge($Grid-Map, (-1px: $Grid));
23
34
  }
24
35
  // IF the list is initiated with a list of grid columns need to start off
25
36
  // a comma seprated list.
26
- @elseif $list-length > 1 and length(nth($append-to-list, 2)) == 1 {
27
- // Seed the first value and grid + breakpoint seperated by a comma.
28
- @return $append-to-list, ($grid $breakpoint);
29
- }
30
37
  @else {
31
- // Appends to a comma-separated list of definitions in the internal format
32
- // and returns it, e. g. `(<grid>), (<grid> <breakpoint>), (<grid> <breakpoint>)`
33
- @return append($append-to-list, ($grid $breakpoint), 'comma');
38
+ @if not (map-has-key($Grid-Map, -1px)) {
39
+ $Grid-Map: map-merge($Grid-Map, map-get($Singularity-Settings, 'grids'));
40
+ }
41
+ $Grid-Map: map-merge($Grid-Map, ($Breakpoint: $Grid));
34
42
  }
43
+
44
+ $Grid-Map: sort-map($Grid-Map, not $Mobile-First);
45
+
46
+ @return $Grid-Map;
35
47
  }
48
+
49
+
50
+ @mixin add-grid($grid-definition) {
51
+ $Add-Grid: add-grid($grid-definition);
52
+ $HOLDER: sgs-set('grids', $Add-Grid);
53
+ }
@@ -5,19 +5,17 @@
5
5
  // From Singularity
6
6
  // Must be using Breakpoint to work properly
7
7
  //////////////////////////////
8
- @function find-grid($user-columns: false) {
8
+ @function find-grid($user-columns: null) {
9
9
 
10
10
  // We supply a default if the user hasn't set any grids and hasn't passed in a custom column set
11
11
  // The default supplied is based on original Susy options
12
- @if length($grids) == 0 and $user-columns == false {
13
- $user-columns: 12;
14
- }
12
+ $Grids: sgs-get('grids');
15
13
 
16
- $found: find-object($grids, $user-columns);
14
+ $Found: find-object($Grids, $user-columns);
17
15
 
18
- @if length($found) == 1 {
19
- $found: nth($found, 1);
16
+ @if length($Found) == 1 {
17
+ $Found: nth($Found, 1);
20
18
  }
21
19
 
22
- @return $found;
20
+ @return $Found;
23
21
  }
@@ -1,29 +1,52 @@
1
- // Accepts a gutter style definition in the human-readable format. Converts it to the internal format,
2
- // appends it to a list of gutter styles and returns the resulting list.
1
+ // Accepts a gutter-style style definition in the human-readable format. Converts it to the internal format,
2
+ // appends it to a list of gutter-style styles and returns the resulting list.
3
3
  //
4
4
  // Note that this function only returns a new list, it does not modify the source list.
5
5
  //
6
- // add-gutter-style($gutter-style-definition, $append-to-list)
7
- // - $gutter-definition : <definition> See documentation for syntax:
6
+ // add-gutter-style-style($gutter-style-style-definition, $append-to-list)
7
+ // - $gutter-style-definition : <definition> See documentation for syntax:
8
8
  // https://github.com/Team-Sass/Singularity/wiki/Creating-Grids
9
9
  // - $append-to-list : [list] A list to append to.
10
- // Defaults to $gutters if none is specified.
11
- @function add-gutter-style($gutter-style-definition, $append-to-list: $gutter-styles) {
12
- $parsed: parse-add($gutter-style-definition); // Converts the definition to a temporary format:
13
- // either `((<gutter-style>))` or `((<gutter-style>) (<breakpoint>))`
14
- $gutter-style: nth($parsed, 1); // E. g. `(<gutter-style>)`.
15
- $breakpoint: nth($parsed, 2); // Either `(<breakpoint>)` or false.
16
- $list-length: length($append-to-list);
10
+ // Defaults to $gutter-styles if none is specified.
11
+ @function add-gutter-style($gutter-style-definition, $custom-map: false) {
12
+ $Parsed: parse-add($gutter-style-definition); // Parses gutter-style definition to gutter-style/breakpoint
13
+ $Gutter-Style: nth($Parsed, 1); // E. g. `(<gutter-style>)`.
14
+ $Breakpoint: nth($Parsed, 2); // Either `(<breakpoint>)` or false.
15
+ $Mobile-First: sgs-get('mobile first');
16
+ $Gutter-Style-Map: ();
17
+
18
+ // Determine if a custom map or the default maps should be used.
19
+ @if $custom-map {
20
+ $Gutter-Style-Map: $custom-map;
21
+ }
22
+ @else {
23
+ @if sgs-has('gutter styles') {
24
+ $Gutter-Style-Map: sgs-get('gutter styles');
25
+ }
26
+ }
27
+ $Gutter-Style-Key-Length: length(map-keys($Gutter-Style-Map));
17
28
 
18
29
  // Check whether the definition will be the first one in the list
19
30
  // and whether it has no breakpoint specified.
20
- @if $breakpoint == false and $list-length == 0 {
31
+ @if $Breakpoint == null {
21
32
  // Returns the first item of the list, e. g. `(<gutter-style>)`
22
- @return $gutter-style;
33
+ $Gutter-Style-Map: map-merge($Gutter-Style-Map, (-1px: $Gutter-Style));
23
34
  }
35
+ // IF the list is initiated with a list of gutter-style columns need to start off
36
+ // a comma seprated list.
24
37
  @else {
25
- // Appends to a comma-separated list of definitions in the internal format
26
- // and returns it, e. g. `(<gutter>), (<gutter> <breakpoint>), (<gutter> <breakpoint>)`
27
- @return append($append-to-list, ($gutter-style $breakpoint), 'comma');
38
+ @if not (map-has-key($Gutter-Style-Map, -1px)) {
39
+ $Gutter-Style-Map: map-merge($Gutter-Style-Map, map-get($Singularity-Settings, 'gutter styles'));
40
+ }
41
+ $Gutter-Style-Map: map-merge($Gutter-Style-Map, ($Breakpoint: $Gutter-Style));
28
42
  }
43
+
44
+ $Gutter-Style-Map: sort-map($Gutter-Style-Map, not $Mobile-First);
45
+
46
+ @return $Gutter-Style-Map;
29
47
  }
48
+
49
+ @mixin add-gutter-style($gutter-style-definition) {
50
+ $Add-gutter-style: add-gutter-style($gutter-style-definition);
51
+ $HOLDER: sgs-set('gutter styles', $Add-gutter-style);
52
+ }
@@ -5,12 +5,17 @@
5
5
  // From Singularity
6
6
  // Must be using Breakpoint to work properly
7
7
  //////////////////////////////
8
- @function find-gutter-style($user-gutter-style: false) {
8
+ @function find-gutter-style($user-gutter-styles: null) {
9
9
 
10
- // We supply a default if the user hasn't set any gutter style and hasn't passed in a custom gutter
11
- @if length($gutter-styles) == 0 and $user-gutter-style == false {
12
- $user-gutter-style: opposite;
10
+ // We supply a default if the user hasn't set any gutters and hasn't passed in a custom column set
11
+ // The default supplied is based on original Susy options
12
+ $Gutters-Styles: sgs-get('gutter styles');
13
+
14
+ $Found: find-object($Gutters-Styles, $user-gutter-styles);
15
+
16
+ @if length($Found) == 1 {
17
+ $Found: nth($Found, 1);
13
18
  }
14
19
 
15
- @return find-object($gutter-styles, $user-gutter-style);
20
+ @return $Found;
16
21
  }
@@ -1,18 +1,14 @@
1
- @function fixed-gutter($user-columns: false, $user-gutter: false, $user-gutter-style: false) {
2
- $grid: find-grid($user-columns);
3
- $gutter: find-gutter($user-gutter);
4
- $gutter-style: find-gutter-style($user-gutter-style);
5
-
6
- @if index($gutter-style, fixed) {
1
+ @function fixed-gutter($user-columns, $user-gutter, $user-gutter-style) {
2
+ @if index($user-gutter-style, 'fixed') {
7
3
  // @debug 'Fixed in output style';
8
4
  @return true;
9
5
  }
10
- @else if type-of($grid) == 'number' and not unitless($gutter) {
6
+ @else if type-of($user-columns) == 'number' and not unitless($user-gutter) {
11
7
  // @debug 'Equal columns with a unit based gutter';
12
8
  @return true;
13
9
  }
14
- @else if type-of($grid) == 'list' {
15
- @if unit(nth($grid, 1)) != unit($gutter) {
10
+ @else if type-of($user-columns) == 'list' {
11
+ @if unit(nth($user-columns, 1)) != unit($user-gutter) {
16
12
  // @debug 'Columns and gutters are different units';
17
13
  @return true;
18
14
  }
@@ -24,7 +20,7 @@
24
20
  @return false;
25
21
  }
26
22
 
27
- @function gutter-property($user-columns: false, $user-gutter: false, $user-gutter-style: false) {
23
+ @function gutter-property($user-columns, $user-gutter, $user-gutter-style) {
28
24
  @if fixed-gutter($user-columns, $user-gutter, $user-gutter-style) {
29
25
  @return 'padding';
30
26
  }
@@ -3,27 +3,50 @@
3
3
  //
4
4
  // Note that this function only returns a new list, it does not modify the source list.
5
5
  //
6
- // add-gutter($grid-definition, $append-to-list)
6
+ // add-gutter($Gutter-definition, $append-to-list)
7
7
  // - $gutter-definition : <definition> See documentation for syntax:
8
- // https://github.com/Team-Sass/Singularity/wiki/Creating-Grids
8
+ // https://github.com/Team-Sass/Singularity/wiki/Creating-Gutters
9
9
  // - $append-to-list : [list] A list to append to.
10
10
  // Defaults to $gutters if none is specified.
11
- @function add-gutter($gutter-definition, $append-to-list: $gutters) {
12
- $parsed: parse-add($gutter-definition); // Converts the definiton to a temporary format:
13
- // either `((<gutter>))` or `((<gutter>) (<breakpoint>))`
14
- $gutter: nth($parsed, 1); // E. g. `(<gutter>)`.
15
- $breakpoint: nth($parsed, 2); // Either `(<breakpoint>)` or false.
16
- $list-length: length($append-to-list);
11
+ @function add-gutter($gutter-definition, $custom-map: false) {
12
+ $Parsed: parse-add($gutter-definition); // Parses Gutter definition to Gutter/breakpoint
13
+ $Gutter: nth($Parsed, 1); // E. g. `(<Gutter>)`.
14
+ $Breakpoint: nth($Parsed, 2); // Either `(<breakpoint>)` or false.
15
+ $Mobile-First: sgs-get('mobile first');
16
+ $Gutter-Map: ();
17
+
18
+ // Determine if a custom map or the default maps should be used.
19
+ @if $custom-map {
20
+ $Gutter-Map: $custom-map;
21
+ }
22
+ @else {
23
+ @if sgs-has('gutters') {
24
+ $Gutter-Map: sgs-get('gutters');
25
+ }
26
+ }
27
+ $Gutter-Key-Length: length(map-keys($Gutter-Map));
17
28
 
18
29
  // Check whether the definition will be the first one in the list
19
30
  // and whether it has no breakpoint specified.
20
- @if $breakpoint == false and $list-length == 0 {
21
- // Returns the first item of the list, e. g. `(<gutter>)`
22
- @return $gutter;
31
+ @if $Breakpoint == null {
32
+ // Returns the first item of the list, e. g. `(<Gutter>)`
33
+ $Gutter-Map: map-merge($Gutter-Map, (-1px: $Gutter));
23
34
  }
35
+ // IF the list is initiated with a list of Gutter columns need to start off
36
+ // a comma seprated list.
24
37
  @else {
25
- // Appends to a comma-separated list of definitions in the internal format
26
- // and returns it, e. g. `(<gutter>), (<gutter> <breakpoint>), (<gutter> <breakpoint>)`
27
- @return append($append-to-list, ($gutter $breakpoint), 'comma');
38
+ @if not (map-has-key($Gutter-Map, -1px)) {
39
+ $Gutter-Map: map-merge($Gutter-Map, map-get($Singularity-Settings, 'gutters'));
40
+ }
41
+ $Gutter-Map: map-merge($Gutter-Map, ($Breakpoint: $Gutter));
28
42
  }
43
+
44
+ $Gutter-Map: sort-map($Gutter-Map, not $Mobile-First);
45
+
46
+ @return $Gutter-Map;
29
47
  }
48
+
49
+ @mixin add-gutter($gutter-definition) {
50
+ $Add-Gutter: add-gutter($gutter-definition);
51
+ $HOLDER: sgs-set('gutters', $Add-Gutter);
52
+ }
@@ -5,13 +5,17 @@
5
5
  // From Singularity
6
6
  // Must be using Breakpoint to work properly
7
7
  //////////////////////////////
8
- @function find-gutter($user-gutter: false) {
8
+ @function find-gutter($user-gutters: null) {
9
9
 
10
- // We supply a default if the user hasn't set any gutters and hasn't passed in a custom gutter
10
+ // We supply a default if the user hasn't set any gutters and hasn't passed in a custom column set
11
11
  // The default supplied is based on original Susy options
12
- @if length($gutters) == 0 and $user-gutter == false {
13
- $user-gutter: .25;
12
+ $Gutters: sgs-get('gutters');
13
+
14
+ $Found: find-object($Gutters, $user-gutters);
15
+
16
+ @if length($Found) == 1 {
17
+ $Found: nth($Found, 1);
14
18
  }
15
19
 
16
- @return nth(find-object($gutters, $user-gutter), 1);
20
+ @return $Found;
17
21
  }