susy 2.2.0.rc.2 → 2.2.1

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: efe693f6177ba52203efd47d5f71251e92d84129
4
- data.tar.gz: 9d79f60e34f216a9cd82e828c0016fc1fd8ca768
3
+ metadata.gz: aeff89a5dbdfc5672ff554689e6afbcdaa724e45
4
+ data.tar.gz: 9be2961b9570ce56d91f8989427a9b8be393caf5
5
5
  SHA512:
6
- metadata.gz: 02c575f8088039ab87672e6e0dd757d5b083fa550652810d1de5518dae716a0c323085478522667e551cba4321695b544d8e08d82f8b5bd4976a106df7df5e0f
7
- data.tar.gz: 8b8586e57411d4f6f42bbebd4fd1473c81b1ea41d54c07f2eccfc7cf4b70d8c02f71d784d3c6be4638f639e25ca72bcd19a6451c1e1a4622eac2d9c910c674b7
6
+ metadata.gz: 2770325f1fcede0dd34d97ae023c524cfb379b9dbc24c01e145320615dcbb4cd2f0e9ee09b8ff75e750d9173bb76954ff322d13864efff92c3378d3b493689cd
7
+ data.tar.gz: e36108df39a377d723e61895b5bd1989e0b99c63378abfa5416aab6530ae1f1eb96dc967f78079f37179dc23a37cb45af0d5cf650a870be0e165f1d9d8a6d6f0
@@ -1,4 +1,4 @@
1
- Copyright (c) 2014, Eric M. Suzanne
1
+ Copyright (c) 2015, Eric M. Suzanne
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.2.0.rc.1
1
+ 2.2.0
@@ -1,10 +1,11 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
- 2.2.0 - UNRELEASED
5
- ------------------
4
+ 2.2.1 - Jan 14 2015
5
+ -------------------
6
6
 
7
- - Add global ``$susy-breakpoints`` map for creating named breakpoints.
7
+ - Release npm ``susy`` package.
8
+ - Add global ``$susy-media`` map for creating named breakpoints.
8
9
  - Add internal media-query support for ``susy-breakpoint``
9
10
  without requiring the Breakpoint plugin.
10
11
  - ``susy-breakpoint`` mixin no longer requires ``$layout`` argument.
@@ -1,21 +1,24 @@
1
1
  // Breakpoint Integration
2
2
  // ======================
3
3
 
4
- $susy-breakpoints: ();
4
+ $susy-media: () !default;
5
+ $susy-media-fallback: false !default;
6
+
7
+ $_susy-media-context: ();
5
8
 
6
9
 
7
10
  // Susy Breakpoint
8
11
  // ---------------
9
- // Change grids at different mediaqueries.
10
- // - $query : <breakpoint $query>
12
+ // Change grids at different media query breakpoints.
13
+ // - $query : <min-width> [<max-width>] | <property> <value> | <map>
11
14
  // - $layout : <settings>
12
- // - $no-query : <breakpoint $no-query>
15
+ // - $no-query : <boolean> | <selector>
13
16
  @mixin susy-breakpoint(
14
17
  $query,
15
18
  $layout: false,
16
- $no-query: false
19
+ $no-query: $susy-media-fallback
17
20
  ) {
18
- @include susy-mq($query, $no-query) {
21
+ @include susy-media-router($query, $no-query) {
19
22
  @if $layout {
20
23
  @include with-layout($layout) {
21
24
  @content;
@@ -26,129 +29,153 @@ $susy-breakpoints: ();
26
29
  }
27
30
  }
28
31
 
29
- // Media Queries
30
- // -------------
31
- // Check for an existing breakpoint mixin, or provide a simple fallback.
32
+
33
+ // Susy Media
34
+ // ----------
32
35
  // - $query: <min-width> [<max-width>] | <property> <value>
33
36
  // - $no-query: <boolean> | <selector>
34
- @mixin susy-mq(
37
+ @mixin susy-media(
38
+ $query,
39
+ $no-query: $susy-media-fallback
40
+ ) {
41
+ $old-context: $_susy-media-context;
42
+ $name: if(map-has-key($susy-media, $query), $query, null);
43
+ $query: susy-get-media($query);
44
+ $query: susy-parse-media($query);
45
+
46
+ @include susy-media-context($query, $name);
47
+
48
+ @if $no-query and type-of($no-query) != string {
49
+ @content;
50
+ } @else {
51
+ @media #{susy-render-media($query)} {
52
+ @content;
53
+ }
54
+
55
+ @if type-of($no-query) == string {
56
+ #{$no-query} & {
57
+ @content;
58
+ }
59
+ }
60
+ }
61
+
62
+ @include susy-media-context($old-context, $clean: true);
63
+ }
64
+
65
+
66
+ // Media Router
67
+ // ------------
68
+ // Rout media arguments to the correct mixin.
69
+ @mixin susy-media-router(
35
70
  $query,
36
- $no-query: false
71
+ $no-query: $susy-media-fallback
37
72
  ) {
38
73
  @if susy-support(breakpoint, (mixin: breakpoint), $warn: false) {
39
74
  @include breakpoint($query, $no-query) {
40
75
  @content;
41
76
  }
42
77
  } @else {
43
- @media #{susy-build-breakpoint($query)} {
78
+ @include susy-media($query, $no-query) {
44
79
  @content;
45
80
  }
81
+ }
82
+ }
46
83
 
47
- @if $no-query {
48
- @if type-of($no-query) == string {
49
- #{$no-query} & {
50
- @content;
51
- }
52
- } @else {
53
- @content;
54
- }
55
- }
84
+
85
+ // Update Context
86
+ // -------------
87
+ // Set the new media context
88
+ @mixin susy-media-context(
89
+ $query,
90
+ $name: null,
91
+ $clean: false
92
+ ) {
93
+ $query: map-merge((name: $name), $query);
94
+
95
+ @if $clean {
96
+ $_susy-media-context: $query !global;
97
+ } @else {
98
+ $_susy-media-context: map-merge($_susy-media-context, $query) !global;
99
+ }
100
+ }
101
+
102
+
103
+ // Media Context
104
+ // -------------
105
+ // Return the full media context, or a single media property (e.g. min-width)
106
+ @function susy-media-context(
107
+ $property: false
108
+ ) {
109
+ @if $property {
110
+ @return map-get($_susy-media-context, $property);
111
+ } @else {
112
+ @return $_susy-media-context;
56
113
  }
57
114
  }
58
115
 
59
116
 
60
117
  // Get Media
61
118
  // ---------
62
- // Return a named media-query from $susy-breakpoints.
119
+ // Return a named media-query from $susy-media.
63
120
  // - $name: <key>
64
121
  @function susy-get-media(
65
122
  $name
66
123
  ) {
67
- $query: map-get($susy-breakpoints, $name);
68
-
69
- @if map-has-key($susy-breakpoints, $query) {
70
- $query: susy-get-media($query);
71
- }
72
-
73
- @if not($query) {
74
- @warn '"#{$name}" is not an option in $susy-breakpoints.';
124
+ @if map-has-key($susy-media, $name) {
125
+ $name: map-get($susy-media, $name);
126
+ $name: susy-get-media($name);
75
127
  }
76
128
 
77
- @return $query;
129
+ @return $name;
78
130
  }
79
131
 
80
132
 
81
- // Parse Breakpoint
82
- // ----------------
83
- // Return a formatted media-query
84
- // - $query: <min-width> [<max-width>] | <property> <value>
85
- @function susy-parse-breakpoint(
133
+ // Render Media
134
+ // ------------
135
+ // Build a media-query string from various media settings
136
+ @function susy-render-media(
86
137
  $query
87
138
  ) {
88
- $output: (
89
- min-width: null,
90
- max-width: null,
91
- );
139
+ $output: null;
140
+ @each $property, $value in $query {
141
+ $string: null;
92
142
 
93
- @if type-of($query) == map {
94
- @return $query;
95
- } @else if map-has-key($susy-breakpoints, $query) {
96
- @return susy-parse-breakpoint(susy-get-media($query));
97
- }
98
-
99
- $i: 1;
100
- @while $i <= length($query) {
101
- $this: nth($query, $i);
102
-
103
- @if type-of($this) == map {
104
- $output: map-merge($output, $this);
105
- } @else if type-of($this) == string {
106
- $i: $i + 1;
107
- @if $i > length($query) {
108
- @warn 'No value supplied for #{$this}';
109
- } @else {
110
- $value: nth($query, $i);
111
- $output: map-merge($output, ($this: $value));
112
- }
113
- } @else if type-of($this) == list {
114
- $prop: nth($this, 1);
115
- $value: nth($this, 2);
116
- $output: map-merge($output, ($prop: $value));
117
- } @else if type-of($this) == number {
118
- $prop: null;
119
- @each $key, $value in $output {
120
- @if not($value) and not($prop) {
121
- $prop: $key;
122
- }
123
- }
124
- $output: map-merge($output, ($prop: $this));
143
+ @if $property == media {
144
+ $string: $value;
145
+ } @else {
146
+ $string: '(#{$property}: #{$value})';
125
147
  }
126
148
 
127
- $i: $i + 1;
149
+ $output: if($output, '#{$output} and #{$string}', $string);
128
150
  }
129
151
 
130
152
  @return $output;
131
153
  }
132
154
 
133
155
 
134
- // Build Breakpoint
135
- // ----------------
136
-
137
- @function susy-build-breakpoint(
156
+ // Parse Media
157
+ // -----------
158
+ // Return parsed media-query settings based on shorthand
159
+ @function susy-parse-media(
138
160
  $query
139
161
  ) {
140
- $query: susy-parse-breakpoint($query);
141
- $return: null;
142
-
143
- @each $prop, $value in $query {
144
- @if $value {
145
- @if $return {
146
- $return: '#{$return} and (#{$prop}: #{$value})';
147
- } @else {
148
- $return: '(#{$prop}: #{$value})';
149
- }
162
+ $mq: null;
163
+ @if type-of($query) == map {
164
+ $mq: $query;
165
+ } @else if type-of($query) == number {
166
+ $mq: (min-width: $query);
167
+ } @else if type-of($query) == list and length($query) == 2 {
168
+ @if type-of(nth($query, 1)) == number {
169
+ $mq: (
170
+ min-width: min($query...),
171
+ max-width: max($query...),
172
+ );
173
+ } @else {
174
+ $mq: (nth($query, 1): nth($query, 2));
150
175
  }
176
+ } @else {
177
+ $mq: (media: '#{$query}');
151
178
  }
152
179
 
153
- @return $return;
180
+ @return $mq;
154
181
  }
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.rc.2
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Suzanne
@@ -136,9 +136,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - '>'
139
+ - - '>='
140
140
  - !ruby/object:Gem::Version
141
- version: 1.3.1
141
+ version: '1.2'
142
142
  requirements: []
143
143
  rubyforge_project: susy
144
144
  rubygems_version: 2.1.10