breakpoint 2.2.0.alpha.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8d365e3212d4b79464cbc2f5eadbcabe69e64869
4
+ data.tar.gz: 305565d16c733060da89d576b613c270c9805064
5
+ SHA512:
6
+ metadata.gz: 66f36f855f898bc363dafc9f6de5a29592084d979b2363cd3690196ca4a31981c957eb5e27e37fe48bb0ac018f806f308b12d01cc5d18347637d451f78e58151
7
+ data.tar.gz: 55fb6032e1bbaa5c90fff0057c2a6dd02cc586868e9ceb2792d82956dcbcff2ece4802edc7cdca0e41cc44da3dea9cbf398cf5f277cbe7c257517931c77bcf61
data/CHANGELOG.markdown CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.2.0 - Nov 23, 2013
4
+ * fix simple or queries
5
+ * convert respond-to to use sass maps
6
+ * convert context to use sass maps
7
+
3
8
  ## 2.0.7 - Sept 17th, 2013
4
9
  * fix fallback support for 1.x
5
10
 
data/README.markdown CHANGED
@@ -1,6 +1,4 @@
1
- # Breakpoint #
2
-
3
- [![Build Status](https://travis-ci.org/Team-Sass/breakpoint.png)](https://travis-ci.org/Team-Sass/ breakpoint)
1
+ # Breakpoint [![Gem Version](https://badge.fury.io/rb/breakpoint.png)](http://badge.fury.io/rb/breakpoint) [![Build Status](https://travis-ci.org/Team-Sass/breakpoint.png)](https://travis-ci.org/Team-Sass/breakpoint)
4
2
 
5
3
  **Really Simple Media Queries with Sass**
6
4
 
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.alpha.1"
7
- DATE = "2013-10-20"
8
- end
6
+ VERSION = "2.2.0"
7
+ DATE = "2013-11-23"
8
+ end
@@ -127,3 +127,10 @@ $breakpoint-legacy-syntax: false !default;
127
127
 
128
128
  @include private-breakpoint-reset-contexts();
129
129
  }
130
+
131
+
132
+ @mixin mq($query, $no-query: false) {
133
+ @include breakpoint($query, $no-query) {
134
+ @content;
135
+ }
136
+ }
@@ -2,14 +2,14 @@
2
2
  // Private Breakpoint Variables
3
3
  //////////////////////////////
4
4
  $private-breakpoint-context-holder: ();
5
- $private-breakpoint-context-placeholder: 0;
5
+ $private-breakpoint-query-count: 0 !default;
6
6
 
7
7
  //////////////////////////////
8
8
  // Breakpoint Has Context
9
9
  // Returns whether or not you are inside a Breakpoint query
10
10
  //////////////////////////////
11
11
  @function breakpoint-has-context() {
12
- @if length($private-breakpoint-context-placeholder) {
12
+ @if length($private-breakpoint-query-count) {
13
13
  @return true;
14
14
  }
15
15
  @else {
@@ -17,36 +17,22 @@ $private-breakpoint-context-placeholder: 0;
17
17
  }
18
18
  }
19
19
 
20
-
21
20
  //////////////////////////////
22
21
  // Breakpoint Get Context
23
22
  // $feature: Input feature to get it's current MQ context. Returns false if no context
24
23
  //////////////////////////////
25
24
  @function breakpoint-get-context($feature) {
26
- @each $context in $private-breakpoint-context-holder {
27
- @if $feature == nth($context, 1) {
28
- // strip feature name
29
- $values: ();
30
- @for $i from 2 through length($context) {
31
- $values: append($values, nth($context, $i), comma);
32
- }
33
-
34
- $length: length($values) + 1;
35
- @for $i from $length through $private-breakpoint-context-placeholder {
36
- // Apply the Default Media type if feature is media
37
- @if $feature == 'media' {
38
- $values: append($values, $breakpoint-default-media, comma);
39
- }
40
- @else {
41
- $values: append($values, false, comma);
42
- }
43
- }
44
-
45
- @return $values;
25
+ @if map-has-key($private-breakpoint-context-holder, $feature) {
26
+ @return map-get($private-breakpoint-context-holder, $feature);
27
+ }
28
+ @else {
29
+ @if breakpoint-has-context() and $feature == 'media' {
30
+ @return $breakpoint-default-media;
31
+ }
32
+ @else {
33
+ @return false;
46
34
  }
47
35
  }
48
-
49
- @return false;
50
36
  }
51
37
 
52
38
  //////////////////////////////
@@ -57,68 +43,37 @@ $private-breakpoint-context-placeholder: 0;
57
43
  $feature: 'monochrome';
58
44
  }
59
45
 
60
- $placeholder-plus-one: ($private-breakpoint-context-placeholder + 1);
61
-
62
- $holder: ();
63
-
64
- @if $private-breakpoint-context-placeholder == 1 {
65
- $holder: ($feature $value);
66
- $private-breakpoint-context-holder: append($private-breakpoint-context-holder, $holder, comma) !global;
67
- @return true;
46
+ $current: map-get($private-breakpoint-context-holder, $feature);
47
+ @if $current and length($current) == $private-breakpoint-query-count {
48
+ @warn "You have already queried against `#{$feature}`. Unexpected things may happen if you query against the same feature more than once in the same `and` query. Breakpoint is overwriting the current context with `#{$value}`";
49
+ }
68
50
 
69
- } @else {
70
- $feature-used: false;
71
- @each $context in $private-breakpoint-context-holder {
72
- @if nth($context, 1) == $feature {
73
- $feature-used: $context;
51
+ @if not map-has-key($private-breakpoint-context-holder, $feature) {
52
+ $v-holder: ();
53
+ @for $i from 1 to $private-breakpoint-query-count {
54
+ @if $feature == 'media' {
55
+ $v-holder: append($v-holder, $breakpoint-default-media);
74
56
  }
75
- }
76
-
77
- @if $feature-used != false {
78
- $holder: $feature;
79
- @for $i from 2 through $placeholder-plus-one {
80
- @if $i <= length($feature-used) {
81
- $holder: append($holder, nth($feature-used, $i), space);
82
- } @elseif $i < $placeholder-plus-one {
83
- $holder: append($holder, false, space);
84
- } @else {
85
- $holder: append($holder, $value, space);
86
- }
57
+ @else {
58
+ $v-holder: append($v-holder, false);
87
59
  }
88
60
  }
89
- @elseif $feature-used == false {
90
- $holder: $feature;
91
- @for $i from 2 through $placeholder-plus-one {
92
- @if $i < $placeholder-plus-one {
93
- // Apply the Default Media type if feature is media
94
- @if $feature == 'media' {
95
- $holder: append($holder, $breakpoint-default-media, space);
96
- }
97
- @else {
98
- $holder: append($holder, false, space);
99
- }
100
-
101
- } @else {
102
- $holder: append($holder, $value, space);
103
- }
61
+ $v-holder: append($v-holder, $value);
62
+ $private-breakpoint-context-holder: map-merge($private-breakpoint-context-holder, ($feature: $v-holder)) !global;
63
+ }
64
+ @else {
65
+ $v-holder: map-get($private-breakpoint-context-holder, $feature);
66
+ $length: length($v-holder);
67
+ @for $i from $length to $private-breakpoint-query-count - 1 {
68
+ @if $feature == 'media' {
69
+ $v-holder: append($v-holder, $breakpoint-default-media);
104
70
  }
105
- }
106
-
107
- // Rebuild context
108
- $rebuild: ();
109
- @if $feature-used != false {
110
- @each $context in $private-breakpoint-context-holder {
111
- @if nth($context, 1) == nth($holder, 1) {
112
- $rebuild: append($rebuild, $holder, comma);
113
- } @else {
114
- $rebuild: append($rebuild, $context, comma);
115
- }
71
+ @else {
72
+ $v-holder: append($v-holder, false);
116
73
  }
117
-
118
- } @else {
119
- $rebuild: append($private-breakpoint-context-holder, $holder, comma);
120
74
  }
121
- $private-breakpoint-context-holder: $rebuild !global;
75
+ $v-holder: append($v-holder, $value);
76
+ $private-breakpoint-context-holder: map-merge($private-breakpoint-context-holder, ($feature: $v-holder)) !global;
122
77
  }
123
78
 
124
79
  @return true;
@@ -129,5 +84,5 @@ $private-breakpoint-context-placeholder: 0;
129
84
  //////////////////////////////
130
85
  @mixin private-breakpoint-reset-contexts {
131
86
  $private-breakpoint-context-holder: () !global;
132
- $private-breakpoint-context-placeholder: 0 !global;
133
- }
87
+ $private-breakpoint-query-count: 0 !global;
88
+ }
@@ -11,7 +11,8 @@
11
11
  // General Breakpoint Parser
12
12
  //////////////////////////////
13
13
  @function breakpoint-parse($query) {
14
- $private-breakpoint-context-placeholder: $private-breakpoint-context-placeholder + 1 !global;
14
+ // Increase number of 'and' queries
15
+ $private-breakpoint-query-count: $private-breakpoint-query-count + 1 !global;
15
16
 
16
17
  // Set up Media Type
17
18
  $query-print: '';
@@ -98,7 +99,22 @@
98
99
  $query-print: breakpoint-build-resolution($query-print, $query-resolution, $empty-media, $first);
99
100
  }
100
101
 
101
- // @return 'all';
102
+ // Loop through each feature that's been detected so far and append 'false' to the the value list to increment their counters
103
+ @each $f, $v in $private-breakpoint-context-holder {
104
+ $v-holder: $v;
105
+ $length: length($v-holder);
106
+ @if length($v-holder) < $private-breakpoint-query-count {
107
+ @for $i from $length to $private-breakpoint-query-count {
108
+ @if $f == 'media' {
109
+ $v-holder: append($v-holder, $breakpoint-default-media);
110
+ }
111
+ @else {
112
+ $v-holder: append($v-holder, false);
113
+ }
114
+ }
115
+ }
116
+ $private-breakpoint-context-holder: map-merge($private-breakpoint-context-holder, ($f: $v-holder)) !global;
117
+ }
102
118
 
103
119
  @return $query-print;
104
120
  }
@@ -6,39 +6,21 @@ $breakpoints: () !default;
6
6
  ////////////////////////
7
7
  // Respond-to API Mixin
8
8
  ////////////////////////
9
-
10
9
  @mixin respond-to($context, $no-query: false) {
11
- @if type-of($breakpoints) != 'list' {
10
+ @if type-of($breakpoints) != 'map' {
12
11
  // Just in case someone writes gibberish to the $breakpoints variable.
13
- @warn "Your breakpoints aren't a list! See https://github.com/snugug/respond-to#api if you'd like a reminder on how to use Respond-to";
12
+ @warn "Your breakpoints aren't a map! See https://github.com/snugug/respond-to#api if you'd like a reminder on how to use Respond-to";
13
+ @content;
14
14
  }
15
- @if length($breakpoints) != 0 {
16
- // If there's only one breakpoint, SASS will think it's a space separated list :P
17
- @if length($breakpoints) == 2 and type-of(nth($breakpoints, 1)) != 'list' {
18
- $breakpoints: append((), (nth($breakpoints, 1), nth($breakpoints, 2)));
19
- }
20
- @each $bkpt in $breakpoints {
21
- @if $context == nth($bkpt, 1) {
22
- $length: length($bkpt);
23
- $mq: false !default;
24
-
25
- @for $i from 2 through $length {
26
- // If it's the first item, override $mq
27
- @if $i == 2 {
28
- $mq: nth($bkpt, $i);
29
- }
30
- // Else, join $mq
31
- @else {
32
- $mq: join($mq, nth($bkpt, $i));
33
- }
34
- }
35
-
36
- @include breakpoint($mq, $no-query) {
37
- @content;
38
- }
39
- }
15
+ @else if map-has-key($breakpoints, $context) {
16
+ @include breakpoint(map-get($breakpoints, $context), $no-query) {
17
+ @content;
40
18
  }
41
19
  }
20
+ @else if not map-has-key($breakpoints, $context) {
21
+ @warn "`#{$context}` isn't a defined breakpoint! Please add it using `$breakpoints: add-breakpoint(`#{$context}`, $value);`";
22
+ @content;
23
+ }
42
24
  @else {
43
25
  @warn "You haven't created any breakpoints yet! Make some already! See https://github.com/snugug/respond-to#api if you'd like a reminder on how to use Respond-to";
44
26
  @content;
@@ -48,8 +30,18 @@ $breakpoints: () !default;
48
30
  //////////////////////////////
49
31
  // Add Breakpoint to Breakpoints
50
32
  //////////////////////////////
51
- @function add-breakpoint($name, $bkpt) {
52
- $bkpt: $name $bkpt;
53
- $output: append($breakpoints, $bkpt, 'comma');
54
- @return $output;
33
+ @function add-breakpoint($name, $bkpt, $overwrite: false) {
34
+ $output: ($name: $bkpt);
35
+ @if length($breakpoints) == 0 {
36
+ @return $output;
37
+ }
38
+ @else {
39
+ @if map-has-key($breakpoints, $name) and $overwrite != true {
40
+ @warn "You already have a breakpoint named `#{$name}`, please choose another breakpoint name, or pass in `$overwrite: true` to overwrite the previous breakpoint.";
41
+ @return $breakpoints;
42
+ }
43
+ @else if not map-has-key($breakpoints, $name) or $overwrite == true {
44
+ @return map-merge($breakpoints, $output);
45
+ }
46
+ }
55
47
  }
@@ -67,9 +67,16 @@
67
67
  $query-holder: append($query-holder, $feature-holder, comma);
68
68
  @return $query-holder;
69
69
  }
70
+ // let's check to see if the first item is a media type
71
+ @else if breakpoint-is-media(nth($query, 1)) {
72
+ $query-holder: append($query-holder, nth($query, 1));
73
+ $feature-holder: append(nth($query, 2), nth($query, 3), space);
74
+ $query-holder: append($query-holder, $feature-holder);
75
+ @return $query-holder;
76
+ }
70
77
  }
71
78
  }
72
79
 
73
- // If it's a single item, or if it's not a special case double or tripple, we can simply return the query.
80
+ // If it's a single item, or if it's not a special case double or triple, we can simply return the query.
74
81
  @return $query;
75
82
  }
metadata CHANGED
@@ -1,67 +1,52 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: breakpoint
3
- version: !ruby/object:Gem::Version
4
- prerelease: true
5
- segments:
6
- - 2
7
- - 2
8
- - 0
9
- - alpha
10
- - 1
11
- version: 2.2.0.alpha.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.2.0
12
5
  platform: ruby
13
- authors:
6
+ authors:
14
7
  - Mason Wendell
15
8
  - Sam Richard
16
9
  autorequire:
17
10
  bindir: bin
18
11
  cert_chain: []
19
-
20
- date: 2013-10-20 00:00:00 -06:00
21
- default_executable:
22
- dependencies:
23
- - !ruby/object:Gem::Dependency
12
+ date: 2013-11-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
24
15
  name: sass
25
- prerelease: false
26
- requirement: &id001 !ruby/object:Gem::Requirement
27
- requirements:
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
28
18
  - - ~>
29
- - !ruby/object:Gem::Version
30
- segments:
31
- - 3
32
- - 3
33
- - 0
34
- - rc
35
- - 1
19
+ - !ruby/object:Gem::Version
36
20
  version: 3.3.0.rc.1
37
21
  type: :runtime
38
- version_requirements: *id001
39
- - !ruby/object:Gem::Dependency
40
- name: compass
41
22
  prerelease: false
42
- requirement: &id002 !ruby/object:Gem::Requirement
43
- requirements:
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: 3.3.0.rc.1
28
+ - !ruby/object:Gem::Dependency
29
+ name: compass
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
44
32
  - - ~>
45
- - !ruby/object:Gem::Version
46
- segments:
47
- - 0
48
- - 13
49
- - alpha
50
- - 7
33
+ - !ruby/object:Gem::Version
51
34
  version: 0.13.alpha.7
52
35
  type: :runtime
53
- version_requirements: *id002
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: 0.13.alpha.7
54
42
  description: Really simple media queries in Sass
55
- email:
43
+ email:
56
44
  - mason@zivtech.com
57
45
  - sam@snug.ug
58
46
  executables: []
59
-
60
47
  extensions: []
61
-
62
48
  extra_rdoc_files: []
63
-
64
- files:
49
+ files:
65
50
  - README.markdown
66
51
  - CHANGELOG.markdown
67
52
  - lib/breakpoint.rb
@@ -82,37 +67,27 @@ files:
82
67
  - stylesheets/breakpoint/parsers/resolution/_resolution.scss
83
68
  - stylesheets/breakpoint/parsers/single/_default.scss
84
69
  - stylesheets/breakpoint/parsers/triple/_default.scss
85
- has_rdoc: true
86
70
  homepage: https://github.com/Team-Sass/breakpoint
87
71
  licenses: []
88
-
72
+ metadata: {}
89
73
  post_install_message:
90
74
  rdoc_options: []
91
-
92
- require_paths:
75
+ require_paths:
93
76
  - lib
94
- required_ruby_version: !ruby/object:Gem::Requirement
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- segments:
99
- - 0
100
- version: "0"
101
- required_rubygems_version: !ruby/object:Gem::Requirement
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- segments:
106
- - 1
107
- - 3
108
- - 6
77
+ required_ruby_version: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - '>='
85
+ - !ruby/object:Gem::Version
109
86
  version: 1.3.6
110
87
  requirements: []
111
-
112
88
  rubyforge_project: breakpoint
113
- rubygems_version: 1.3.6
89
+ rubygems_version: 2.0.3
114
90
  signing_key:
115
- specification_version: 3
91
+ specification_version: 4
116
92
  summary: An easy to use system for writing and managing media queries.
117
93
  test_files: []
118
-