breakpoint 2.3.1 → 2.4.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: ea2d03a4e01463ea1ae41b5f3b52d5cca388d603
4
- data.tar.gz: 364a78b11720bcd783aa5a56a3350ac4e9982abe
3
+ metadata.gz: 8d745281dd5b7421bd0d4c5228eddd140622eef6
4
+ data.tar.gz: bf0461398ad3a4928c1c7f1d62e624dd24a745b1
5
5
  SHA512:
6
- metadata.gz: 22959cd46b60d83ea6eb0340ef97534aff9c54c1c96db5d4176010979e37aa1d2174c4ecc29c0441e09045e77998169b1c38447ba861c498c816dfa17a268d83
7
- data.tar.gz: 55c46febac5519b5f9a16ec8cd708a69362fd6dce141703109ef9a6fff6496daa7e5f0f4d4e0adfe5de4b972552e5eada4bf0047968caaee04e1d61a7405423c
6
+ metadata.gz: f1d1b24e6da7ba07482a58523ae29e5cb72bebc9d24f6c728db076b51597a59bfdeb4d13a2f4b41cc402e39a2a3b1ef95611a6df4a583db8b302f0819e8ea2d3
7
+ data.tar.gz: 644f56229e904491e9a037918395bf32dad0daf1dde6d50262f22310675536d133f985de249320b3768d7c7d8fbe46de4652dc5108a837b89fc04cb6d2adcb5f
data/lib/breakpoint.rb CHANGED
@@ -1,8 +1,9 @@
1
1
  require 'compass'
2
+ require 'sassy-maps'
2
3
 
3
4
  Compass::Frameworks.register("breakpoint", :path => "#{File.dirname(__FILE__)}/..")
4
5
 
5
6
  module Breakpoint
6
- VERSION = "2.3.1"
7
- DATE = "2013-12-04"
7
+ VERSION = "2.4.0"
8
+ DATE = "2013-12-17"
8
9
  end
@@ -7,77 +7,98 @@
7
7
  @import "parsers/triple";
8
8
  @import "parsers/resolution";
9
9
 
10
+ $Memo-Exists: function-exists(memo-get) and function-exists(memo-set);
11
+
10
12
  //////////////////////////////
11
13
  // Breakpoint Function
12
14
  //////////////////////////////
13
15
  @function breakpoint($query, $contexts...) {
14
- // Internal Variables
15
- $query-string: '';
16
- $query-fallback: false;
16
+ $run: true;
17
17
  $return: ();
18
18
 
19
- // Reserve Global Private Breakpoint Context
20
- $holder-context: $private-breakpoint-context-holder;
21
- $holder-query-count: $private-breakpoint-query-count;
19
+ // Grab the Memo Output if Memoization can be a thing
20
+ @if $Memo-Exists {
21
+ $return: memo-get(breakpoint, breakpoint $query $contexts);
22
22
 
23
- // Reset Global Private Breakpoint Context
24
- $private-breakpoint-context-holder: () !global;
25
- $private-breakpoint-query-count: 0 !global;
23
+ @if $return != null {
24
+ $run: false;
25
+ }
26
+ }
26
27
 
28
+ @if not $Memo-Exists or $run {
29
+ // Internal Variables
30
+ $query-string: '';
31
+ $query-fallback: false;
32
+ $return: ();
27
33
 
28
- // Test to see if it's a comma-separated list
29
- $or-list: if(list-separator($query) == 'comma', true, false);
34
+ // Reserve Global Private Breakpoint Context
35
+ $holder-context: $private-breakpoint-context-holder;
36
+ $holder-query-count: $private-breakpoint-query-count;
30
37
 
38
+ // Reset Global Private Breakpoint Context
39
+ $private-breakpoint-context-holder: () !global;
40
+ $private-breakpoint-query-count: 0 !global;
31
41
 
32
- @if ($or-list == false and $breakpoint-legacy-syntax == false) {
33
- $query-string: breakpoint-parse($query);
34
- }
35
- @else {
36
- $length: length($query);
37
42
 
38
- $last: nth($query, $length);
39
- $query-fallback: breakpoint-no-query($last);
43
+ // Test to see if it's a comma-separated list
44
+ $or-list: if(list-separator($query) == 'comma', true, false);
45
+
40
46
 
41
- @if ($query-fallback != false) {
42
- $length: $length - 1;
47
+ @if ($or-list == false and $breakpoint-legacy-syntax == false) {
48
+ $query-string: breakpoint-parse($query);
43
49
  }
50
+ @else {
51
+ $length: length($query);
44
52
 
45
- @if ($breakpoint-legacy-syntax == true) {
46
- $mq: ();
53
+ $last: nth($query, $length);
54
+ $query-fallback: breakpoint-no-query($last);
47
55
 
48
- @for $i from 1 through $length {
49
- $mq: append($mq, nth($query, $i), comma);
56
+ @if ($query-fallback != false) {
57
+ $length: $length - 1;
50
58
  }
51
59
 
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));
60
+ @if ($breakpoint-legacy-syntax == true) {
61
+ $mq: ();
62
+
63
+ @for $i from 1 through $length {
64
+ $mq: append($mq, nth($query, $i), comma);
65
+ }
66
+
67
+ $query-string: breakpoint-parse($mq);
68
+ }
69
+ @else {
70
+ $query-string: '';
71
+ @for $i from 1 through $length {
72
+ $query-string: $query-string + if($i == 1, '', ', ') + breakpoint-parse(nth($query, $i));
73
+ }
58
74
  }
59
75
  }
60
- }
61
76
 
62
- $return: ('query': $query-string,
63
- 'fallback': $query-fallback,
64
- 'context holder': $private-breakpoint-context-holder,
65
- 'query count': $private-breakpoint-query-count
66
- );
67
- @if length($contexts) > 0 and nth($contexts, 1) != false {
68
- @if $query-fallback != false {
69
- $context-setter: private-breakpoint-set-context('no-query', $query-fallback);
77
+ $return: ('query': $query-string,
78
+ 'fallback': $query-fallback,
79
+ 'context holder': $private-breakpoint-context-holder,
80
+ 'query count': $private-breakpoint-query-count
81
+ );
82
+ @if length($contexts) > 0 and nth($contexts, 1) != false {
83
+ @if $query-fallback != false {
84
+ $context-setter: private-breakpoint-set-context('no-query', $query-fallback);
85
+ }
86
+ $context-map: ();
87
+ @each $context in $contexts {
88
+ $context-map: map-merge($context-map, ($context: breakpoint-get-context($context)));
89
+ }
90
+ $return: map-merge($return, (context: $context-map));
70
91
  }
71
- $context-map: ();
72
- @each $context in $contexts {
73
- $context-map: map-merge($context-map, ($context: breakpoint-get-context($context)));
92
+
93
+ // Reset Global Private Breakpoint Context
94
+ $private-breakpoint-context-holder: () !global;
95
+ $private-breakpoint-query-count: 0 !global;
96
+
97
+ @if $Memo-Exists {
98
+ $holder: memo-set(breakpoint, breakpoint $query $contexts, $return);
74
99
  }
75
- $return: map-merge($return, (context: $context-map));
76
100
  }
77
101
 
78
- // Reset Global Private Breakpoint Context
79
- $private-breakpoint-context-holder: () !global;
80
- $private-breakpoint-query-count: 0 !global;
81
102
  @return $return;
82
103
  }
83
104
 
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.3.1
4
+ version: 2.4.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-12-04 00:00:00.000000000 Z
12
+ date: 2013-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sass
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - ~>
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.0.0.alpha.13
42
+ - !ruby/object:Gem::Dependency
43
+ name: sassy-maps
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - <
47
+ - !ruby/object:Gem::Version
48
+ version: 1.0.0
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - <
54
+ - !ruby/object:Gem::Version
55
+ version: 1.0.0
42
56
  description: Really simple media queries in Sass
43
57
  email:
44
58
  - mason@thecodingdesigner.com