breakpoint 2.2.0 → 2.3.0

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: 8d365e3212d4b79464cbc2f5eadbcabe69e64869
4
- data.tar.gz: 305565d16c733060da89d576b613c270c9805064
3
+ metadata.gz: 187581b23b36b6c3c281fc34fcbe3c4132cf6bc7
4
+ data.tar.gz: 1281f213b32e0bfa780dd060a569170b568d8f62
5
5
  SHA512:
6
- metadata.gz: 66f36f855f898bc363dafc9f6de5a29592084d979b2363cd3690196ca4a31981c957eb5e27e37fe48bb0ac018f806f308b12d01cc5d18347637d451f78e58151
7
- data.tar.gz: 55fb6032e1bbaa5c90fff0057c2a6dd02cc586868e9ceb2792d82956dcbcff2ece4802edc7cdca0e41cc44da3dea9cbf398cf5f277cbe7c257517931c77bcf61
6
+ metadata.gz: 371973f6a05ee72454db2f96c90c96e444e84e3d6992e2f0df8ca1c06707cc84ed1976713489ec91a2a4ec23c7df2cefd1614cc8dcdd58ac3c8926f7a4699774
7
+ data.tar.gz: e7e13771c4fff147c92ee0303122081426906f399766217dbf8aa8d68a90786675e7d08b52a5285a77249c073505f83c991cbb03da598f268c41f6c5011f86b3
data/lib/breakpoint.rb CHANGED
@@ -3,6 +3,6 @@ require 'compass'
3
3
  Compass::Frameworks.register("breakpoint", :path => "#{File.dirname(__FILE__)}/..")
4
4
 
5
5
  module Breakpoint
6
- VERSION = "2.2.0"
7
- DATE = "2013-11-23"
6
+ VERSION = "2.3.0"
7
+ DATE = "2013-12-02"
8
8
  end
@@ -36,52 +36,26 @@ $breakpoint-legacy-syntax: false !default;
36
36
  //////////////////////////////
37
37
 
38
38
  @mixin breakpoint($query, $no-query: false) {
39
- // Internal Variables
40
- $query-string: '';
41
-
42
39
  // Reset contexts
43
40
  @include private-breakpoint-reset-contexts();
44
41
 
45
- // Test to see if it's a comma-separated list
46
- $or-list: if(list-separator($query) == 'comma', true, false);
47
- $query-fallback: false;
48
-
49
-
50
- @if ($or-list == false and $breakpoint-legacy-syntax == false) {
51
- $query-string: breakpoint-parse($query);
52
- }
53
- @else {
54
- $length: length($query);
55
-
56
- $last: nth($query, $length);
57
- $query-fallback: breakpoint-no-query($last);
58
-
59
- @if ($query-fallback != false) {
60
- $length: $length - 1;
61
- }
42
+ $breakpoint: breakpoint($query, false);
62
43
 
63
- @if ($breakpoint-legacy-syntax == true) {
64
- $mq: ();
44
+ $query-string: map-get($breakpoint, 'query');
45
+ $query-fallback: map-get($breakpoint, 'fallback');
65
46
 
66
- @for $i from 1 through $length {
67
- $mq: append($mq, nth($query, $i), comma);
68
- }
69
-
70
- $query-string: breakpoint-parse($mq);
71
- }
72
- @else {
73
- $query-string: '';
74
- @for $i from 1 through $length {
75
- $query-string: $query-string + if($i == 1, '', ', ') + breakpoint-parse(nth($query, $i));
76
- }
77
- }
78
- }
47
+ $private-breakpoint-context-holder: map-get($breakpoint, 'context holder') !global;
48
+ $private-breakpoint-query-count: map-get($breakpoint, 'query count') !global;
79
49
 
80
50
  // Allow for an as-needed override or usage of no query fallback.
81
51
  @if $no-query != false {
82
52
  $query-fallback: $no-query;
83
53
  }
84
54
 
55
+ @if $query-fallback != false {
56
+ $context-setter: private-breakpoint-set-context('no-query', $query-fallback);
57
+ }
58
+
85
59
  // Print Out Query String
86
60
  @if not $breakpoint-no-queries {
87
61
  @media #{$query-string} {
@@ -23,7 +23,14 @@ $private-breakpoint-query-count: 0 !default;
23
23
  //////////////////////////////
24
24
  @function breakpoint-get-context($feature) {
25
25
  @if map-has-key($private-breakpoint-context-holder, $feature) {
26
- @return map-get($private-breakpoint-context-holder, $feature);
26
+ $get: map-get($private-breakpoint-context-holder, $feature);
27
+ // Special handling of no-query from get side so /false/ prepends aren't returned
28
+ @if $feature == 'no-query' {
29
+ @if type-of($get) == 'list' and length($get) > 1 and nth($get, 1) == false {
30
+ $get: nth($get, length($get));
31
+ }
32
+ }
33
+ @return $get;
27
34
  }
28
35
  @else {
29
36
  @if breakpoint-has-context() and $feature == 'media' {
@@ -7,6 +7,81 @@
7
7
  @import "parsers/triple";
8
8
  @import "parsers/resolution";
9
9
 
10
+ //////////////////////////////
11
+ // Breakpoint Function
12
+ //////////////////////////////
13
+ @function breakpoint($query, $contexts...) {
14
+ // Internal Variables
15
+ $query-string: '';
16
+ $query-fallback: false;
17
+ $return: ();
18
+
19
+ // Reserve Global Private Breakpoint Context
20
+ $holder-context: $private-breakpoint-context-holder;
21
+ $holder-query-count: $private-breakpoint-query-count;
22
+
23
+ // Reset Global Private Breakpoint Context
24
+ $private-breakpoint-context-holder: () !global;
25
+ $private-breakpoint-query-count: 0 !global;
26
+
27
+
28
+ // Test to see if it's a comma-separated list
29
+ $or-list: if(list-separator($query) == 'comma', true, false);
30
+
31
+
32
+ @if ($or-list == false and $breakpoint-legacy-syntax == false) {
33
+ $query-string: breakpoint-parse($query);
34
+ }
35
+ @else {
36
+ $length: length($query);
37
+
38
+ $last: nth($query, $length);
39
+ $query-fallback: breakpoint-no-query($last);
40
+
41
+ @if ($query-fallback != false) {
42
+ $length: $length - 1;
43
+ }
44
+
45
+ @if ($breakpoint-legacy-syntax == true) {
46
+ $mq: ();
47
+
48
+ @for $i from 1 through $length {
49
+ $mq: append($mq, nth($query, $i), comma);
50
+ }
51
+
52
+ $query-string: breakpoint-parse($mq);
53
+ }
54
+ @else {
55
+ $query-string: '';
56
+ @for $i from 1 through $length {
57
+ $query-string: $query-string + if($i == 1, '', ', ') + breakpoint-parse(nth($query, $i));
58
+ }
59
+ }
60
+ }
61
+
62
+ @if length($contexts) == 0 or nth($contexts, 1) == false {
63
+ $return: ('query': $query-string,
64
+ 'fallback': $query-fallback,
65
+ 'context holder': $private-breakpoint-context-holder,
66
+ 'query count': $private-breakpoint-query-count
67
+ );
68
+ }
69
+ @else {
70
+ @if $query-fallback != false {
71
+ $context-setter: private-breakpoint-set-context('no-query', $query-fallback);
72
+ }
73
+
74
+ @each $context in $contexts {
75
+ $return: map-merge($return, ($context: breakpoint-get-context($context)));
76
+ }
77
+ }
78
+
79
+ // Reset Global Private Breakpoint Context
80
+ $private-breakpoint-context-holder: () !global;
81
+ $private-breakpoint-query-count: 0 !global;
82
+ @return $return;
83
+ }
84
+
10
85
  //////////////////////////////
11
86
  // General Breakpoint Parser
12
87
  //////////////////////////////
@@ -40,7 +115,7 @@
40
115
 
41
116
  // Parse a single feature
42
117
  @if ($length == 1) {
43
- // Feature is currenty a list, grab the actual value
118
+ // Feature is currently a list, grab the actual value
44
119
  $feature: nth($feature, 1);
45
120
 
46
121
  // Media Type must by convention be the first item, so it's safe to flat override $query-print, which right now should only be the default media type
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: breakpoint
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mason Wendell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-23 00:00:00.000000000 Z
12
+ date: 2013-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sass
@@ -17,31 +17,31 @@ dependencies:
17
17
  requirements:
18
18
  - - ~>
19
19
  - !ruby/object:Gem::Version
20
- version: 3.3.0.rc.1
20
+ version: 3.3.0.rc.2
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ~>
26
26
  - !ruby/object:Gem::Version
27
- version: 3.3.0.rc.1
27
+ version: 3.3.0.rc.2
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: compass
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ~>
33
33
  - !ruby/object:Gem::Version
34
- version: 0.13.alpha.7
34
+ version: 1.0.0.alpha.13
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - ~>
40
40
  - !ruby/object:Gem::Version
41
- version: 0.13.alpha.7
41
+ version: 1.0.0.alpha.13
42
42
  description: Really simple media queries in Sass
43
43
  email:
44
- - mason@zivtech.com
44
+ - mason@thecodingdesigner.com
45
45
  - sam@snug.ug
46
46
  executables: []
47
47
  extensions: []