gridle 1.0.9.7 → 1.0.9.8

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: f10fc0b150ab3c64be7e0097cce080371660a7e9
4
- data.tar.gz: bc9ae8b1c2c60516515139c6f399d403a0a7288d
3
+ metadata.gz: faec1a968eba7f2d396f243ef3ab3a07956e8933
4
+ data.tar.gz: fa78e2667852d67d71bb64fa785885a5f583d90b
5
5
  SHA512:
6
- metadata.gz: 70657a3825f54ba8ebb85aea0f55379863fe82599b4b3f9ed83dc9fc9d8e0217c9dd675cab8144a2e0e2c27d2f55410f30a4e76c0580b4e662a1465cfd3dc3a5
7
- data.tar.gz: 56eaa5dea9ca3d596a02688b088daa773c53e471b859c92991a22cc7e782380e03d2588231a61897b0175f279cb799b3d42bb71c07edcf3159d402df3bce21f0
6
+ metadata.gz: 1932d9238a563afb9017e724018360aa5660efa8189e3292912f5ca9552d8e0ab7d784c9475ca53f806c94ff4ae3df06bab637405e53d547ec735075a23c86cc
7
+ data.tar.gz: c57c67cee58a57920e5d5df3b681b5d0008ad1cf0b2303838352f769464dcabdaf110f645760adb84d3438926fe5d3f828c49ecdb2598f18d6adcba16fe44326
@@ -17,8 +17,8 @@ Compass::Frameworks.register('gridle', :path => extension_path)
17
17
  # a prerelease version
18
18
  # Date is in the form of YYYY-MM-DD
19
19
  module Extension
20
- VERSION = "1.0.9.7"
21
- DATE = "2013-11-20"
20
+ VERSION = "1.0.9.8"
21
+ DATE = "2013-11-26"
22
22
  end
23
23
 
24
24
  # This is where any custom SassScript should be placed. The functions will be
@@ -29,9 +29,9 @@
29
29
  // |------------------------------------------------------
30
30
  // |------------------------------------------------------
31
31
  // @created 25.03.13
32
- // @updated 20.11.13
32
+ // @updated 26.11.13
33
33
  // @author Olivier Bossel <olivier.bossel@gmail.com>
34
- // @version 1.0.9.7
34
+ // @version 1.0.9.8
35
35
  // |------------------------------------------------------
36
36
  // |------------------------------------------------------
37
37
 
@@ -396,10 +396,11 @@ $_gridle-state-15-classes : true !default;
396
396
  // @param String $state The state name
397
397
  // @return String The query
398
398
  @function _get_media_query_for_state(
399
- $state
399
+ $state-or-min-width : null,
400
+ $max-width : null
400
401
  ) {
401
402
  // get the index of state :
402
- $idx : _gridle_get_media_query_index_by_name($state);
403
+ $idx : _gridle_get_media_query_index_by_name($state-or-min-width);
403
404
 
404
405
  // if there's an idx, the state requested is a registered one :
405
406
  @if $idx {
@@ -419,26 +420,37 @@ $_gridle-state-15-classes : true !default;
419
420
 
420
421
  // write media query :
421
422
  @if $min-width and $max-width {
422
- @return "@media screen and (min-width: #{$min-width}) and (max-width: #{$max-width})";
423
+ @return "screen and (min-width: #{$min-width}) and (max-width: #{$max-width})";
423
424
  } @else if $min-width == null and $max-width {
424
- @return "@media screen and (max-width: #{$max-width})";
425
+ @return "screen and (max-width: #{$max-width})";
425
426
  } @else if $min-width and $max-width == null {
426
- @return "@media screen and (min-width: #{$min-width})";
427
+ @return "screen and (min-width: #{$min-width})";
427
428
  } @else {
428
429
  @return null;
429
430
  }
430
431
  }
431
432
  }
432
- } @else if $state == 'print' or $state == print {
433
+ } @else if $state-or-min-width == 'print' or $state-or-min-width == print {
433
434
  @return "only print";
434
- } @else if $state == 'tv' or $state == tv {
435
+ } @else if $state-or-min-width == 'tv' or $state-or-min-width == tv {
435
436
  @return "only tv";
436
- } @else if $state == 'portrait' or $state == portrait {
437
+ } @else if $state-or-min-width == 'portrait' or $state-or-min-width == portrait {
437
438
  @return "only screen and (orientation: portrait)";
438
- } @else if $state == 'landscape' or $state == landscape {
439
+ } @else if $state-or-min-width == 'landscape' or $state-or-min-width == landscape {
439
440
  @return "only screen and (orientation: landscape)";
440
- } @else if $state == 'retina' or $state == retina {
441
+ } @else if $state-or-min-width == 'retina' or $state-or-min-width == retina {
441
442
  @return "only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min--moz-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx)";
443
+ } @else {
444
+ // check for min and max width :
445
+ @if $state-or-min-width and $max-width {
446
+ @return "screen and (min-width: #{$state-or-min-width}) and (max-width: #{$max-width})";
447
+ } @else if $state-or-min-width and $max-width == null {
448
+ @return "screen and (min-width: #{$state-or-min-width})";
449
+ } @else if $state-or-min-width == null and $max-width {
450
+ @return "screen and (max-width: #{$max-width})";
451
+ } @else {
452
+ @return null;
453
+ }
442
454
  }
443
455
  }
444
456
 
@@ -789,83 +801,33 @@ $_gridle-state-15-classes : true !default;
789
801
  $max-width : null,
790
802
  $has-parent : true
791
803
  ) {
792
- // get the index of state :
793
- $idx : _gridle_get_media_query_index_by_name($state-or-min-width);
794
-
795
- // check if is a state :
796
- @if type-of($state-or-min-width) == string and $gridle-html-states-classes {
797
- // html class :
798
- @if $has-parent {
799
- html#{_gridle_prefixed_class("#{$state-or-min-width}")} & { @content; }
800
- } @else {
801
- html#{_gridle_prefixed_class("#{$state-or-min-width}")} { @content; }
802
- }
803
- }
804
804
 
805
- // if an idx exist, mean that it's a registered state :
806
- @if $idx {
807
- // get vars :
808
- $name : _gridle_get_media_query_vars($idx,"name");
809
- $min-width : _gridle_get_media_query_vars($idx,"min-width");
810
- $max-width : _gridle_get_media_query_vars($idx,"max-width");
811
- $classes : _gridle_get_media_query_vars($idx,"classes");
812
- $query : _gridle_get_media_query_vars($idx,"query");
805
+ // query list :
806
+ $query : ();
813
807
 
814
- // check if exist :
815
- @if $name {
816
- // check if query exist :
817
- @if $query {
818
- @media #{$query} {
819
- @content;
820
- }
808
+ // loop on each states :
809
+ @each $_state-or-min-width in $state-or-min-width {
810
+
811
+ // check if is a state :
812
+ @if type-of($_state-or-min-width) == string and $gridle-html-states-classes {
813
+ // html class :
814
+ @if $has-parent {
815
+ html#{_gridle_prefixed_class("#{$_state-or-min-width}")} & { @content; }
821
816
  } @else {
822
- // write media query :
823
- @if $min-width and $max-width {
824
- @media screen and (min-width: $min-width) and (max-width: $max-width) { @content; }
825
- } @else if $min-width == null and $max-width {
826
- @media screen and (max-width: $max-width) { @content; }
827
- } @else if $min-width and $max-width == null {
828
- @media screen and (min-width: $min-width) { @content; }
829
- } @else {
830
- @content;
831
- }
817
+ html#{_gridle_prefixed_class("#{$_state-or-min-width}")} { @content; }
832
818
  }
833
819
  }
834
- } @else if $state-or-min-width == 'print' or $state-or-min-width == print {
835
- @media only print {
836
- @content;
837
- }
838
- } @else if $state-or-min-width == 'tv' or $state-or-min-width == tv {
839
- @media only tv {
840
- @content;
841
- }
842
- } @else if $state-or-min-width == 'portrait' or $state-or-min-width == portrait {
843
- @media only screen and (orientation: portrait) {
844
- @content;
845
- }
846
- } @else if $state-or-min-width == 'landscape' or $state-or-min-width == landscape {
847
- @media only screen and (orientation: landscape) {
848
- @content;
849
- }
850
- } @else if $state-or-min-width == 'retina' or $state-or-min-width == retina {
851
- @media only screen and (-webkit-min-device-pixel-ratio: 2),
852
- only screen and ( min--moz-device-pixel-ratio: 2),
853
- only screen and ( -o-min-device-pixel-ratio: 2/1),
854
- only screen and ( min-device-pixel-ratio: 2),
855
- only screen and ( min-resolution: 192dpi),
856
- only screen and ( min-resolution: 2dppx)
857
- {
858
- @content;
820
+
821
+ // get the media query :
822
+ $q : _get_media_query_for_state($_state-or-min-width, $max-width);
823
+ @if $q {
824
+ $query : append($query, unquote("#{$q}"), comma);
859
825
  }
860
- } @else {
861
- // check for min and max width :
862
- @if $state-or-min-width and $max-width {
863
- @media screen and (min-width: $state-or-min-width) and (max-width: $max-width) { @content; }
864
- } @else if $state-or-min-width and $max-width == null {
865
- @media screen and (min-width: $state-or-min-width) { @content; }
866
- } @else if $state-or-min-width == null and $max-width {
867
- @media screen and (max-width: $max-width) { @content; }
868
- } @else {
826
+ }
827
+
828
+ // check and print media query :
829
+ @if length($query) {
830
+ @media #{$query} {
869
831
  @content;
870
832
  }
871
833
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gridle
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9.7
4
+ version: 1.0.9.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Bossel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-20 00:00:00.000000000 Z
11
+ date: 2013-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass