susy 2.0.0.beta.1 → 2.0.0.beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/docs/changelog.rst +42 -1
  4. data/sass/susy/_math.scss +0 -1
  5. data/sass/susy/language/_shared.scss +4 -0
  6. data/sass/susy/language/_susy.scss +3 -1
  7. data/sass/susy/language/shared/_maps.scss +85 -0
  8. data/sass/susy/language/susy/_background.scss +59 -45
  9. data/sass/susy/language/susy/_bleed.scss +150 -29
  10. data/sass/susy/language/susy/_breakpoint-plugin.scss +1 -1
  11. data/sass/susy/language/susy/_container.scss +21 -21
  12. data/sass/susy/language/susy/_context.scss +5 -5
  13. data/sass/susy/language/susy/_gallery.scss +20 -20
  14. data/sass/susy/language/susy/_grids.scss +15 -25
  15. data/sass/susy/language/susy/_gutters.scss +14 -14
  16. data/sass/susy/language/susy/_isolate.scss +31 -9
  17. data/sass/susy/language/susy/_margins.scss +14 -4
  18. data/sass/susy/language/susy/_padding.scss +14 -4
  19. data/sass/susy/language/susy/_rows.scss +19 -16
  20. data/sass/susy/language/susy/_settings.scss +40 -14
  21. data/sass/susy/language/susy/_span.scss +5 -2
  22. data/sass/susy/math/_columns.scss +8 -8
  23. data/sass/susy/math/_settings.scss +1 -2
  24. data/sass/susy/math/_validation.scss +0 -16
  25. data/sass/susy/{api → output}/_float.scss +0 -0
  26. data/sass/susy/{api → output}/_shared.scss +0 -0
  27. data/sass/susy/{api → output}/float/_clearfix.scss +0 -0
  28. data/sass/susy/{api → output}/float/_container.scss +0 -0
  29. data/sass/susy/{api → output}/float/_end.scss +0 -0
  30. data/sass/susy/{api → output}/float/_isolate.scss +0 -0
  31. data/sass/susy/{api → output}/float/_span.scss +0 -0
  32. data/sass/susy/{api → output}/shared/_background.scss +0 -0
  33. data/sass/susy/{api → output}/shared/_box-sizing.scss +0 -0
  34. data/sass/susy/{api → output}/shared/_container.scss +0 -0
  35. data/sass/susy/{api → output}/shared/_direction.scss +0 -0
  36. data/sass/susy/{api → output}/shared/_margins.scss +0 -0
  37. data/sass/susy/{api → output}/shared/_padding.scss +0 -0
  38. metadata +16 -16
  39. data/sass/susy/_helpers.scss +0 -6
  40. data/sass/susy/math/_container.scss +0 -20
@@ -16,7 +16,7 @@
16
16
  ) {
17
17
  @if mixin-exists(breakpoint) {
18
18
  @include breakpoint($query, $no-query) {
19
- @include use-grid($layout) {
19
+ @include with-layout($layout) {
20
20
  @content;
21
21
  }
22
22
  }
@@ -4,54 +4,54 @@
4
4
  // Container [mixin]
5
5
  // -----------------
6
6
  // Set a container element
7
- // - [$grid] : <settings>
7
+ // - [$layout] : <settings>
8
8
  @mixin container(
9
- $grid: $susy
9
+ $layout: $susy
10
10
  ) {
11
- $grid : parse-grid($grid);
11
+ $layout : parse-grid($layout);
12
12
 
13
- $width : get-container-width($grid);
14
- $justify : parse-container-position(susy-get(container-position, $grid));
15
- $property : if(susy-get(math, $grid) == static, width, max-width);
13
+ $width : get-container-width($layout);
14
+ $justify : parse-container-position(susy-get(container-position, $layout));
15
+ $property : if(susy-get(math, $layout) == static, width, max-width);
16
16
 
17
- $box : susy-get(box-sizing, $grid);
17
+ $box : susy-get(box-sizing, $layout);
18
18
 
19
19
  @if $box {
20
20
  @include susy-box-sizing($box);
21
21
  }
22
22
 
23
23
  @include float-container($width, $justify, $property);
24
- @include show-grid($grid);
24
+ @include show-grid($layout);
25
25
  }
26
26
 
27
27
  // Container [function]
28
28
  // --------------------
29
29
  // Return container width
30
- // - [$grid] : <settings>
30
+ // - [$layout] : <settings>
31
31
  @function container(
32
- $grid: $susy
32
+ $layout: $susy
33
33
  ) {
34
- $grid: parse-grid($grid);
35
- @return get-container-width($grid);
34
+ $layout: parse-grid($layout);
35
+ @return get-container-width($layout);
36
36
  }
37
37
 
38
38
  // Get Container Width
39
39
  // -------------------
40
40
  // Calculate the container width
41
- // - [$grid]: <settings>
41
+ // - [$layout]: <settings>
42
42
  @function get-container-width(
43
- $grid: $susy
43
+ $layout: $susy
44
44
  ) {
45
- $grid : parse-grid($grid);
46
- $width : susy-get(container, $grid);
47
- $column-width : susy-get(column-width, $grid);
45
+ $layout : parse-grid($layout);
46
+ $width : susy-get(container, $layout);
47
+ $column-width : susy-get(column-width, $layout);
48
48
 
49
49
  @if not $width or $width == auto {
50
50
  @if $column-width {
51
- $columns : susy-get(columns, $grid);
52
- $gutters : susy-get(gutters, $grid);
53
- $spread : if(is-split($grid), wide, narrow);
54
- $width : calculate-container-width($columns, $gutters, $column-width, $spread);
51
+ $columns : susy-get(columns, $layout);
52
+ $gutters : susy-get(gutters, $layout);
53
+ $spread : if(is-split($layout), wide, narrow);
54
+ $width : column-sum($columns, $gutters, $spread) * $column-width;
55
55
  } @else {
56
56
  // if we have nothing, default to 100%
57
57
  $width: 100%;
@@ -13,7 +13,7 @@
13
13
  $location : get-location($context);
14
14
  $columns : susy-get(columns, $context);
15
15
 
16
- @return get-columns($span, $location, $columns);
16
+ @return column-span($span, $location, $columns);
17
17
  }
18
18
 
19
19
  // Nested [mixin]
@@ -24,11 +24,11 @@
24
24
  @mixin nested(
25
25
  $context
26
26
  ) {
27
- $context : parse-span($context);
28
- $old : susy-get(columns);
29
- $susy : map-merge($susy, (columns: nested($context))) !global;
27
+ $context : parse-span($context);
28
+ $old : susy-get(columns);
29
+ $susy : map-merge($susy, (columns: nested($context))) !global;
30
30
 
31
31
  @content;
32
32
 
33
- $susy : map-merge($susy, (columns: $old)) !global;
33
+ $susy : map-merge($susy, (columns: $old)) !global;
34
34
  }
@@ -4,23 +4,23 @@
4
4
  // Gallery
5
5
  // -------
6
6
  // Create an isolated gallery
7
- // - $input : <span>
7
+ // - $span : <span>
8
8
  // - [$selector] : child | of-type
9
9
  @mixin gallery(
10
- $layout,
10
+ $span,
11
11
  $selector: child
12
12
  ) {
13
- $layout : parse-span($layout);
14
- $layout : map-merge($layout, (location: 1));
13
+ $span : parse-span($span);
14
+ $span : map-merge($span, (location: 1));
15
15
 
16
- $span : susy-get(span, $layout);
17
- $columns : susy-get(columns, $layout);
16
+ $n : susy-get(span, $span);
17
+ $columns : susy-get(columns, $span);
18
18
  $context : column-count($columns);
19
- $flow : susy-get(flow, $layout);
19
+ $flow : susy-get(flow, $span);
20
20
 
21
- $inside : is-inside($layout);
21
+ $inside : is-inside($span);
22
22
  $from : from($flow);
23
- $line : floor($context / $span);
23
+ $line : floor($context / $n);
24
24
  $symmetrical : is-symmetrical($columns);
25
25
 
26
26
  $output: (
@@ -34,7 +34,7 @@
34
34
  );
35
35
 
36
36
  @if $inside {
37
- $gutters: get-gutters($layout);
37
+ $gutters: get-gutters($span);
38
38
  $output: map-merge($output, (
39
39
  padding_before: map-get($gutters, before),
40
40
  padding_after: map-get($gutters, after),
@@ -42,10 +42,10 @@
42
42
  }
43
43
 
44
44
  @if $symmetrical {
45
- $output: map-merge($output, (width: get-span-width($layout)));
45
+ $output: map-merge($output, (width: get-span-width($span)));
46
46
  }
47
47
 
48
- $box : susy-get(box-sizing, $layout);
48
+ $box : susy-get(box-sizing, $span);
49
49
  $global-box : if(susy-get(global-box-sizing) == 'border-box', true, false);
50
50
 
51
51
  // Collective Output
@@ -59,13 +59,13 @@
59
59
 
60
60
  // Individual Loop
61
61
  @for $item from 1 through $line {
62
- $n: '#{$line}n + #{$item}';
63
- &:nth-#{$selector}(#{$n}) {
62
+ $nth: '#{$line}n + #{$item}';
63
+ &:nth-#{$selector}(#{$nth}) {
64
64
  // Individual Prep
65
65
  $output: (
66
- width : if($symmetrical, null, get-span-width($layout)),
66
+ width : if($symmetrical, null, get-span-width($span)),
67
67
  float : null,
68
- margin_before : get-isolation($layout),
68
+ margin_before : get-isolation($span),
69
69
  margin_after : -100%,
70
70
  padding_before : null,
71
71
  padding_after : null,
@@ -75,17 +75,17 @@
75
75
  // Individual Output
76
76
  @include float-span-output($output...);
77
77
 
78
- @if get-edge($layout) == first {
78
+ @if get-edge($span) == first {
79
79
  @include break;
80
- @include first($layout);
80
+ @include first($span);
81
81
  } @else {
82
82
  @include nobreak;
83
83
  }
84
84
 
85
85
  // Individual Location Increment
86
- $location: get-location($layout) + $span;
86
+ $location: get-location($span) + $n;
87
87
  $location: if($location > $context, 1, $location);
88
- $layout: map-merge($layout, (location: $location));
88
+ $span: map-merge($span, (location: $location));
89
89
  }
90
90
  }
91
91
  }
@@ -1,36 +1,26 @@
1
1
  // Grid Syntax
2
2
  // ===========
3
3
 
4
- // Set Grid
5
- // --------
6
- // Set a new grid using a shorthand
7
- // - $grid: <settings>
8
- @mixin set-grid(
9
- $grid
10
- ) {
11
- $susy: map-merge($susy, parse-grid($grid)) !global;
12
- }
13
-
14
- // Susy Set
15
- // --------
16
- // Change one setting
17
- @mixin susy-set(
18
- $key,
19
- $value
4
+ // Layout
5
+ // ------
6
+ // Set a new layout using a shorthand
7
+ // - $layout: <settings>
8
+ @mixin layout(
9
+ $layout
20
10
  ) {
21
- $susy: map-merge($susy, ($key: $value)) !global;
11
+ $susy: map-merge($susy, parse-grid($layout)) !global;
22
12
  }
23
13
 
24
14
  // Use Grid
25
15
  // --------
26
- // Use an arbitrary grid for a section of code
27
- // - $grid: <settings>
28
- @mixin use-grid(
29
- $grid
16
+ // Use an arbitrary layout for a section of code
17
+ // - $layout: <settings>
18
+ @mixin with-layout(
19
+ $layout
30
20
  ) {
31
21
  $old: $susy;
32
22
 
33
- @include set-grid($grid);
23
+ @include layout($layout);
34
24
  @content;
35
25
 
36
26
  $susy: $old !global;
@@ -39,9 +29,9 @@
39
29
  // Layout
40
30
  // ------
41
31
  // Return a parsed layout map based on shorthand syntax
42
- // - $grid: <settings>
32
+ // - $layout: <settings>
43
33
  @function layout(
44
- $grid: $susy
34
+ $layout: $susy
45
35
  ) {
46
- @return parse-grid($grid);
36
+ @return parse-grid($layout);
47
37
  }
@@ -4,19 +4,19 @@
4
4
  // Gutters
5
5
  // -------
6
6
  // Set gutters on an element.
7
- // - [$context] : <settings>
7
+ // - [$span] : <settings>
8
8
  @mixin gutters(
9
- $context: $susy
9
+ $span: $susy
10
10
  ) {
11
- $context : parse-gutters($context);
12
- $gutters : get-gutters($context);
11
+ $span : parse-gutters($span);
12
+ $gutters : get-gutters($span);
13
13
  $output : (
14
14
  before: map-get($gutters, before),
15
15
  after: map-get($gutters, after),
16
- flow: susy-get(flow, $context),
16
+ flow: susy-get(flow, $span),
17
17
  );
18
18
 
19
- @if is-inside($context) {
19
+ @if is-inside($span) {
20
20
  @include padding-output($output...);
21
21
  } @else {
22
22
  @include margin-output($output...);
@@ -24,30 +24,30 @@
24
24
  }
25
25
 
26
26
  @mixin gutter(
27
- $context: $susy
27
+ $span: $susy
28
28
  ) {
29
- @include gutters($context);
29
+ @include gutters($span);
30
30
  }
31
31
 
32
32
  // Gutter
33
33
  // ------
34
34
  // Return the width of a gutter.
35
- // - [$context] : <settings>
35
+ // - [$span] : <settings>
36
36
  @function gutter(
37
- $context: $susy
37
+ $span: $susy
38
38
  ) {
39
- $context: parse-gutters($context);
39
+ $span: parse-gutters($span);
40
40
 
41
- $gutters: get-gutters($context);
41
+ $gutters: get-gutters($span);
42
42
  $gutters: map-get($gutters, before) or map-get($gutters, after);
43
43
 
44
44
  @return $gutters;
45
45
  }
46
46
 
47
47
  @function gutters(
48
- $context: $susy
48
+ $span: $susy
49
49
  ) {
50
- @return gutter($context);
50
+ @return gutter($span);
51
51
  }
52
52
 
53
53
  // Get Gutter Width
@@ -1,22 +1,45 @@
1
1
  // Isolation Syntax
2
2
  // ================
3
3
 
4
- // Isolate
5
- // -------
4
+
5
+ // Isolate [Mixin]
6
+ // ---------------
6
7
  // Set isolation as an override.
7
- // - $input : <span>
8
+ // - $location: <span>
8
9
  @mixin isolate(
9
- $input: first
10
+ $isolate: 1
10
11
  ) {
11
- $input : parse-span($input);
12
- $output : (
13
- push: get-isolation($input),
14
- flow: susy-get(flow, $input),
12
+ $output: (
13
+ push: isolate($isolate),
14
+ flow: susy-get(flow, $isolate),
15
15
  );
16
16
 
17
17
  @include isolate-output($output...);
18
18
  }
19
19
 
20
+
21
+ // Isolate [function]
22
+ // ------------------
23
+ // Return an isolation offset width.
24
+ // - $location: <span>
25
+ @function isolate(
26
+ $isolate: 1
27
+ ) {
28
+ $isolate: parse-span($isolate);
29
+ $isolation: susy-get(span, $isolate);
30
+
31
+ @if $isolation and not get-location($isolate) {
32
+ $new: (
33
+ span: null,
34
+ location: $isolation,
35
+ );
36
+ $isolate: map-merge($isolate, $new);
37
+ }
38
+
39
+ @return get-isolation($isolate);
40
+ }
41
+
42
+
20
43
  // Get Isolation
21
44
  // -------------
22
45
  // Return the isolation offset width
@@ -24,7 +47,6 @@
24
47
  @function get-isolation(
25
48
  $input
26
49
  ) {
27
- $span : susy-get(span, $input);
28
50
  $location : get-location($input);
29
51
  $columns : susy-get(columns, $input);
30
52
  $width : null;
@@ -63,11 +63,21 @@
63
63
  // - [$post] : <span>
64
64
  @mixin squish(
65
65
  $pre,
66
- $post: $pre
66
+ $post: false
67
67
  ) {
68
- $pre : if(length($pre) == 1 and length($post) > 1, set-nth($post, 1, $pre), $pre);
69
- $pre : map-merge((spread: wide), parse-span($pre));
70
- $post : map-merge((spread: wide), parse-span($post));
68
+ $pre: map-merge((spread: wide), parse-span($pre));
69
+
70
+ @if $post {
71
+ $post: map-merge((spread: wide), parse-span($post));
72
+ } @else {
73
+ $span: susy-get(span, $pre);
74
+ @if length($span) > 1 {
75
+ $pre: map-merge($pre, (span: nth($span, 1)));
76
+ $post: map-merge($pre, (span: nth($span, 2)));
77
+ } @else {
78
+ $post: $pre;
79
+ }
80
+ }
71
81
 
72
82
  @include pre($pre);
73
83
  @include post($post);
@@ -46,11 +46,21 @@
46
46
  // - [$post] : <span>
47
47
  @mixin pad(
48
48
  $pre,
49
- $post: $pre
49
+ $post: false
50
50
  ) {
51
- $pre : if(length($pre) == 1 and length($post) > 1, set-nth($post, 1, $pre), $pre);
52
- $pre : map-merge((spread: wide), parse-span($pre));
53
- $post : map-merge((spread: wide), parse-span($post));
51
+ $pre: map-merge((spread: wide), parse-span($pre));
52
+
53
+ @if $post {
54
+ $post: map-merge((spread: wide), parse-span($post));
55
+ } @else {
56
+ $span: susy-get(span, $pre);
57
+ @if length($span) > 1 {
58
+ $pre: map-merge($pre, (span: nth($span, 1)));
59
+ $post: map-merge($pre, (span: nth($span, 2)));
60
+ } @else {
61
+ $post: $pre;
62
+ }
63
+ }
54
64
 
55
65
  @include prefix($pre);
56
66
  @include suffix($post);
@@ -20,7 +20,7 @@
20
20
 
21
21
  // Full
22
22
  // ----
23
- // - [$span]: <span settings>
23
+ // - [$context]: <layout shorthand>
24
24
  @mixin full(
25
25
  $context: $susy
26
26
  ) {
@@ -30,44 +30,44 @@
30
30
 
31
31
  // First
32
32
  // -----
33
- // - [$grid]: <settings>
33
+ // - [$context]: <settings>
34
34
  @mixin first(
35
- $grid: $susy
35
+ $context: $susy
36
36
  ) {
37
- $grid: parse-grid($grid);
38
- $flow: susy-get(flow, $grid);
37
+ $context: parse-grid($context);
38
+ $flow: susy-get(flow, $context);
39
39
 
40
- @if not is-split($grid) {
40
+ @if not is-split($context) {
41
41
  @include float-first($flow);
42
42
  }
43
43
  }
44
44
 
45
45
  @mixin alpha(
46
- $grid: $susy
46
+ $context: $susy
47
47
  ) {
48
- @include first($grid);
48
+ @include first($context);
49
49
  }
50
50
 
51
51
 
52
52
  // Last
53
53
  // ----
54
- // - [$grid]: <settings>
54
+ // - [$context]: <settings>
55
55
  @mixin last(
56
- $grid: $susy
56
+ $context: $susy
57
57
  ) {
58
- $grid: parse-grid($grid);
58
+ $context: parse-grid($context);
59
59
  $output: (
60
- flow: susy-get(flow, $grid),
61
- margin: if(is-split($grid), gutters($grid), 0),
60
+ flow: susy-get(flow, $context),
61
+ margin: if(is-split($context), null, 0),
62
62
  );
63
63
 
64
64
  @include float-last($output...);
65
65
  }
66
66
 
67
67
  @mixin omega(
68
- $grid: $susy
68
+ $context: $susy
69
69
  ) {
70
- @include last($grid);
70
+ @include last($context);
71
71
  }
72
72
 
73
73
 
@@ -85,9 +85,12 @@
85
85
  $location: susy-get(location, $span);
86
86
  $n: susy-get(span, $span);
87
87
 
88
+ $number: if(type-of($location) == number, true, false);
89
+ $index: if($number and unitless($location), true, false);
90
+
88
91
  @if $n == $count {
89
92
  $edge: full;
90
- } @else if $location {
93
+ } @else if $location and $n and $index {
91
94
  @if $location == 1 {
92
95
  $edge: if($n == $count, full, first);
93
96
  } @else if $location + $n - 1 == $count {