gridle 1.3.33 → 1.3.35

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: 52aca5b3b3a820e74b1e18b2a201989474353153
4
- data.tar.gz: cbd70f35f49c589ab7bb82bacf11363b8935f163
3
+ metadata.gz: 0c5a36c9fa41af697b19cd1aff401fb5ada19ab8
4
+ data.tar.gz: 96a7e6e48adc58689efa3f0746d7260647a1ee4b
5
5
  SHA512:
6
- metadata.gz: 16b9a12073dc1235ed9827ef4dd151731c52195793155db25a608f947d4318e6b5ba7ea7246db8f41ddc42d7e9d655c4a4f454121b57e5a98066b190142a7ccb
7
- data.tar.gz: 960d12e1ddcf52aaa9b9fa3d42ab4eb0e990adc5b320fde9bc14366c5817b428b80ffcad03ae63ace582ed71e6e43dd6da8d6c707a96d1b20843d0cc470f05dd
6
+ metadata.gz: 9893c0c849a4731d464bca731496e4aee8807e3f9df9eb85f0d83477d6a6d6265bfea30e571d1e67db9af7e3cadc285970a15896c8ad490885b112faa7434cc9
7
+ data.tar.gz: b7d5f9d76fef43c30af08700633fe036411622c309a14d837e7d56e0f017a3ba7c47f5eb8e34d98b6cb76e60623b9ed8af52d655b3afc124af456fa31d9e9c31
@@ -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.3.33"
21
- DATE = "2014-10-06"
20
+ VERSION = "1.3.35"
21
+ DATE = "2015-01-06"
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
  ) {
10
10
  @extend %gridle-simple-clearfix;
11
11
  @extend %gridle-container-common;
12
- // debug part :
12
+ // debug part
13
13
  $debug : _gridle_get_var_value(debug, $state);
14
14
  @if ($debug == true) {
15
15
  #{$gridle-debug-selector} {
@@ -17,31 +17,50 @@
17
17
  }
18
18
  }
19
19
  }
20
+ $_gridle-already-generated : ();
20
21
  @mixin _gridle_grid_common() {
21
22
  @extend %gridle-grid-common;
22
-
23
+
24
+ // default values
25
+ $default-gutter-width : _gridle_get_var_value(gutter-width, default);
26
+ $default-direction : _gridle_get_var_value(direction, default);
27
+
23
28
  // loop on each states :
24
29
  @each $stateName, $state in $_gridle-states
25
30
  {
26
- // vars :
31
+ // selector key to be used in map
32
+ $key : "#{$stateName} #{&}";
33
+
34
+ // check if already generated classes
35
+ $already-generated : map-has-key($_gridle-already-generated, $key);
36
+
37
+ // vars
27
38
  $direction : _gridle_get_var_value(direction, $state);
28
39
  $classes : _gridle_get_var_value(classes, $state);
29
40
  $gutter-width : _gridle_get_var_value(gutter-width, $state);
30
41
  $debug : _gridle_get_var_value(debug, $state);
31
-
32
- @if $classes
42
+
43
+ @if $already-generated != true and $classes and ( ($default-direction != $direction or $default-gutter-width != $gutter-width) or $stateName == default)
33
44
  {
45
+ // set that we have already generated css for this selector
46
+ $_gridle-already-generated : map-set($_gridle-already-generated, $key, true) !global;
47
+
48
+ // generate the css for this element
34
49
  @include gridle_state($state) {
35
- @if $direction == rtl {
36
- float:right;
37
- direction:rtl;
38
- } @else {
39
- float:left;
40
- direction:ltr;
50
+ @if $direction != $default-direction or $stateName == default {
51
+ // content : "#{$key}";
52
+ @if $direction == rtl {
53
+ float:right;
54
+ direction:rtl;
55
+ } @else {
56
+ float:left;
57
+ direction:ltr;
58
+ }
59
+ }
60
+ @if $gutter-width != $default-gutter-width or $stateName == default {
61
+ padding-left:$gutter-width/2;
62
+ padding-right:$gutter-width/2;
41
63
  }
42
-
43
- padding-left:$gutter-width/2;
44
- padding-right:$gutter-width/2;
45
64
  }
46
65
 
47
66
  @if $debug == true {
@@ -4,6 +4,41 @@
4
4
  // |------------------------------------------------------
5
5
  // |------------------------------------------------------
6
6
 
7
+ /**
8
+ * Str replace
9
+ *
10
+ * @param {string} $string String that you want to replace
11
+ * @param {string} $substr String that is to be replaced by `$newsubstr`
12
+ * @param {string} $newsubstr String that replaces `$substr`
13
+ * @param {number*} $all Flag for replaceing all (1+) or not (0)
14
+ * @return {string}
15
+ */
16
+ @function str-replace($string, $substr, $newsubstr, $all: 0) {
17
+ $position-found: str-index($string, $substr);
18
+ $processed: ();
19
+
20
+ @while ($position-found and $position-found > 0) {
21
+ $length-substr: str-length($substr);
22
+ $processed: append($processed, str-slice($string, 0, $position-found - 1));
23
+ $processed: append($processed, $newsubstr);
24
+ $string: str-slice($string, $position-found + $length-substr);
25
+
26
+ $position-found: 0;
27
+
28
+ @if ($all > 0) {
29
+ $position-found: str-index($string, $substr);
30
+ }
31
+ }
32
+
33
+ $processed: append($processed, $string);
34
+ $string: "";
35
+
36
+ @each $s in $processed {
37
+ $string: #{$string}#{$s};
38
+ }
39
+
40
+ @return $string;
41
+ }
7
42
 
8
43
  /**
9
44
  * Map set
@@ -43,14 +78,14 @@
43
78
  @function _gridle_get_state(
44
79
  $stateMap-or-stateName
45
80
  ) {
46
- // check if has a state named like this :
81
+ // check if has a state named like this
47
82
  @if (type-of($stateMap-or-stateName) == string
48
83
  and map-has-key($_gridle_states, unquote($stateMap-or-stateName)))
49
84
  {
50
85
  @return map-get($_gridle_states, unquote($stateMap-or-stateName));
51
86
  }
52
87
 
53
- // nothing finded, so return the default state :
88
+ // a map is passed, so it's a state himself
54
89
  @if $stateMap-or-stateName
55
90
  and type-of($stateMap-or-stateName) == map
56
91
  {
@@ -63,7 +98,7 @@
63
98
  @return map-get($_gridle_states, default);
64
99
  }
65
100
 
66
- // nothing finded, return the default state :
101
+ // nothing finded, return the default state
67
102
  @return $_gridle-settings;
68
103
  }
69
104
 
@@ -29,13 +29,13 @@
29
29
  // |------------------------------------------------------
30
30
  // |------------------------------------------------------
31
31
  // @created 25.03.13
32
- // @updated 06.10.14
32
+ // @updated 06.01.15
33
33
  // @author Olivier Bossel <olivier.bossel@gmail.com>
34
- // @version 1.3.33
34
+ // @version 1.3.34
35
35
  // |------------------------------------------------------
36
36
  // |------------------------------------------------------
37
37
 
38
- $_gridle-version : "1.3.33";
38
+ $_gridle-version : "1.3.34";
39
39
 
40
40
 
41
41
 
@@ -183,34 +183,58 @@
183
183
  // Set the width of the specified grid column :
184
184
  @mixin gridle(
185
185
  $columns,
186
+ $state-or-context : default,
186
187
  $state : default
187
188
  ) {
189
+ // manage state and context :
190
+ $context : null;
191
+ @if type-of($state-or-context) == number {
192
+ $context : $state-or-context;
193
+ } @else {
194
+ $state : $state-or-context;
195
+ }
196
+
188
197
  // common :
189
198
  @include _gridle_grid_common();
190
199
  // check if need media query :
191
200
  @if $state {
192
201
  @include gridle_state($state) {
193
- @include _gridle($columns, $state);
202
+ @include _gridle($columns, $state, $context);
194
203
  }
195
204
  } @else {
196
- @include _gridle($columns, $state);
205
+ @include _gridle($columns, $state, $context);
197
206
  }
198
207
  }
199
208
  @mixin _gridle(
200
209
  $columns,
201
- $state : default
210
+ $state : default,
211
+ $context : null
202
212
  ) {
203
213
  // vars :
204
214
  $name : _gridle_get_var_value(name, $state);
205
- $context : _gridle_get_var_value(context, $state);
215
+ @if type-of($context) != number {
216
+ $context : _gridle_get_var_value(context, $state);
217
+ }
206
218
  $name-multiplicator : _gridle_get_var_value(name-multiplicator, $state);
207
219
  $gutter-width : _gridle_get_var_value(gutter-width, $state);
208
220
  $ie7-support : _gridle_get_var_value(ie7-support, $state);
209
221
  $debug : _gridle_get_var_value(debug, $state);
210
222
  $debug-show-class-names : _gridle_get_var_value(debug-show-class-names, $state);
211
223
 
224
+ // manage columns
225
+ @if type-of($columns) != number and map-has-key($_gridle_columns, $columns) {
226
+ // the columns is a saved one, get the context and column value
227
+ $column : map-get($_gridle_columns, $columns);
228
+ $context : map-get($column, context);
229
+ $columns : map-get($column, columns);
230
+ } @else if type-of($columns) == number {
231
+ $columns : $columns / $name-multiplicator;
232
+ } @else {
233
+ @error "the column #{$columns} does not exist...";
234
+ }
235
+
212
236
  // vars :
213
- $width : percentage(1 / $context * ($columns / $name-multiplicator) );
237
+ $width : percentage(1 / $context * $columns);
214
238
 
215
239
  // set value :
216
240
  width:$width;
@@ -246,27 +270,39 @@
246
270
  // Push the element of the count of column wanted
247
271
  @mixin gridle_push(
248
272
  $columns,
273
+ $state-or-context : default,
249
274
  $state : default
250
275
  ) {
276
+ // manage state and context
277
+ $context : null;
278
+ @if type-of($state-or-context) == number {
279
+ $context : $state-or-context;
280
+ } @else {
281
+ $state : $state-or-context;
282
+ }
283
+
251
284
  // common :
252
285
  @include _gridle_push_common($state);
253
286
 
254
287
  // check if need media query :
255
288
  @if $state {
256
289
  @include gridle_state($state) {
257
- @include _gridle_push($columns,$state);
290
+ @include _gridle_push($columns, $state, $context);
258
291
  }
259
292
  } @else {
260
- @include _gridle_push($columns,$state);
293
+ @include _gridle_push($columns, $state, $context);
261
294
  }
262
295
  }
263
296
  @mixin _gridle_push(
264
297
  $columns,
265
- $state : default
298
+ $state : default,
299
+ $context : null
266
300
  ) {
267
301
  // variables :
268
302
  $name : _gridle_get_var_value(name, $state);
269
- $context : _gridle_get_var_value(context, $state);
303
+ @if type-of($context) != number {
304
+ $context : _gridle_get_var_value(context, $state);
305
+ }
270
306
  $direction : _gridle_get_var_value(direction, $state);
271
307
  $name-multiplicator : _gridle_get_var_value(name-multiplicator, $state);
272
308
  $debug : _gridle_get_var_value(debug, $state);
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.3.33
4
+ version: 1.3.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Olivier Bossel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-06 00:00:00.000000000 Z
11
+ date: 2015-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass