gridle 1.3.36 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,12 +4,37 @@
4
4
  // |------------------------------------------------------
5
5
  // |------------------------------------------------------
6
6
 
7
- /**
8
- * Setup
9
- */
7
+ //
8
+ // Setup
9
+ //
10
10
  @mixin gridle_setup(
11
11
  $settings : ()
12
12
  ) {
13
+ // manage gutters
14
+ $gutter-top : map-get($settings, gutter-top);
15
+ $gutter-bottom : map-get($settings, gutter-bottom);
16
+ $gutter-left : map-get($settings, gutter-left);
17
+ $gutter-right : map-get($settings, gutter-right);
18
+ $gutter-width : map-get($settings, gutter-width);
19
+ $gutter-height : map-get($settings, gutter-height);
20
+ @if $gutter-right and $gutter-left {
21
+ // calculate the gutter-width
22
+ $settings : map-set($settings, gutter-width, $gutter-left + $gutter-right);
23
+ } @else if $gutter-width {
24
+ // calculate the gutter-left and right
25
+ $settings : map-set($settings, gutter-left, $gutter-width * .5);
26
+ $settings : map-set($settings, gutter-right, $gutter-width * .5);
27
+ }
28
+ @if $gutter-top and $gutter-bottom {
29
+ // calculate the gutter-height
30
+ $settings : map-set($settings, gutter-height, $gutter-bottom + $gutter-top);
31
+ } @else if $gutter-height {
32
+ // calculate the gutter-bottom and top
33
+ $settings : map-set($settings, gutter-bottom, $gutter-height * .5);
34
+ $settings : map-set($settings, gutter-top, $gutter-height * .5);
35
+ }
36
+
37
+ // extend default settings
13
38
  $_gridle-settings : map-merge((
14
39
  name : default,
15
40
  min-width : null,
@@ -18,43 +43,101 @@
18
43
  classes : true,
19
44
  context : 12,
20
45
  gutter-width : 20px,
46
+ gutter-height : 0,
47
+ gutter-top : 0,
48
+ gutter-right : 10px,
49
+ gutter-bottom : 0,
50
+ gutter-left : 10px,
21
51
  direction : ltr,
22
52
  name-multiplicator : 1,
23
- debug : false,
24
- debug-show-class-names : true,
25
- ie7-support : false,
26
- html-states-classes : false,
27
- generate-push-classes : true,
28
- generate-pull-classes : true,
29
- generate-prefix-classes : true,
30
- generate-suffix-classes : true,
31
- generate-helpers-classes : true
53
+ states-classes : false,
54
+ classes-prefix : null
32
55
  ), $settings) !global;
33
56
 
34
57
  // register default state :
35
58
  @include gridle_register_state(default, $_gridle-settings);
36
59
 
60
+ // set current state to default
61
+ $_gridle_current_state : $_gridle-settings !global;
62
+ $_gridle_current_stateName : default !global;
63
+
37
64
  }
38
65
 
39
- // Register an state :
66
+ //
67
+ // Register a state
68
+ //
40
69
  @mixin gridle_register_state(
41
70
  $name,
42
71
  $settings
43
72
  ) {
73
+ // manage gutters
74
+ $gutter-top : map-get($settings, gutter-top);
75
+ $gutter-bottom : map-get($settings, gutter-bottom);
76
+ $gutter-left : map-get($settings, gutter-left);
77
+ $gutter-right : map-get($settings, gutter-right);
78
+ $gutter-width : map-get($settings, gutter-width);
79
+ $gutter-height : map-get($settings, gutter-height);
80
+ @if $gutter-right and $gutter-left {
81
+ // calculate the gutter-width
82
+ $settings : map-set($settings, gutter-width, $gutter-left + $gutter-right);
83
+ } @else if $gutter-width {
84
+ // calculate the gutter-left and right
85
+ $settings : map-set($settings, gutter-left, $gutter-width * .5);
86
+ $settings : map-set($settings, gutter-right, $gutter-width * .5);
87
+ }
88
+ @if $gutter-top and $gutter-bottom {
89
+ // calculate the gutter-height
90
+ $settings : map-set($settings, gutter-height, $gutter-bottom + $gutter-top);
91
+ } @else if $gutter-height {
92
+ // calculate the gutter-bottom and top
93
+ $settings : map-set($settings, gutter-bottom, $gutter-height * .5);
94
+ $settings : map-set($settings, gutter-top, $gutter-height * .5);
95
+ }
96
+
44
97
  // settings :
45
98
  $settings : map-merge($_gridle-settings, $settings);
46
99
 
47
100
  // set name :
48
101
  $settings : map-set($settings, name, $name);
49
102
 
103
+ // gutter sizes :
104
+ $gutter-top : map-get($settings, gutter-top);
105
+ $gutter-right : map-get($settings, gutter-right);
106
+ $gutter-bottom : map-get($settings, gutter-bottom);
107
+ $gutter-left : map-get($settings, gutter-left);
108
+
50
109
  // add state in maps :
51
110
  $_gridle_states : map-set($_gridle_states, $name, $settings) !global;
111
+
112
+ // add rules if gutter is different
113
+ @if $gutter-top != map-get($_gridle-settings, gutter-top)
114
+ or $gutter-right != map-get($_gridle-settings, gutter-right)
115
+ or $gutter-bottom != map-get($_gridle-settings, gutter-bottom)
116
+ or $gutter-left != map-get($_gridle-settings, gutter-left) {
117
+ $gutters : _gridle_forge_gutters_map(top right bottom left, $name);
118
+ @include gridle_apply_css_for(grid grid-grow grid-adapt, (
119
+ gridle_gutter : top right bottom left
120
+ ), $name);
121
+ }
122
+
123
+ // add rules if direction is different
124
+ $direction : map-get($settings, direction);
125
+ @if $direction != map-get($_gridle-settings, direction) {
126
+ $float : left;
127
+ @if $direction == rtl {
128
+ $float : right;
129
+ }
130
+ @include gridle_apply_css_for(grid, (
131
+ direction : $direction,
132
+ float : $float
133
+ ), $name);
134
+ }
52
135
  }
53
136
 
54
137
 
55
- /**
56
- * Register a clear each class
57
- */
138
+ //
139
+ // Register a clear each class
140
+ //
58
141
  @mixin gridle_register_clear_each(
59
142
  $count,
60
143
  $clearWhat
@@ -70,9 +153,9 @@
70
153
  }
71
154
 
72
155
 
73
- /**
74
- * Register a special class
75
- */
156
+ //
157
+ // Register a special class
158
+ //
76
159
  @mixin gridle_register_column(
77
160
  $name,
78
161
  $columns,
@@ -86,9 +169,211 @@
86
169
  }
87
170
 
88
171
 
89
- /**
90
- * Register default states
91
- */
172
+ //
173
+ // Set a classmap
174
+ //
175
+ @mixin gridle_set_classname_map(
176
+ $for,
177
+ $pattern
178
+ ) {
179
+ // get the map
180
+ $map : map-get($_gridle-packages, $for);
181
+ // set the new classname
182
+ $map : map-set($map, classname, $pattern);
183
+ // set the classmap
184
+ $_gridle-packages : map-set($_gridle-packages, $for, $map) !global;
185
+ }
186
+
187
+
188
+ //
189
+ // Extend a gridle class
190
+ //
191
+ // map format :
192
+ // (
193
+ // grid : (
194
+ // mobile : (
195
+ // padding : 10px,
196
+ // float : left
197
+ // ),
198
+ // tablet : (
199
+ // padding : 10px
200
+ // )
201
+ // ),
202
+ // flex-grid : (
203
+ // mobile : (
204
+ // padding : 10px
205
+ // )
206
+ // )
207
+ // )
208
+ //
209
+ // @mixin gridle_extend_base_class(
210
+ // $for,
211
+ // $extend,
212
+ // $statesNames : null
213
+ // ) {
214
+ // // if $states is all
215
+ // @if $statesNames == null {
216
+ // $statesNames : gridle_get_states_names();
217
+ // }
218
+
219
+ // // allow multiple "$for"
220
+ // @each $f in $for {
221
+
222
+ // // get the map for the passed mixin "category"
223
+ // $forMap : map-get($_gridle_extend_base_classes, $f);
224
+
225
+ // // create the map if not exist
226
+ // @if $forMap == null { $forMap : (); }
227
+
228
+ // // loop on each states to register an extend map
229
+ // @each $stateName in $statesNames {
230
+
231
+ // // check if has a map for the state
232
+ // $forStateMap : map-get($forMap, $stateName);
233
+ // @if $forStateMap == null {
234
+ // $forStateMap : ();
235
+ // }
236
+
237
+ // // merge map
238
+ // $forStateMap : map-merge($forStateMap, $extend);
239
+
240
+ // // set the new state map into forMap
241
+ // $forMap : map-set($forMap, $stateName, $forStateMap);
242
+
243
+ // // set the map in the gridle global variable
244
+ // $_gridle_extend_base_classes : map-set($_gridle_extend_base_classes, $f, $forMap) !global;
245
+
246
+ // }
247
+
248
+ // }
249
+ // }
250
+ @mixin gridle_extend_base_class(
251
+ $for,
252
+ $extend,
253
+ $statesNames : null
254
+ ) {
255
+ // if $states is all
256
+ @if $statesNames == null {
257
+ $statesNames : gridle_get_states_names();
258
+ }
259
+
260
+ // allow multiple "$for"
261
+ @each $stateName in $statesNames {
262
+
263
+ // get the map for the passed mixin "category"
264
+ $stateMap : map-get($_gridle_extend_base_classes, $stateName);
265
+
266
+ // create the map if not exist
267
+ @if $stateMap == null { $stateMap : (); }
268
+
269
+ // loop on each states to register an extend map
270
+ @each $f in $for {
271
+
272
+ // check if has a map for the state
273
+ $forStateMap : map-get($stateMap, $f);
274
+ @if $forStateMap == null {
275
+ $forStateMap : ();
276
+ }
277
+
278
+ // merge map
279
+ $forStateMap : map-merge($forStateMap, $extend);
280
+
281
+ // set the new state map into forMap
282
+ $stateMap : map-set($stateMap, $f, $forStateMap);
283
+
284
+ // set the map in the gridle global variable
285
+ $_gridle_extend_base_classes : map-set($_gridle_extend_base_classes, $stateName, $stateMap) !global;
286
+ }
287
+ }
288
+ }
289
+
290
+ //
291
+ // Apply css for
292
+ //
293
+ // map format :
294
+ // (
295
+ // (
296
+ // grid : (
297
+ // mobile : (
298
+ // padding : 0,
299
+ // margin : 0
300
+ // ),
301
+ // tablet : (
302
+ // padding : 0
303
+ // )
304
+ // )
305
+ // ),
306
+ // (
307
+ // etc...
308
+ // )
309
+ // )
310
+ // @mixin gridle_apply_css_for(
311
+ // $for,
312
+ // $extend,
313
+ // $statesNames : null
314
+ // ) {
315
+
316
+ // // if statesNames is null, mean that it's all the states
317
+ // @if $statesNames == null {
318
+ // $statesNames : gridle_get_states_names();
319
+ // }
320
+
321
+ // // allow multiple "$for"
322
+ // @each $f in $for {
323
+
324
+ // // get the map for the passed mixin "category"
325
+ // $stateMap : ();
326
+
327
+ // // loop on each states to register an extend map
328
+ // @each $stateName in $statesNames {
329
+ // // add the css
330
+ // $stateMap : map-set($stateMap, $stateName, $extend);
331
+ // }
332
+
333
+ // // set in map
334
+ // $forMap : map-set((), $f, $stateMap);
335
+
336
+ // // set the map in the gridle global variable
337
+ // $_gridle_apply_css_for : append($_gridle_apply_css_for, $forMap) !global;
338
+
339
+ // }
340
+ // }
341
+ @mixin gridle_apply_css_for(
342
+ $for,
343
+ $extend,
344
+ $statesNames : null
345
+ ) {
346
+
347
+ // if statesNames is null, mean that it's all the states
348
+ @if $statesNames == null {
349
+ $statesNames : gridle_get_states_names();
350
+ }
351
+
352
+ // allow multiple "$for"
353
+ @each $stateName in $statesNames {
354
+
355
+ // get the map for the passed mixin "category"
356
+ $forMap : ();
357
+
358
+ // loop on each states to register an extend map
359
+ @each $f in $for {
360
+ // add the css
361
+ $forMap : map-set($forMap, $f, $extend);
362
+ // $stateMap : map-set($stateMap, $stateName, $extend);
363
+ }
364
+
365
+ // set in map
366
+ $statesMap : map-set((), $stateName, $forMap);
367
+
368
+ // set the map in the gridle global variable
369
+ $_gridle_apply_css_for : append($_gridle_apply_css_for, $statesMap) !global;
370
+ }
371
+ }
372
+
373
+
374
+ //
375
+ // Register default states
376
+ //
92
377
  @mixin gridle_register_default_states() {
93
378
  @include gridle_register_state(mobile, (
94
379
  max-width : 480px
@@ -100,9 +385,9 @@
100
385
  }
101
386
 
102
387
 
103
- /**
104
- * Register default mobile first states :
105
- */
388
+ //
389
+ // Register default mobile first states :
390
+ //
106
391
  @mixin gridle_register_default_mobile_first_states() {
107
392
  @include gridle_register_state(xs, (
108
393
  max-width : 768px
@@ -116,24 +401,4 @@
116
401
  @include gridle_register_state(lg, (
117
402
  min-width : 1200px
118
403
  ));
119
- }
120
-
121
-
122
- /**
123
- * Set the debug device (not used for now)
124
- *
125
- * @param String $state The state to update
126
- * @para m String $device The device to use (iphone, etc...)
127
- */
128
- @mixin gridle_set_debug_device(
129
- $state : default,
130
- $device : null
131
- ) {
132
-
133
- // check params :
134
- @if $state and $device {
135
- // set the state device :
136
- $_gridle_states_debug_devices : append($_gridle_states_debug_devices, unquote("\"#{$state}\" : \"#{$device}\""), comma);
137
- }
138
-
139
404
  }
@@ -6,64 +6,131 @@
6
6
 
7
7
  $gridle-generate-json-settings : true !default;
8
8
 
9
- $gridle-debug-selector : ".gridle-debug &, &.gridle-debug" !default;
10
-
11
- $gridle-class-prefix : '' !default;
12
- $gridle-class-separator : '-' !default;
13
-
14
- $gridle-container-name-pattern : ('container') !default;
15
-
16
- $gridle-grid-name-pattern : ('grid','%-','%state','%-','%count') !default;
17
- $gridle-push-name-pattern : ('push','%-','%state','%-','%count') !default;
18
- $gridle-pull-name-pattern : ('pull','%-','%state','%-','%count') !default;
19
- $gridle-prefix-name-pattern : ('prefix','%-','%state','%-','%count') !default;
20
- $gridle-suffix-name-pattern : ('suffix','%-','%state','%-','%count') !default;
21
-
22
- $gridle-parent-name-pattern : ('parent','%-','%state') !default;
23
- $gridle-centered-name-pattern : ('centered','%-','%state') !default;
24
-
25
- $gridle-vertical-align-middle-name-pattern : ('vertical','%-','align','%-','%state','%-','middle') !default;
26
- $gridle-vertical-align-top-name-pattern : ('vertical','%-','align','%-','%state','%-','top') !default;
27
- $gridle-vertical-align-bottom-name-pattern : ('vertical','%-','align','%-','%state','%-','bottom') !default;
28
-
29
- $gridle-hide-name-pattern : ('hide','%-','%state') !default;
30
- $gridle-show-name-pattern : ('show','%-','%state') !default;
31
- $gridle-show-inline-name-pattern : ('show','%-','inline','%-','%state') !default;
32
- $gridle-not-visible-name-pattern : ('not','%-','visible','%-','%state') !default;
33
- $gridle-visible-name-pattern : ('visible','%-','%state') !default;
34
-
35
- $gridle-float-left-name-pattern : ('float','%-','%state','%-','left') !default;
36
- $gridle-float-right-name-pattern : ('float','%-','%state','%-','right') !default;
37
-
38
- $gridle-clear-name-pattern : ('clear','%-','%state') !default;
39
- $gridle-clear-left-name-pattern : ('clear','%-','%state','%-','left') !default;
40
- $gridle-clear-right-name-pattern : ('clear','%-','%state','%-','right') !default;
41
- $gridle-clear-each-pattern : ('clear','%-','each','%-','%state','%-','%count') !default;
42
-
43
- $gridle-no-gutter-name-pattern : ('no','%-','gutter','%-','%state') !default;
44
- $gridle-no-gutter-left-name-pattern : ('no','%-','gutter','%-','%state','%-','left') !default;
45
- $gridle-no-gutter-right-name-pattern : ('no','%-','gutter','%-','%state','%-','right') !default;
46
- $gridle-no-gutter-top-name-pattern : ('no','%-','gutter','%-','%state','%-','top') !default;
47
- $gridle-no-gutter-bottom-name-pattern : ('no','%-','gutter','%-','%state','%-','bottom') !default;
48
-
49
- $gridle-no-margin-name-pattern : ('no','%-','margin','%-','%state') !default;
50
- $gridle-no-margin-left-name-pattern : ('no','%-','margin','%-','%state','%-','left') !default;
51
- $gridle-no-margin-right-name-pattern : ('no','%-','margin','%-','%state','%-','right') !default;
52
- $gridle-no-margin-top-name-pattern : ('no','%-','margin','%-','%state','%-','top') !default;
53
- $gridle-no-margin-bottom-name-pattern : ('no','%-','margin','%-','%state','%-','bottom') !default;
54
-
55
- $gridle-gutter-name-pattern : ('gutter','%-','%state') !default;
56
- $gridle-gutter-left-name-pattern : ('gutter','%-','%state','%-','left') !default;
57
- $gridle-gutter-right-name-pattern : ('gutter','%-','%state','%-','right') !default;
58
- $gridle-gutter-top-name-pattern : ('gutter','%-','%state','%-','top') !default;
59
- $gridle-gutter-bottom-name-pattern : ('gutter','%-','%state','%-','bottom') !default;
60
-
61
- $gridle-margin-name-pattern : ('margins','%-','%state') !default;
62
- $gridle-margin-left-name-pattern : ('margin','%-','%state','%-','left') !default;
63
- $gridle-margin-right-name-pattern : ('margin','%-','%state','%-','right') !default;
64
- $gridle-margin-top-name-pattern : ('margin','%-','%state','%-','top') !default;
65
- $gridle-margin-bottom-name-pattern : ('margin','%-','%state','%-','bottom') !default;
66
-
67
- $gridle-auto-height-name-pattern : ('auto','%-','height','%-','%state') !default;
68
-
69
- $gridle-debug-color-name-pattern : ('debug','%-','color','%-','%state','%-','%count') !default;
9
+ $_gridle-names-separators : ('-','--','_','__','@');
10
+ $_gridle-names-tokens : (
11
+ column : true, // will be the columns names
12
+ column-count : true, // will represent the column index (1,2,3,...)
13
+ align : left center right top middle bottom around between,
14
+ float : left right both,
15
+ count : true, // will represent a certain count
16
+ side : top right bottom left,
17
+ reverse : '' reverse
18
+ );
19
+ $_gridle-packages : (
20
+ container : (
21
+ classname : ('container','@','%state'),
22
+ package : default container
23
+ ),
24
+ row : (
25
+ classname : ('row','-','%reverse','@','%state'),
26
+ package : default row
27
+ ),
28
+ row-align : (
29
+ classname : ('row','-','align','-','%align','@','%state'),
30
+ package : default row-align
31
+ ),
32
+ row-full : (
33
+ classname : ('row','-','full','@','%state'),
34
+ package : default row-full
35
+ ),
36
+ row-debug : (
37
+ classname : ('row','-','debug','@','%state'),
38
+ package : debug row-debug
39
+ ),
40
+ nowrap : (
41
+ classname : ('nowrap','@','%state'),
42
+ package : default nowrap
43
+ ),
44
+ wrap : (
45
+ classname : ('wrap','@','%state'),
46
+ package : default wrap
47
+ ),
48
+ col : (
49
+ classname : ('col','-','%reverse','@','%state'),
50
+ package : default col
51
+ ),
52
+ grid : (
53
+ classname : ('gr','-','%column','@','%state'),
54
+ package : default grid
55
+ ),
56
+ grid-table : (
57
+ classname : ('gr','-','table','@','%state'),
58
+ package : default grid-table
59
+ ),
60
+ grid-adapt : (
61
+ classname : ('gr','-','adapt','@','%state'),
62
+ package : default grid-adapt
63
+ ),
64
+ grid-grow : (
65
+ classname : ('gr','-','grow','@','%state'),
66
+ package : default grid-grow
67
+ ),
68
+ grid-centered : (
69
+ classname : ('gr','-','centered','@','%state'),
70
+ package : default grid-centered
71
+ ),
72
+ push : (
73
+ classname : ('push','-','%column','@','%state'),
74
+ package : default push
75
+ ),
76
+ pull : (
77
+ classname : ('pull','-','%column','@','%state'),
78
+ package : default pull
79
+ ),
80
+ prefix : (
81
+ classname : ('prefix','-','%column','@','%state'),
82
+ package : default prefix
83
+ ),
84
+ suffix : (
85
+ classname : ('suffix','-','%column','@','%state'),
86
+ package : default suffix
87
+ ),
88
+ hide : (
89
+ classname : ('hide','@','%state'),
90
+ package : helpers hide
91
+ ),
92
+ show : (
93
+ classname : ('show','@','%state'),
94
+ package : helpers show
95
+ ),
96
+ show-inline : (
97
+ classname : ('show','-','inline','@','%state'),
98
+ package : helpers show-inline
99
+ ),
100
+ not-visible : (
101
+ classname : ('not','-','visible','@','%state'),
102
+ package : helpers not-visible
103
+ ),
104
+ visible : (
105
+ classname : ('visible','@','%state'),
106
+ package : helpers visible
107
+ ),
108
+ float : (
109
+ classname : ('float','-','%float','@','%state'),
110
+ package : helpers float
111
+ ),
112
+ clear : (
113
+ classname : ('clear','-','%float','@','%state'),
114
+ package : helpers clear
115
+ ),
116
+ clear-each : (
117
+ classname : ('clear','-','each','-','%count','@','%state'),
118
+ package : helpers clear-each
119
+ ),
120
+ gutter : (
121
+ classname : ('gutter','-','%side','@','%state'),
122
+ package : helpers gutter
123
+ ),
124
+ no-gutter : (
125
+ classname : ('no','-','gutter','-','%side','@','%state'),
126
+ package : helpers no-gutter
127
+ ),
128
+ auto-height : (
129
+ classname : ('auto','-','height','@','%state'),
130
+ package : helpers auto-height
131
+ ),
132
+ order : (
133
+ classname : ('order','-','%column-count','@','%state'),
134
+ package : helpers order
135
+ )
136
+ );