modular-scale 2.0.6 → 2.1.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: 8de48357a5e89e59a8190da7507025c2ff60b4d4
4
- data.tar.gz: 180a64149b98ad4ede3c45d01616ebdfd897dc29
3
+ metadata.gz: bc09fa2379f131d6f1a73d0e549fe17d13603196
4
+ data.tar.gz: e040091ffa1183f998473052a6084ffbe9b71ff5
5
5
  SHA512:
6
- metadata.gz: a629dfc386e7506f998710fa04814ef96f800a055f91a8ea25dc5465bafd71c090796a9a030acb6629d0b11608f361d5d6d434e545a4d726a7b19aec86c91c65
7
- data.tar.gz: aa492d829fc0bfbbd7e9a2ac9d8db3998d2c995363f3ccda3f54e3d410a0862b3e34fc81a963e4e80388aed1d1fb8c3ff23944b568f2989c28e9470468c1396b
6
+ metadata.gz: 761cfc5df949d1de71e3e54e38e450e213ebcb6789dc335047d6fb0a407886528ce5d338a1970130ed0a14a29b9e8b9a60fa2f1513a40eb07dbe5852d7ac8ffa
7
+ data.tar.gz: a88ddbbb8ab25fac1ceb8af781d1f6d4eb360f9990cde18034b0b23cf597960083f89921a9336676fbbf9d72993b5e802a507aa08b63b776e6c2ad8858057451
data/changelog.md CHANGED
@@ -1,3 +1,7 @@
1
+ # Version 2.1.0
2
+
3
+ Ground-up re-write of ms-respond based on http://madebymike.com.au/writing/precise-control-responsive-typography/
4
+
1
5
  # Version 2.0.6
2
6
 
3
7
  Pixel rounding and responsive mixins
data/lib/modular-scale.rb CHANGED
@@ -16,7 +16,7 @@ Compass::Frameworks.register('modular-scale', :path => extension_path)
16
16
  # a prerelease version
17
17
  # Date is in the form of YYYY-MM-DD
18
18
  module ModularScale
19
- VERSION = "2.0.6"
19
+ VERSION = "2.1.0"
20
20
  DATE = "2013-12-20"
21
21
  end
22
22
 
data/readme.md CHANGED
@@ -16,9 +16,14 @@ To get started, you need to select a ratio and a base value. The base value is u
16
16
 
17
17
  ### Bower
18
18
 
19
- * Terminal: `bower install modular-scale`
19
+ * Terminal: `bower install modular-scale --save-dev`
20
20
  * SCSS: `@import '../link_to_component_dir/modular-scale';`
21
21
 
22
+ ### Eyeglass
23
+
24
+ * Terminal: `npm install modularscale-sass --save-dev`
25
+ * SCSS: `@import 'modular-scale'`
26
+
22
27
  ### Vanilla Sass
23
28
 
24
29
  * [Download the latest zip](https://github.com/Team-Sass/modular-scale/releases/latest)
@@ -67,7 +72,7 @@ You can output a list to your terminal to help you find out what values are on y
67
72
  @debug ms-list($start, $end, $ms-base, $ms-ratio);
68
73
  ```
69
74
 
70
- You can use a double standard scale by simply adding more base sizes in a space-sepreated list.
75
+ You can use a double standard scale by simply adding more base sizes in a space-separated list.
71
76
  **note:** the starting point of the scale will always be the **first** value in this list
72
77
 
73
78
  ```scss
@@ -132,11 +137,21 @@ $ms-ratio: $my-ratio;
132
137
 
133
138
  ## Responsive scales
134
139
 
135
- At times you may want to have a scale with less contrast on small screens and big type with more contrast on larger screens. For this you can use the `ms-respond` mixin that allows you to plug in a range of ratios at various breakpoints.
140
+ Based on [Mike Riethmuller’s](https://twitter.com/MikeRiethmuller) [_Precise control over responsive typography_](http://madebymike.com.au/writing/precise-control-responsive-typography/). A fantastic technique for fluidly scaling typography.
141
+
142
+ First, you will need to set your range. A range is a list of ratio and breakpoint values from smallest to largest. Because this will render as a fluid range by default you will probably only want or need a range of two.
143
+
144
+ ```scss
145
+ $ms-range:
146
+ 1.1 20em,
147
+ 1.333 60em;
148
+ ```
136
149
 
137
- First, you will need to set your range. A range is a list of ratio and breakpoint values from smallest to largest.
150
+ If you want to have specified steps instead of fluid type set `$ms-fluid` to `false` and you may want to add more values to your range.
138
151
 
139
152
  ```scss
153
+ $ms-fluid: false;
154
+
140
155
  $ms-range:
141
156
  1.2 20em,
142
157
  1.3 30em,
@@ -153,14 +168,6 @@ foo {
153
168
  }
154
169
  ```
155
170
 
156
- ```css
157
- foo { font-size: 1.44em; }
158
- @media (min-width: 30em) { foo { font-size: 1.69em; } }
159
- @media (min-width: 40em) { foo { font-size: 1.96em; } }
160
- @media (min-width: 50em) { foo { font-size: 2.25em; } }
161
- @media (min-width: 60em) { foo { font-size: 2.56em; } }
162
- ```
163
-
164
171
  ## [Changelog](https://github.com/Team-Sass/modular-scale/releases)
165
172
 
166
173
  ### Licence
@@ -173,4 +180,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
173
180
 
174
181
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
175
182
 
176
- **The software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.**
183
+ **The software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.**
@@ -1,8 +1,9 @@
1
1
  @import "modular-scale/ratios";
2
2
 
3
- $ms-base: 1em !default;
4
- $ms-ratio: $golden !default;
5
- $ms-range: null !default;
3
+ $ms-base: 1em !default;
4
+ $ms-ratio: $golden !default;
5
+ $ms-range: null !default;
6
+ $ms-fluid: true !default;
6
7
 
7
8
  @import "modular-scale/tests";
8
9
 
@@ -1,16 +1,47 @@
1
+ // Stripping units is rarely a best practice and this function
2
+ // should not be used elsewhere
3
+ @function ms-unitless($val) {
4
+ $val: $val / ($val - $val + 1);
5
+ @return $val;
6
+ }
7
+
8
+ // Search config for values
9
+ @function ms-range($x,$y,$range:$ms-range) {
10
+ @return nth(nth($range,$x),$y);
11
+ }
12
+
13
+ // Generate calc() function
14
+ @function ms-respond-calc($value, $n, $range: $ms-range, $base: $ms-base) {
15
+ $val1: ms($value,$base,ms-range($n,1,$range));
16
+ $val2: ms($value,$base,ms-range($n+1,1,$range));
17
+ $break1: ms-range($n,2,$range);
18
+ $break2: ms-range($n+1,2,$range);
19
+ $diff: ms-unitless($val2) - ms-unitless($val1);
20
+ @if $ms-fluid {
21
+ @return calc( #{$val1} + #{$diff} * ( ( 100vw - #{$break1}) / #{ms-unitless($break2) - ms-unitless($break1)} ) );
22
+ } @else {
23
+ @return ms($value,$base,ms-range($n,1,$range));
24
+ }
25
+ }
26
+
27
+ // Main responsive mixin
1
28
  @mixin ms-respond($property, $value, $range: $ms-range, $base: $ms-base) {
29
+ // If there is no responsive config, just output the property and value
2
30
  @if $ms-range == null {
3
31
  #{$property}: ms($value,$base,$ms-ratio);
4
32
  } @else {
5
- @for $i from 1 through length($range) {
6
- @debug nth($range,$i);
7
- @if $i == 1 {
8
- #{$property}: ms($value,$base,nth(nth($range,$i),1));
9
- } @else {
10
- @media (min-width: nth(nth($range,$i),2)) {
11
- #{$property}: ms($value,$base,nth(nth($range,$i),1));
12
- }
33
+
34
+ // Initial value
35
+ #{$property}: ms($value,$base,ms-range(1,1,$range));
36
+
37
+ //
38
+ @for $i from 1 through (length($range) - 1) {
39
+ @media (min-width: ms-range($i,2,$range)) and (max-width: ms-range($i+1,2,$range)) {
40
+ #{$property}: ms-respond-calc($value, $i, $range, $base);
13
41
  }
14
42
  }
43
+ @media (min-width: ms-range(length($range),2,$range)) {
44
+ #{$property}: ms($value,$base,ms-range(length($range),1,$range));
45
+ }
15
46
  }
16
47
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modular-scale
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Kellum
@@ -16,14 +16,14 @@ dependencies:
16
16
  name: compass
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ">="
19
+ - - '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: 0.12.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ">="
26
+ - - '>='
27
27
  - !ruby/object:Gem::Version
28
28
  version: 0.12.0
29
29
  description: |-
@@ -43,10 +43,7 @@ extra_rdoc_files:
43
43
  - license.md
44
44
  - readme.md
45
45
  files:
46
- - changelog.md
47
46
  - lib/modular-scale.rb
48
- - license.md
49
- - readme.md
50
47
  - stylesheets/_modular-scale-tests.scss
51
48
  - stylesheets/_modular-scale.scss
52
49
  - stylesheets/modular-scale/_calc.scss
@@ -59,6 +56,9 @@ files:
59
56
  - stylesheets/modular-scale/_round-px.scss
60
57
  - stylesheets/modular-scale/_sort-list.scss
61
58
  - stylesheets/modular-scale/_tests.scss
59
+ - changelog.md
60
+ - license.md
61
+ - readme.md
62
62
  homepage: http://modularscale.com
63
63
  licenses:
64
64
  - MIT
@@ -69,17 +69,17 @@ require_paths:
69
69
  - lib
70
70
  required_ruby_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - ">="
77
+ - - '>='
78
78
  - !ruby/object:Gem::Version
79
79
  version: 1.3.6
80
80
  requirements: []
81
81
  rubyforge_project:
82
- rubygems_version: 2.2.2
82
+ rubygems_version: 2.0.14
83
83
  signing_key:
84
84
  specification_version: 4
85
85
  summary: Modular scale calculator built into your Sass.