susy 2.2.0.beta.2 → 2.2.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d3d0591f512412a10d2cc0d8a9bb0daf2b2161fa
4
- data.tar.gz: adfd26326c13e5af97efbf4386078be3739717d5
3
+ metadata.gz: 360d88c3ff882b9046a62354b8e152bdedf3b970
4
+ data.tar.gz: 5869cbf765871085cc6cf46d46f69a5a7933dc4b
5
5
  SHA512:
6
- metadata.gz: 2fb29b9a8c512387fc3a8192d566c9f56a28255a0efe52cb644045766f9c1accfebcccecb821510088ea5d62b133496c2531d40e076a981ade61af257000d43e
7
- data.tar.gz: 5518f798611cb3a6d9dbdde2b307cd61fdaacdb35a944c1e5766b4b7760765557d44bf6c36aae7cdb0f2371820760700719359f126ee93e9b481b0c2f440cf94
6
+ metadata.gz: 7dc1c83c77df18ff1287003fa7b9cbb93784a4e2a010810cd8d1d3a93e768731539e633b5a3da1fc287d05a6a3554391cfdf6715040f97075ef43051c0265d79
7
+ data.tar.gz: ebb8a4311e7f23bfeb7145eef1991c4aeda8e03ccd4861135f6ae46713a6f87aec050cebcc5887a5e51db63f8c1460f719ab6b3c6bf7574ee29a9d78aca57a49
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0.beta.1
1
+ 2.2.0.beta.2
data/docs/changelog.rst CHANGED
@@ -4,6 +4,11 @@ Changelog
4
4
  2.2.0 - UNRELEASED
5
5
  ------------------
6
6
 
7
+ - Add global ``$susy-breakpoints`` map for creating named breakpoints.
8
+ - Add internal media-query support for ``susy-breakpoint``
9
+ without requiring the Breakpoint plugin.
10
+ - ``susy-breakpoint`` mixin no longer requires ``$layout`` argument.
11
+ By default, no changes will be made to your existing layout.
7
12
  - Update ``global-box-sizing`` and the legacy ``border-box-sizing``
8
13
  mixins to optionally take another argument, ``$inherit``. This new
9
14
  argument is a boolean value that defaults to ``false``, meaning the
@@ -1,6 +1,7 @@
1
1
  // Breakpoint Integration
2
2
  // ======================
3
- // REQUIRES Breakpoint: http://breakpoint-sass.com/
3
+
4
+ $susy-breakpoints: ();
4
5
 
5
6
 
6
7
  // Susy Breakpoint
@@ -11,16 +12,141 @@
11
12
  // - $no-query : <breakpoint $no-query>
12
13
  @mixin susy-breakpoint(
13
14
  $query,
14
- $layout,
15
+ $layout: false,
15
16
  $no-query: false
16
17
  ) {
17
- @if mixin-exists(breakpoint) {
18
- @include breakpoint($query, $no-query) {
18
+ @include susy-mq($query, $no-query) {
19
+ @if $layout {
19
20
  @include with-layout($layout) {
20
21
  @content;
21
22
  }
23
+ } @else {
24
+ @content;
22
25
  }
26
+ }
27
+ }
28
+
29
+ // Media Queries
30
+ // -------------
31
+ // Check for an existing breakpoint mixin, or provide a simple fallback.
32
+ // - $query: <min-width> [<max-width>] | <property> <value>
33
+ // - $no-query: <boolean> | <selector>
34
+ @mixin susy-mq(
35
+ $query,
36
+ $no-query: false
37
+ ) {
38
+ @if susy-support(breakpoint, (mixin: breakpoint), $warn: false) {
39
+ @include breakpoint($query, $no-query);
23
40
  } @else {
24
- @warn "Susy-breakpoint requires the Breakpoint plugin (http://breakpoint-sass.com/)";
41
+ @media #{susy-build-breakpoint($query)} {
42
+ @content;
43
+ }
44
+
45
+ @if $no-query {
46
+ @if type-of($no-query) == string {
47
+ #{$no-query} & {
48
+ @content;
49
+ }
50
+ } @else {
51
+ @content;
52
+ }
53
+ }
25
54
  }
26
55
  }
56
+
57
+
58
+ // Get Media
59
+ // ---------
60
+ // Return a named media-query from $susy-breakpoints.
61
+ // - $name: <key>
62
+ @function susy-get-media(
63
+ $name
64
+ ) {
65
+ $query: map-get($susy-breakpoints, $name);
66
+
67
+ @if map-has-key($susy-breakpoints, $query) {
68
+ $query: susy-get-media($query);
69
+ }
70
+
71
+ @if not($query) {
72
+ @warn '"#{$name}" is not an option in $susy-breakpoints.';
73
+ }
74
+
75
+ @return $query;
76
+ }
77
+
78
+
79
+ // Parse Breakpoint
80
+ // ----------------
81
+ // Return a formatted media-query
82
+ // - $query: <min-width> [<max-width>] | <property> <value>
83
+ @function susy-parse-breakpoint(
84
+ $query
85
+ ) {
86
+ $output: (
87
+ min-width: null,
88
+ max-width: null,
89
+ );
90
+
91
+ @if type-of($query) == map {
92
+ @return $query;
93
+ } @else if map-has-key($susy-breakpoints, $query) {
94
+ @return susy-parse-breakpoint(susy-get-media($query));
95
+ }
96
+
97
+ $i: 1;
98
+ @while $i <= length($query) {
99
+ $this: nth($query, $i);
100
+
101
+ @if type-of($this) == map {
102
+ $output: map-merge($output, $this);
103
+ } @else if type-of($this) == string {
104
+ $i: $i + 1;
105
+ @if $i > length($query) {
106
+ @warn 'No value supplied for #{$this}';
107
+ } @else {
108
+ $value: nth($query, $i);
109
+ $output: map-merge($output, ($this: $value));
110
+ }
111
+ } @else if type-of($this) == list {
112
+ $prop: nth($this, 1);
113
+ $value: nth($this, 2);
114
+ $output: map-merge($output, ($prop: $value));
115
+ } @else if type-of($this) == number {
116
+ $prop: null;
117
+ @each $key, $value in $output {
118
+ @if not($value) and not($prop) {
119
+ $prop: $key;
120
+ }
121
+ }
122
+ $output: map-merge($output, ($prop: $this));
123
+ }
124
+
125
+ $i: $i + 1;
126
+ }
127
+
128
+ @return $output;
129
+ }
130
+
131
+
132
+ // Build Breakpoint
133
+ // ----------------
134
+
135
+ @function susy-build-breakpoint(
136
+ $query
137
+ ) {
138
+ $query: susy-parse-breakpoint($query);
139
+ $return: null;
140
+
141
+ @each $prop, $value in $query {
142
+ @if $value {
143
+ @if $return {
144
+ $return: '#{$return} and (#{$prop}: #{$value})';
145
+ } @else {
146
+ $return: '(#{$prop}: #{$value})';
147
+ }
148
+ }
149
+ }
150
+
151
+ @return $return;
152
+ }
@@ -1,9 +1,9 @@
1
1
  // Susy Browser Support
2
2
  // ====================
3
3
 
4
+ @import "support/support";
4
5
  @import "support/prefix";
5
6
  @import "support/background";
6
7
  @import "support/box-sizing";
7
8
  @import "support/rem";
8
9
  @import "support/clearfix";
9
- @import "support/support";
@@ -8,6 +8,7 @@
8
8
  clearfix: false,
9
9
  background-image: true,
10
10
  background-options: false,
11
+ breakpoint: true,
11
12
  box-sizing: true,
12
13
  rem: true,
13
14
  ),
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: susy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0.beta.2
4
+ version: 2.2.0.beta.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Suzanne