gridle 2.0.44 → 2.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gridle.rb +2 -2
- data/stylesheets/gridle/_api.scss +13 -13
- data/stylesheets/gridle/_functions.scss +142 -44
- data/stylesheets/gridle/_generate-mixins.scss +95 -19
- data/stylesheets/gridle/_init.scss +10 -7
- data/stylesheets/gridle/_mixins.scss +1 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92a05bad78d0ee99a46d7a8de0b46c7575bf44a
|
4
|
+
data.tar.gz: cb0eba8b1f2b143dc87abc3613a998cea9ae725c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5e6e0c7da9d366f76c91b6cdb3e4ff327db7873f3ba7ebbc7b37c6132fa206beeedef6de51b9fa4a79bc7ad6d85eb0b0ba0afa2494cf00cad621face2c4e04e
|
7
|
+
data.tar.gz: 09943c67ae9db9371f64563d9358566688fd9bbe776b47f5c88b26cfde5a436ca3eee8934a453c0a387a8e8dd05a06b1d152b3b677172956d92814b5b8ea595e
|
data/lib/gridle.rb
CHANGED
@@ -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 = "2.0.
|
21
|
-
DATE = "
|
20
|
+
VERSION = "2.0.45"
|
21
|
+
DATE = "2016-04-18"
|
22
22
|
end
|
23
23
|
|
24
24
|
# This is where any custom SassScript should be placed. The functions will be
|
@@ -9,7 +9,7 @@
|
|
9
9
|
@include gridle_row();
|
10
10
|
@each $sel, $l in $layout {
|
11
11
|
> #{$sel} {
|
12
|
-
@include gridle($l);
|
12
|
+
@include gridle($l);
|
13
13
|
}
|
14
14
|
}
|
15
15
|
}
|
@@ -91,7 +91,7 @@
|
|
91
91
|
$var : $var * -1;
|
92
92
|
}
|
93
93
|
}
|
94
|
-
|
94
|
+
|
95
95
|
&[#{$op}~="#{$var}"] {
|
96
96
|
@content;
|
97
97
|
}
|
@@ -361,12 +361,12 @@
|
|
361
361
|
// }
|
362
362
|
|
363
363
|
// set value :
|
364
|
-
@if $direction == rtl { right:$width; }
|
365
|
-
@else { left:$width; }
|
364
|
+
@if $direction == rtl { right:$width;left:auto; }
|
365
|
+
@else { left:$width;right:auto; }
|
366
366
|
// handle direction attribute
|
367
367
|
@if gridle_get_state_var(dir-attribute) {
|
368
368
|
[dir="rtl"] & {
|
369
|
-
right: $width;
|
369
|
+
right: $width;
|
370
370
|
}
|
371
371
|
[dir="ltr"] & {
|
372
372
|
left: $width;
|
@@ -423,12 +423,12 @@
|
|
423
423
|
// }
|
424
424
|
|
425
425
|
// set value :
|
426
|
-
@if $direction == rtl { left:$width; }
|
427
|
-
@else { right:$width; }
|
426
|
+
@if $direction == rtl { left:$width;right:auto; }
|
427
|
+
@else { right:$width;left:auto; }
|
428
428
|
// handle direction attribute
|
429
429
|
@if gridle_get_state_var(dir-attribute) {
|
430
430
|
[dir="rtl"] & {
|
431
|
-
left: $width;
|
431
|
+
left: $width;
|
432
432
|
}
|
433
433
|
[dir="ltr"] & {
|
434
434
|
right: $width;
|
@@ -481,7 +481,7 @@
|
|
481
481
|
// handle direction attribute
|
482
482
|
@if gridle_get_state_var(dir-attribute) {
|
483
483
|
[dir="rtl"] & {
|
484
|
-
margin-right: $width;
|
484
|
+
margin-right: $width;
|
485
485
|
}
|
486
486
|
[dir="ltr"] & {
|
487
487
|
margin-left: $width;
|
@@ -534,7 +534,7 @@
|
|
534
534
|
// handle direction attribute
|
535
535
|
@if gridle_get_state_var(dir-attribute) {
|
536
536
|
[dir="rtl"] & {
|
537
|
-
margin-left: $width;
|
537
|
+
margin-left: $width;
|
538
538
|
}
|
539
539
|
[dir="ltr"] & {
|
540
540
|
margin-right: $width;
|
@@ -630,7 +630,7 @@
|
|
630
630
|
display: table;
|
631
631
|
clear: both;
|
632
632
|
}
|
633
|
-
|
633
|
+
|
634
634
|
}
|
635
635
|
@mixin gridle_container(
|
636
636
|
) {
|
@@ -799,7 +799,7 @@
|
|
799
799
|
$side-or-size : top right bottom left
|
800
800
|
) {
|
801
801
|
@include _gridle_call(gutter) {
|
802
|
-
|
802
|
+
|
803
803
|
// get a gutter map
|
804
804
|
$gutters : _gridle_forge_gutters_map($side-or-size);
|
805
805
|
|
@@ -811,4 +811,4 @@
|
|
811
811
|
}
|
812
812
|
|
813
813
|
}
|
814
|
-
}
|
814
|
+
}
|
@@ -58,7 +58,7 @@
|
|
58
58
|
//
|
59
59
|
@function remove-nth($list, $index) {
|
60
60
|
$result: null;
|
61
|
-
|
61
|
+
|
62
62
|
@if type-of($index) != number {
|
63
63
|
@warn "$index: #{quote($index)} is not a number for `remove-nth`.";
|
64
64
|
}
|
@@ -73,7 +73,7 @@
|
|
73
73
|
|
74
74
|
@else {
|
75
75
|
$result: ();
|
76
|
-
$index: if($index < 0, length($list) + $index + 1, $index);
|
76
|
+
$index: if($index < 0, length($list) + $index + 1, $index);
|
77
77
|
|
78
78
|
@for $i from 1 through length($list) {
|
79
79
|
@if $i != $index {
|
@@ -81,7 +81,7 @@
|
|
81
81
|
}
|
82
82
|
}
|
83
83
|
}
|
84
|
-
|
84
|
+
|
85
85
|
@return $result;
|
86
86
|
}
|
87
87
|
|
@@ -125,7 +125,7 @@
|
|
125
125
|
|
126
126
|
//
|
127
127
|
// Get states count
|
128
|
-
//
|
128
|
+
//
|
129
129
|
// @return int The number of states defined
|
130
130
|
//
|
131
131
|
@function gridle_states_count() {
|
@@ -201,8 +201,8 @@
|
|
201
201
|
and type-of($stateMap-or-stateName) == map
|
202
202
|
{
|
203
203
|
// prepare state
|
204
|
-
$stateMap-or-stateName : _gridle_prepare_state_settings($stateMap-or-stateName);
|
205
|
-
// create a new state by merging given one with
|
204
|
+
$stateMap-or-stateName : _gridle_prepare_state_settings($stateMap-or-stateName);
|
205
|
+
// create a new state by merging given one with default one
|
206
206
|
$state : map-merge($_gridle-settings, $stateMap-or-stateName);
|
207
207
|
// set the name with random name
|
208
208
|
$state : map-set($state, name, unique-id());
|
@@ -244,9 +244,9 @@
|
|
244
244
|
//
|
245
245
|
// Get a variable
|
246
246
|
//
|
247
|
-
// @param String $varName
|
247
|
+
// @param String $varName The variable name
|
248
248
|
// @param String $stateMap-or-stateName The state name or a map state value
|
249
|
-
// @return Mixed
|
249
|
+
// @return Mixed The finded value
|
250
250
|
//
|
251
251
|
@function gridle_get_state_var(
|
252
252
|
$varName,
|
@@ -262,7 +262,7 @@
|
|
262
262
|
@if map-has-key($state, unquote("#{$varName}")) {
|
263
263
|
@return map-get($state, unquote("#{$varName}"));
|
264
264
|
}
|
265
|
-
|
265
|
+
|
266
266
|
// nothing finded :
|
267
267
|
@return null;
|
268
268
|
}
|
@@ -331,14 +331,14 @@
|
|
331
331
|
@function gridle_get_apply_css_for_map(
|
332
332
|
$for,
|
333
333
|
$stateName : default
|
334
|
-
) {
|
334
|
+
) {
|
335
335
|
// check if has some extend for this state
|
336
336
|
$map : map-get($_gridle_apply_css_for, $stateName);
|
337
337
|
@if $map == null { @return null; }
|
338
338
|
|
339
339
|
// check if has some extend for the requested for
|
340
340
|
$extend : map-get($map, $for);
|
341
|
-
|
341
|
+
|
342
342
|
// return the resulting extend map
|
343
343
|
@return $extend;
|
344
344
|
}
|
@@ -350,14 +350,14 @@
|
|
350
350
|
@function gridle_get_extend_class_map(
|
351
351
|
$for,
|
352
352
|
$stateName : default
|
353
|
-
) {
|
353
|
+
) {
|
354
354
|
// check if has some extend for this state
|
355
355
|
$map : map-get($_gridle_extend_base_classes, $stateName);
|
356
356
|
@if $map == null { @return null; }
|
357
357
|
|
358
358
|
// check if has some extend for the requested for
|
359
359
|
$extend : map-get($map, $for);
|
360
|
-
|
360
|
+
|
361
361
|
// return the resulting extend map
|
362
362
|
@return $extend;
|
363
363
|
}
|
@@ -366,9 +366,9 @@
|
|
366
366
|
//
|
367
367
|
// Generate a column
|
368
368
|
//
|
369
|
-
// @param String $name
|
370
|
-
// @param int $columns
|
371
|
-
// @param int $context
|
369
|
+
// @param String $name The column name (often count)
|
370
|
+
// @param int $columns The column count that the column will take
|
371
|
+
// @param int $context The context on which the width will be calculed
|
372
372
|
// @param Boolean $generateClasses Set if the column has to be generated in css
|
373
373
|
//
|
374
374
|
@function _gridle_create_column(
|
@@ -409,7 +409,7 @@
|
|
409
409
|
|
410
410
|
// // add column in columns map
|
411
411
|
$columnsMap : map-set($columnsMap, $columnName, $col);
|
412
|
-
}
|
412
|
+
}
|
413
413
|
|
414
414
|
// return columns
|
415
415
|
@return $columnsMap;
|
@@ -485,7 +485,7 @@
|
|
485
485
|
// otherwise, the base state is a custom one so we keep
|
486
486
|
// it and extend the wanted state with it
|
487
487
|
$new-state : map-remove($extend-state, name); // remove the name is important here!
|
488
|
-
@return map-merge($state, $new-state);
|
488
|
+
@return map-merge($state, $new-state);
|
489
489
|
}
|
490
490
|
}
|
491
491
|
|
@@ -516,7 +516,7 @@
|
|
516
516
|
);
|
517
517
|
} @else if type-of($side-or-size) == list or type-of($side-or-size) == string {
|
518
518
|
|
519
|
-
// check if is a full number list
|
519
|
+
// check if is a full number list
|
520
520
|
$list-number : true;
|
521
521
|
@each $s in $side-or-size {
|
522
522
|
@if type-of($s) != number {
|
@@ -543,7 +543,7 @@
|
|
543
543
|
left : nth($side-or-size,4)
|
544
544
|
)
|
545
545
|
}
|
546
|
-
|
546
|
+
|
547
547
|
} @else {
|
548
548
|
// forge the map with registered values
|
549
549
|
@each $side in (top right bottom left) {
|
@@ -567,7 +567,7 @@
|
|
567
567
|
|
568
568
|
//
|
569
569
|
// Get the attribute selector
|
570
|
-
//
|
570
|
+
//
|
571
571
|
@function gridle_selector(
|
572
572
|
$for,
|
573
573
|
$states : null,
|
@@ -594,11 +594,11 @@
|
|
594
594
|
@if $values != null {
|
595
595
|
$sel : append($sel, _gridle_classname($for, $stateName, $values), comma);
|
596
596
|
} @else if index($pattern, '%column') {
|
597
|
-
@each $columnName, $column in
|
597
|
+
@each $columnName, $column in _gridle_get_pattern_values(column) {
|
598
598
|
$sel : append($sel, _gridle_classname($for, $stateName, $columnName), comma);
|
599
599
|
}
|
600
600
|
} @else if index($pattern, '%column-count') {
|
601
|
-
@for $i from 0 through
|
601
|
+
@for $i from 0 through _gridle_get_pattern_values(column-count) {
|
602
602
|
$sel : append($sel, _gridle_classname($for, $stateName, $i), comma);
|
603
603
|
}
|
604
604
|
@if $for == flex-order {
|
@@ -606,24 +606,24 @@
|
|
606
606
|
$sel : append($sel, _gridle_classname($for, $stateName, last), comma);
|
607
607
|
}
|
608
608
|
} @else if index($pattern, '%align') {
|
609
|
-
@each $a in
|
609
|
+
@each $a in _gridle_get_pattern_values(align) {
|
610
610
|
$sel : append($sel, _gridle_classname($for, $stateName, $a), comma);
|
611
611
|
}
|
612
612
|
} @else if index($pattern, '%count') and $for == clear-each {
|
613
|
-
@each $idx, $clearEach in
|
613
|
+
@each $idx, $clearEach in _gridle_get_pattern_values(count) {
|
614
614
|
$count : map-get($clearEach, clearEach);
|
615
615
|
$sel : append($sel, _gridle_classname($for, $stateName, $count), comma);
|
616
616
|
}
|
617
617
|
} @else if index($pattern, '%side') {
|
618
|
-
@each $side in
|
618
|
+
@each $side in _gridle_get_pattern_values(side) {
|
619
619
|
$sel : append($sel, _gridle_classname($for, $stateName, $side), comma);
|
620
620
|
}
|
621
621
|
} @else if index($pattern, '%float') {
|
622
|
-
@each $float in
|
622
|
+
@each $float in _gridle_get_pattern_values(float) {
|
623
623
|
$sel : append($sel, _gridle_classname($for, $stateName, $float), comma);
|
624
624
|
}
|
625
625
|
} @else if index($pattern, '%reverse') {
|
626
|
-
@each $reverse in
|
626
|
+
@each $reverse in _gridle_get_pattern_values(reverse) {
|
627
627
|
$sel : append($sel, _gridle_classname($for, $stateName, $reverse), comma);
|
628
628
|
}
|
629
629
|
} @else {
|
@@ -638,7 +638,7 @@
|
|
638
638
|
//
|
639
639
|
// Generate classname
|
640
640
|
//
|
641
|
-
// @param List $
|
641
|
+
// @param List $pattern The pattern to use to generate classname
|
642
642
|
// @param String $state The state
|
643
643
|
// @param int $count The column count
|
644
644
|
//
|
@@ -692,17 +692,20 @@
|
|
692
692
|
$removeSeparator : true;
|
693
693
|
}
|
694
694
|
}
|
695
|
+
} @else if $var == null {
|
696
|
+
$removeSeparator : true;
|
695
697
|
}
|
698
|
+
|
696
699
|
}
|
697
700
|
|
698
701
|
// clean selector
|
699
702
|
$list: ();
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
703
|
+
@each $var in $pattern {
|
704
|
+
@if $var {
|
705
|
+
$list: append($list, $var);
|
706
|
+
}
|
707
|
+
}
|
708
|
+
$pattern : $list;
|
706
709
|
|
707
710
|
// build selector
|
708
711
|
$sel : "";
|
@@ -723,6 +726,87 @@
|
|
723
726
|
}
|
724
727
|
|
725
728
|
|
729
|
+
//
|
730
|
+
// Unmatched patterns
|
731
|
+
//
|
732
|
+
// @param List $pattern The pattern to use to generate classname
|
733
|
+
// @return Map Map of unmatched pattern index:pattern
|
734
|
+
//
|
735
|
+
@function _gridle_unmatched_patterns(
|
736
|
+
$pattern
|
737
|
+
) {
|
738
|
+
$unmatched : ();
|
739
|
+
|
740
|
+
// Loop each partern
|
741
|
+
@for $i from length($pattern) through 1 {
|
742
|
+
$var : nth($pattern, $i);
|
743
|
+
@if $var and str-index($var, '%') == 1 {
|
744
|
+
$token : str-slice($var, 2);
|
745
|
+
// check that the value is part of the token
|
746
|
+
$tokens : map-get($_gridle-names-tokens, $token);
|
747
|
+
@if $tokens == null {
|
748
|
+
$unmatched : map-set($unmatched, $i, $var);
|
749
|
+
}
|
750
|
+
}
|
751
|
+
}
|
752
|
+
|
753
|
+
@return $unmatched;
|
754
|
+
}
|
755
|
+
|
756
|
+
|
757
|
+
//
|
758
|
+
// matched patterns
|
759
|
+
//
|
760
|
+
// @param List $pattern The pattern to use to generate classname
|
761
|
+
// @return Map Map of matched pattern index:pattern
|
762
|
+
//
|
763
|
+
@function _gridle_matched_patterns(
|
764
|
+
$pattern
|
765
|
+
) {
|
766
|
+
$matched : ();
|
767
|
+
|
768
|
+
// Loop each partern
|
769
|
+
@for $i from length($pattern) through 1 {
|
770
|
+
$var : nth($pattern, $i);
|
771
|
+
@if $var and str-index($var, '%') == 1 {
|
772
|
+
$token : str-slice($var, 2);
|
773
|
+
// check that the value is part of the token
|
774
|
+
$tokens : map-get($_gridle-names-tokens, $token);
|
775
|
+
@if $tokens != null {
|
776
|
+
$matched : map-set($matched, $i, $var);
|
777
|
+
}
|
778
|
+
}
|
779
|
+
}
|
780
|
+
|
781
|
+
@return $matched;
|
782
|
+
}
|
783
|
+
|
784
|
+
|
785
|
+
//
|
786
|
+
// Get dynamic pattern values
|
787
|
+
//
|
788
|
+
// @param String $for Name of the token
|
789
|
+
// @return Mixed Values of the token
|
790
|
+
//
|
791
|
+
@function _gridle_get_pattern_values(
|
792
|
+
$for
|
793
|
+
){
|
794
|
+
@if $for == column {
|
795
|
+
@return gridle_get_columns();
|
796
|
+
}
|
797
|
+
|
798
|
+
@if $for == column-count {
|
799
|
+
@return length(gridle_get_columns());
|
800
|
+
}
|
801
|
+
|
802
|
+
@if $for == count {
|
803
|
+
@return $_gridle_clear_classes;
|
804
|
+
}
|
805
|
+
|
806
|
+
@return map-get($_gridle-names-tokens, $for);
|
807
|
+
}
|
808
|
+
|
809
|
+
|
726
810
|
//
|
727
811
|
// Get the current driver
|
728
812
|
//
|
@@ -817,13 +901,13 @@
|
|
817
901
|
// if we have a separator, check the next value to see if it's a variable
|
818
902
|
@if index($_gridle-names-separators, $part) and $i < length($sel) {
|
819
903
|
@if nth($sel,$i + 1) != '%state' {
|
820
|
-
$generic : #{$generic}#{$part};
|
904
|
+
$generic : #{$generic}#{$part};
|
821
905
|
} @else {
|
822
906
|
$end : true;
|
823
907
|
}
|
824
908
|
} @else {
|
825
909
|
@if str-slice($part,1,1) != '%' {
|
826
|
-
$generic : #{$generic}#{$part};
|
910
|
+
$generic : #{$generic}#{$part};
|
827
911
|
} @else {
|
828
912
|
$end : true;
|
829
913
|
}
|
@@ -835,6 +919,14 @@
|
|
835
919
|
}
|
836
920
|
|
837
921
|
|
922
|
+
//
|
923
|
+
// Check if gridle is in generation phase
|
924
|
+
//
|
925
|
+
@function _gridle_is_in_generate_phase() {
|
926
|
+
@return $_gridle_is_in_generate_phase;
|
927
|
+
}
|
928
|
+
|
929
|
+
|
838
930
|
//
|
839
931
|
// Parse gridle mixin list
|
840
932
|
//
|
@@ -881,7 +973,7 @@
|
|
881
973
|
$prop_name : null;
|
882
974
|
$list : append($list, _gridle-last);
|
883
975
|
@each $param in $list {
|
884
|
-
|
976
|
+
|
885
977
|
@if $param != with and $param != 'and' {
|
886
978
|
@if map-get($_gridle-packages, $param) or $param == _gridle-last {
|
887
979
|
@if $prop_name {
|
@@ -893,7 +985,7 @@
|
|
893
985
|
}
|
894
986
|
$prop_values : ();
|
895
987
|
}
|
896
|
-
$map : map-set($map, $prop_name, $values);
|
988
|
+
$map : map-set($map, $prop_name, $values);
|
897
989
|
}
|
898
990
|
$prop_name : $param;
|
899
991
|
} @else {
|
@@ -901,6 +993,11 @@
|
|
901
993
|
}
|
902
994
|
}
|
903
995
|
}
|
996
|
+
|
997
|
+
// // check if we don't have any gutter parameters
|
998
|
+
// @if not map-get($map, gutter) and not map-get($map, no-gutter) {
|
999
|
+
// $map : map-set($map, gutter, true);
|
1000
|
+
// }
|
904
1001
|
|
905
1002
|
// return the map
|
906
1003
|
@return $map;
|
@@ -938,14 +1035,15 @@
|
|
938
1035
|
$map : map-set($map, $stateName, null);
|
939
1036
|
}
|
940
1037
|
}
|
1038
|
+
|
941
1039
|
@return $map;
|
942
1040
|
}
|
943
1041
|
|
944
1042
|
|
945
1043
|
//
|
946
|
-
// Get the media query for a particular state, or
|
1044
|
+
// Get the media query for a particular state, or width, etc...
|
947
1045
|
//
|
948
|
-
// @param Mixed $state-or-min-width The state name of the min
|
1046
|
+
// @param Mixed $state-or-min-width The state name of the min width
|
949
1047
|
// @param Mixed $max-width The max width if first param is a min width
|
950
1048
|
// @return String The media query string without the @media
|
951
1049
|
//
|
@@ -980,7 +1078,7 @@
|
|
980
1078
|
@if $query
|
981
1079
|
{
|
982
1080
|
@return $query;
|
983
|
-
}
|
1081
|
+
}
|
984
1082
|
@else if $min-width and $max-width
|
985
1083
|
{
|
986
1084
|
@return "screen and (min-width: #{$min-width}) and (max-width: #{$max-width})";
|
@@ -998,9 +1096,9 @@
|
|
998
1096
|
@return null;
|
999
1097
|
}
|
1000
1098
|
|
1001
|
-
}
|
1099
|
+
}
|
1002
1100
|
@else
|
1003
1101
|
{
|
1004
1102
|
@return null;
|
1005
1103
|
}
|
1006
|
-
}
|
1104
|
+
}
|
@@ -13,11 +13,12 @@
|
|
13
13
|
//
|
14
14
|
@mixin gridle_generate_custom_class(
|
15
15
|
$pattern,
|
16
|
-
$statesNames : null
|
16
|
+
$statesNames : null,
|
17
|
+
$replacements...
|
17
18
|
) {
|
18
19
|
// manage states to generate :
|
19
20
|
$states : ();
|
20
|
-
@if $statesNames == null {
|
21
|
+
@if $statesNames == null or $statesNames == all {
|
21
22
|
// loop on each states to generate names list :
|
22
23
|
@each $stateName, $state in $_gridle_states {
|
23
24
|
$states : append($states, $stateName);
|
@@ -26,6 +27,30 @@
|
|
26
27
|
$states : $statesNames;
|
27
28
|
}
|
28
29
|
|
30
|
+
// Get all pattern
|
31
|
+
$unmatched_patterns : _gridle_unmatched_patterns($pattern);
|
32
|
+
$matched_patterns : _gridle_matched_patterns($pattern);
|
33
|
+
|
34
|
+
// Adjust the replacement list length to be the same as unmatched_patterns
|
35
|
+
@while length( $unmatched_patterns ) != length( $replacements ) {
|
36
|
+
@if length( $unmatched_patterns ) < length( $replacements ) {
|
37
|
+
$replacements : list-pop($replacements);
|
38
|
+
}@else{
|
39
|
+
$replacements : append($replacements, (null));
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
43
|
+
// for each valid pattern, get replacement list
|
44
|
+
@each $index, $pattern in $matched_patterns {
|
45
|
+
@if $pattern == "%state" {
|
46
|
+
$matched_patterns : map-remove($matched_patterns, $index);
|
47
|
+
}@else{
|
48
|
+
$replacements : append($replacements, _gridle_get_pattern_values(str-slice($pattern, 2)));
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
$found_patterns : map-merge($unmatched_patterns, $matched_patterns);
|
53
|
+
|
29
54
|
// loop on each states :
|
30
55
|
@each $stateName in $states
|
31
56
|
{
|
@@ -41,8 +66,59 @@
|
|
41
66
|
@if $classes
|
42
67
|
{
|
43
68
|
@include gridle_state($stateName, false) {
|
44
|
-
|
45
|
-
|
69
|
+
$length_a:length($found_patterns);
|
70
|
+
$length_b:length($replacements);
|
71
|
+
@if $length_a > 0 and $length_a <= $length_b {
|
72
|
+
$list_indexes : ();
|
73
|
+
@for $i from 1 through $length_a {
|
74
|
+
$list_indexes : append($list_indexes, 1);
|
75
|
+
}
|
76
|
+
|
77
|
+
@while nth($list_indexes, 1) <= length( nth($replacements, 1) ){
|
78
|
+
$gridle-scope : () !global;
|
79
|
+
$replacement_pattern : $pattern;
|
80
|
+
$replaced_count : 0;
|
81
|
+
|
82
|
+
// Work the replacement
|
83
|
+
@each $index, $flag in $found_patterns {
|
84
|
+
$replaced_count : $replaced_count + 1;
|
85
|
+
|
86
|
+
$current_replacement : nth( $replacements, $replaced_count );
|
87
|
+
$current_index : nth($list_indexes, $replaced_count);
|
88
|
+
|
89
|
+
$replacement_pattern : set-nth( $replacement_pattern, $index, nth( $current_replacement, $current_index ) );
|
90
|
+
|
91
|
+
$var_name : str-slice($flag, 2);
|
92
|
+
|
93
|
+
$gridle-scope : map-set( $gridle-scope, $var_name, nth( $current_replacement, $current_index ) ) !global;
|
94
|
+
}
|
95
|
+
|
96
|
+
#{_gridle_classname($replacement_pattern, $stateName)} {
|
97
|
+
@content;
|
98
|
+
}
|
99
|
+
|
100
|
+
$gridle-scope : () !global;
|
101
|
+
|
102
|
+
// Add 1 to indexes
|
103
|
+
$break : false;
|
104
|
+
$current_iteration_index : length( $list_indexes ); // The last index
|
105
|
+
@while $break == false {
|
106
|
+
$list_indexes : set-nth( $list_indexes, $current_iteration_index, nth( $list_indexes, $current_iteration_index ) + 1 );
|
107
|
+
|
108
|
+
@if nth( $list_indexes, $current_iteration_index ) > length( nth( $replacements, $current_iteration_index ) )
|
109
|
+
and $current_iteration_index != 1 {
|
110
|
+
$list_indexes : set-nth( $list_indexes, $current_iteration_index, 1);
|
111
|
+
|
112
|
+
$current_iteration_index : $current_iteration_index - 1;
|
113
|
+
}@else{
|
114
|
+
$break : true;
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}@else{
|
119
|
+
#{_gridle_classname($pattern, $stateName)} {
|
120
|
+
@content;
|
121
|
+
}
|
46
122
|
}
|
47
123
|
}
|
48
124
|
}
|
@@ -290,11 +366,11 @@
|
|
290
366
|
$statesCount : length($_gridle_states);
|
291
367
|
$i : 0;
|
292
368
|
@each $stateName, $state in $_gridle_states {
|
293
|
-
|
369
|
+
|
294
370
|
$name : $stateName;
|
295
371
|
|
296
372
|
$gridle-settings-states : "#{$gridle-settings-states} \"#{$name}\":{";
|
297
|
-
|
373
|
+
|
298
374
|
@each $varName, $var in $state {
|
299
375
|
|
300
376
|
$value : null;
|
@@ -327,7 +403,7 @@
|
|
327
403
|
} @else {
|
328
404
|
$gridle-settings-states : "#{$gridle-settings-states} },";
|
329
405
|
}
|
330
|
-
|
406
|
+
|
331
407
|
// update i :
|
332
408
|
$i : $i + 1;
|
333
409
|
|
@@ -337,10 +413,10 @@
|
|
337
413
|
$gridle-settings-states : "#{$gridle-settings-states}}";
|
338
414
|
$gridle-settings : "{";
|
339
415
|
$gridle-settings : "#{$gridle-settings} \"version\" : \"#{$_gridle-version}\"";
|
340
|
-
|
416
|
+
|
341
417
|
// states :
|
342
418
|
$gridle-settings : "#{$gridle-settings}, \"states\" : #{$gridle-settings-states}";
|
343
|
-
|
419
|
+
|
344
420
|
// settings :
|
345
421
|
$gridle-settings : "#{$gridle-settings} }";
|
346
422
|
#gridle-settings {
|
@@ -377,7 +453,7 @@ $_gridle_generateOnlyOnce : true; // keep track of generate once classes
|
|
377
453
|
$states : all,
|
378
454
|
$package : all,
|
379
455
|
$has-parent : false
|
380
|
-
) {
|
456
|
+
) {
|
381
457
|
|
382
458
|
// set that we are in generate phase (that can be used anywhere)
|
383
459
|
$_gridle_is_in_generate_phase : true !global;
|
@@ -423,7 +499,7 @@ $_gridle_generateOnlyOnce : true; // keep track of generate once classes
|
|
423
499
|
// | ------------------------
|
424
500
|
// | Windows 8 fix
|
425
501
|
// | ------------------------
|
426
|
-
|
502
|
+
|
427
503
|
// Windows 8 fix for snap mode
|
428
504
|
@media screen and (max-width: 400px) {
|
429
505
|
@-ms-viewport { width: device-width; }
|
@@ -432,7 +508,7 @@ $_gridle_generateOnlyOnce : true; // keep track of generate once classes
|
|
432
508
|
// | ------------------------
|
433
509
|
// | JSON Settings
|
434
510
|
// | ------------------------
|
435
|
-
|
511
|
+
|
436
512
|
// generate json settings
|
437
513
|
@if $gridle-generate-json-settings
|
438
514
|
{
|
@@ -456,7 +532,7 @@ $_gridle_generateOnlyOnce : true; // keep track of generate once classes
|
|
456
532
|
|
457
533
|
// scope all the classes in a media query
|
458
534
|
@include gridle_state($state, false) {
|
459
|
-
|
535
|
+
|
460
536
|
// generate all classes for columns
|
461
537
|
$i : 0;
|
462
538
|
@each $columnName, $column in gridle_get_columns($state) {
|
@@ -496,18 +572,18 @@ $_gridle_generateOnlyOnce : true; // keep track of generate once classes
|
|
496
572
|
@if _gridle_need_to_generate(suffix, $package) {
|
497
573
|
#{_gridle_classname(suffix, $stateName, $columnName)} {
|
498
574
|
@include gridle_suffix($columnsCount, $columnsContext);
|
499
|
-
}
|
575
|
+
}
|
500
576
|
}
|
501
577
|
@if _gridle_need_to_generate(order, $package) {
|
502
578
|
#{_gridle_classname(order, $stateName, first)} {
|
503
579
|
@include gridle_order(-1);
|
504
|
-
}
|
580
|
+
}
|
505
581
|
#{_gridle_classname(order, $stateName, $i)} {
|
506
582
|
@include gridle_order($i);
|
507
|
-
}
|
583
|
+
}
|
508
584
|
#{_gridle_classname(order, $stateName, last)} {
|
509
585
|
@include gridle_order(9999);
|
510
|
-
}
|
586
|
+
}
|
511
587
|
}
|
512
588
|
// up $i
|
513
589
|
$i : $i + 1;
|
@@ -515,7 +591,7 @@ $_gridle_generateOnlyOnce : true; // keep track of generate once classes
|
|
515
591
|
|
516
592
|
// media queries helpers classes
|
517
593
|
@include _gridle_generate_helper_classes($stateName, $package);
|
518
|
-
|
594
|
+
|
519
595
|
// handle direction on body
|
520
596
|
body {
|
521
597
|
direction: gridle_get_state_var(direction);
|
@@ -561,4 +637,4 @@ $_gridle_generateOnlyOnce : true; // keep track of generate once classes
|
|
561
637
|
|
562
638
|
// reset the variable that track if we are in generate phase or not
|
563
639
|
$_gridle_is_in_generate_phase : false !global;
|
564
|
-
}
|
640
|
+
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
// |------------------------------------------------------
|
2
2
|
// |------------------------------------------------------
|
3
3
|
// @created 25.03.13
|
4
|
-
// @updated
|
4
|
+
// @updated 18.04.16
|
5
5
|
// @author Olivier Bossel <olivier.bossel@gmail.com>
|
6
|
-
// @version 2.0.
|
6
|
+
// @version 2.0.45
|
7
7
|
// |------------------------------------------------------
|
8
8
|
// |------------------------------------------------------
|
9
9
|
|
@@ -16,7 +16,7 @@
|
|
16
16
|
// |------------------------------------------------------
|
17
17
|
// |------------------------------------------------------
|
18
18
|
|
19
|
-
$_gridle-version : "2.0.
|
19
|
+
$_gridle-version : "2.0.45";
|
20
20
|
|
21
21
|
|
22
22
|
|
@@ -34,10 +34,11 @@ $_gridle-names-tokens : (
|
|
34
34
|
align : left center right top middle bottom around between,
|
35
35
|
float : left right both,
|
36
36
|
count : true, // will represent a certain count
|
37
|
-
side : top right bottom left,
|
38
|
-
reverse : '' reverse
|
37
|
+
side : top right bottom left null,
|
38
|
+
reverse : '' reverse,
|
39
|
+
state : true // is a valid pattern
|
39
40
|
);
|
40
|
-
$_gridle-names-separators : ('-','--','_','__','@'); // all the allowed separators
|
41
|
+
$_gridle-names-separators : ('-','--','_','__','@'); // all the allowed separators
|
41
42
|
$_gridle_is_in_generate_phase : false; // keep track if we are in generate phase or not anymore
|
42
43
|
$_gridle_inited : false; // keep track if gridle has been inited (silent classes, etc..) or not
|
43
44
|
$_gridle_settings : (); // the default settings
|
@@ -56,6 +57,8 @@ $_content_arg_state : null; // this variable is used to pass state through
|
|
56
57
|
|
57
58
|
$gridle-vendor-prefix : true; // set if need to add vendor prefixes when needed
|
58
59
|
|
60
|
+
$gridle-scope : (); // Variable scope used in mixin like `gridle_generate_custom_class`
|
61
|
+
|
59
62
|
|
60
63
|
|
61
64
|
// |------------------------------------------------------
|
@@ -141,4 +144,4 @@ $gridle-vendor-prefix : true; // set if need to add vendor prefixes when ne
|
|
141
144
|
// |------------------------------------------------------
|
142
145
|
// |------------------------------------------------------
|
143
146
|
|
144
|
-
@import 'default-states';
|
147
|
+
@import 'default-states';
|
@@ -109,7 +109,6 @@
|
|
109
109
|
|
110
110
|
// container
|
111
111
|
@if $package == container {
|
112
|
-
|
113
112
|
@include _gridle_common_container($state);
|
114
113
|
}
|
115
114
|
|
@@ -268,7 +267,7 @@
|
|
268
267
|
// extend and apply css for different states
|
269
268
|
@if $for {
|
270
269
|
@include _gridle_extend($for);
|
271
|
-
@if _gridle_is_in_generate_phase()
|
270
|
+
@if not _gridle_is_in_generate_phase() {
|
272
271
|
@include _gridle_apply_css_for($for);
|
273
272
|
}
|
274
273
|
}
|
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: 2.0.
|
4
|
+
version: 2.0.45
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Olivier Bossel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sass
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.4.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.4.0
|
27
27
|
description: Gridle is a set of complete and simple settings, mixins and classes that
|
28
28
|
make the creation and usage of grid systems (even complex ones) really simple.
|
29
29
|
email:
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
65
65
|
- - '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: 2.0.14
|
68
68
|
requirements: []
|
69
69
|
rubyforge_project: gridle
|
70
70
|
rubygems_version: 2.0.14
|