gridle 1.3.36 → 2.0.0

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.
@@ -0,0 +1,445 @@
1
+ //
2
+ // Row
3
+ //
4
+ @mixin _gridle_common_row(
5
+ $state : default
6
+ ) {
7
+ // For modern browser
8
+ &:before,
9
+ &:after {
10
+ content:"";
11
+ display:table;
12
+ }
13
+ &:after {
14
+ clear:both;
15
+ }
16
+ // For IE 6/7 (trigger hasLayout
17
+ & {
18
+ zoom:1;
19
+ }
20
+ }
21
+ @mixin gridle_row(
22
+ $reverse : false
23
+ ) {
24
+ @include _gridle_call(row) {
25
+ padding-left: 0 !important;
26
+ padding-right: 0 !important;
27
+ }
28
+ }
29
+
30
+
31
+ //
32
+ // Col
33
+ //
34
+ @mixin _gridle_common_col(
35
+ $state : default
36
+ ) {
37
+ }
38
+ @mixin gridle_col(
39
+ $reverse : false
40
+ ) {
41
+ @include _gridle_call(col) {
42
+ padding-left: 0 !important;
43
+ padding-right: 0 !important;
44
+ }
45
+ }
46
+
47
+
48
+ //
49
+ // Nowrap
50
+ //
51
+ @mixin _gridle_common_nowrap(
52
+ $state : default
53
+ ) {
54
+ white-space: nowrap;
55
+
56
+ > * {
57
+ white-space: normal;
58
+ }
59
+ }
60
+ @mixin gridle_nowrap() {
61
+ @include _gridle_call(nowrap) {
62
+ }
63
+ }
64
+
65
+
66
+ //
67
+ // Wrap
68
+ //
69
+ @mixin _gridle_common_wrap(
70
+ $state : default
71
+ ) {
72
+ white-space:normal;
73
+ }
74
+ @mixin gridle_wrap() {
75
+ @include _gridle_call(wrap) {
76
+ }
77
+ }
78
+
79
+
80
+ //
81
+ // Grid
82
+ //
83
+ @mixin _gridle_common_grid(
84
+ $state : default
85
+ ) {
86
+ // vars
87
+ $direction : gridle_get_state_var(direction, $state);
88
+
89
+ // css
90
+ display:inline-block;
91
+ min-height:1px;
92
+ @if $direction == rtl {
93
+ float:right;
94
+ // direction:rtl;
95
+ } @else {
96
+ float:left;
97
+ // direction:ltr;
98
+ }
99
+ @include gridle_gutter();
100
+
101
+ }
102
+ @mixin gridle(
103
+ $columns,
104
+ $context : null
105
+ ) {
106
+ @if $columns == grow {
107
+ @include gridle_grid_grow();
108
+ } @else if $columns == adapt {
109
+ @include gridle_grow_adapt();
110
+ } @else {
111
+
112
+ @include _gridle_call(grid) {
113
+
114
+ // vars
115
+ $name : gridle_get_state_var(name);
116
+ @if type-of($context) != number {
117
+ $context : gridle_get_state_var(context);
118
+ }
119
+ $name-multiplicator : gridle_get_state_var(name-multiplicator);
120
+ $gutter-left : gridle_get_state_var(gutter-left);
121
+ $gutter-right : gridle_get_state_var(gutter-right);
122
+
123
+ // manage columns
124
+ @if type-of($columns) != number and map-has-key($_gridle_columns, $columns) {
125
+ // the columns is a saved one, get the context and column value
126
+ $column : map-get($_gridle_columns, $columns);
127
+ $context : map-get($column, context);
128
+ $columns : map-get($column, columns);
129
+ } @else if type-of($columns) == number {
130
+ $columns : $columns / $name-multiplicator;
131
+ } @else {
132
+ @error "the column #{$columns} does not exist...";
133
+ }
134
+
135
+ // width :
136
+ $width : percentage(1 / $context * $columns);
137
+
138
+ // set value :
139
+ width:$width;
140
+
141
+ @if $columns == $context {
142
+ display: inline-block;
143
+ }
144
+ }
145
+ }
146
+ }
147
+ // alias to gridle
148
+ @mixin gridle_grid(
149
+ $columns,
150
+ $context : null
151
+ ) {
152
+ @include gridle($columns, $context);
153
+ }
154
+
155
+
156
+ //
157
+ // Grid table
158
+ //
159
+ @mixin _gridle_common_grid_table(
160
+ $state : default
161
+ ) {
162
+ }
163
+ @mixin gridle_grid_table(
164
+ ) {
165
+ @include _gridle_call(grid-table) {
166
+ display: table-cell;
167
+ float: none;
168
+ vertical-align: top;
169
+ }
170
+ }
171
+
172
+
173
+ //
174
+ // Row full
175
+ //
176
+ @mixin _gridle_common_row_full(
177
+ $state : default
178
+ ) {
179
+ }
180
+ @mixin gridle_row_full(
181
+ ) {
182
+ @include _gridle_call(row-full) {
183
+ $direction : gridle_get_state_var(direction);
184
+ width: 100vw;
185
+ @if $direction == rtl {
186
+ margin-right:50% !important;
187
+ margin-left:0 !important;
188
+ @if $gridle-vendor-prefix {
189
+ -webkit-transform: translateX(50%);
190
+ -moz-transition: translateX(50%);
191
+ -ms-transform: translateX(50%);
192
+ -o-transform: translateX(50%);
193
+ }
194
+ transform: translateX(50%);
195
+ } @else {
196
+ margin-left:50% !important;
197
+ margin-right:0 !important;
198
+ @if $gridle-vendor-prefix {
199
+ -webkit-transform: translateX(-50%);
200
+ -moz-transition: translateX(-50%);
201
+ -ms-transform: translateX(-50%);
202
+ -o-transform: translateX(-50%);
203
+ }
204
+ transform: translateX(-50%);
205
+ }
206
+ }
207
+ }
208
+
209
+
210
+ //
211
+ // grid adapt
212
+ //
213
+ @mixin _gridle_common_grid_adapt(
214
+ $state : default
215
+ ) {
216
+ display: table-cell;
217
+ width:1px;
218
+ white-space:nowrap !important;
219
+ @include gridle_gutter();
220
+ }
221
+ @mixin gridle_grid_adapt(
222
+ ) {
223
+ @include _gridle_call(grid-adapt) {
224
+ }
225
+ }
226
+
227
+
228
+ //
229
+ // Grow
230
+ //
231
+ @mixin _gridle_common_grid_grow(
232
+ $state : default
233
+ ) {
234
+ display: table-cell;
235
+ width:99999px;
236
+ white-space: nowrap;
237
+ @include gridle_gutter();
238
+
239
+ }
240
+ @mixin gridle_grid_grow(
241
+ ) {
242
+ @include _gridle_call(grid-grow) {
243
+ }
244
+ }
245
+
246
+
247
+ //
248
+ // Push
249
+ //
250
+ @mixin _gridle_common_push(
251
+ $state : default
252
+ ) {
253
+ // css
254
+ position:relative;
255
+ }
256
+ @mixin gridle_push(
257
+ $columns,
258
+ $context : null
259
+ ) {
260
+ @include _gridle_call(push) {
261
+ // variables :
262
+ @if type-of($context) != number {
263
+ $context : gridle_get_state_var(context);
264
+ }
265
+ $direction : gridle_get_state_var(direction);
266
+ $name-multiplicator : gridle_get_state_var(name-multiplicator);
267
+
268
+ // vars :
269
+ $width : percentage(1 / $context) * ($columns / $name-multiplicator);
270
+ @if $direction == rtl { $width : $width*-1; }
271
+ left:$width;
272
+ }
273
+ }
274
+
275
+
276
+ //
277
+ // Pull
278
+ //
279
+ @mixin _gridle_common_pull(
280
+ $state : default
281
+ ) {
282
+ // css
283
+ position:relative;
284
+ }
285
+ @mixin gridle_pull(
286
+ $columns,
287
+ $context : null
288
+ ) {
289
+ @include _gridle_call(pull) {
290
+ // variables :
291
+ @if type-of($context) != number {
292
+ $context : gridle_get_state_var(context);
293
+ }
294
+ $direction : gridle_get_state_var(direction);
295
+ $name-multiplicator : gridle_get_state_var(name-multiplicator);
296
+
297
+ // vars :
298
+ $width : percentage(1 / $context) * ($columns / $name-multiplicator);
299
+ @if $direction == rtl { $width : $width*-1; }
300
+ right:$width;
301
+ }
302
+ }
303
+
304
+
305
+ //
306
+ // Prefix
307
+ //
308
+ @mixin _gridle_common_prefix(
309
+ $state : default
310
+ ) {
311
+ }
312
+ @mixin gridle_prefix(
313
+ $columns,
314
+ $context : null
315
+ ) {
316
+ @include _gridle_call(prefix) {
317
+ // vars :
318
+ @if type-of($context) != number {
319
+ $context : gridle_get_state_var(context);
320
+ }
321
+ $direction : gridle_get_state_var(direction);
322
+ $name-multiplicator : gridle_get_state_var(name-multiplicator);
323
+
324
+ // vars :
325
+ $width : percentage(1 / $context) * ($columns / $name-multiplicator);
326
+
327
+ // set value :
328
+ @if $direction == rtl { margin-right:$width; }
329
+ @else { margin-left:$width; }
330
+ }
331
+ }
332
+
333
+
334
+ //
335
+ // Suffix
336
+ //
337
+ @mixin _gridle_common_suffix(
338
+ $state : default
339
+ ) {
340
+ }
341
+ @mixin gridle_suffix(
342
+ $columns,
343
+ $context : null
344
+ ) {
345
+ @include _gridle_call(suffix) {
346
+ // vars :
347
+ @if type-of($context) != number {
348
+ $context : gridle_get_state_var(context);
349
+ }
350
+ $direction : gridle_get_state_var(direction);
351
+ $name-multiplicator : gridle_get_state_var(name-multiplicator);
352
+
353
+ // vars :
354
+ $width : percentage(1 / $context) * ($columns / $name-multiplicator);
355
+
356
+ // set value :
357
+ @if $direction == rtl { margin-left:$width; }
358
+ @else { margin-right:$width; }
359
+ }
360
+ }
361
+
362
+
363
+ //
364
+ // Order
365
+ //
366
+ @mixin _gridle_common_order(
367
+ $state : default
368
+ ) {
369
+ }
370
+ @mixin gridle_order(
371
+ $position
372
+ ) {
373
+ @include _gridle_call(order) {
374
+ }
375
+ }
376
+
377
+
378
+ //
379
+ // Clear each
380
+ //
381
+ @mixin _gridle_common_clear_each(
382
+ $state : default
383
+ ) {
384
+ }
385
+ @mixin gridle_clear_each(
386
+ $clearEach,
387
+ $clearWhat : both
388
+ ) {
389
+ @include _gridle_call(clear-each) {
390
+ > *:nth-child(#{$clearEach}n+1) {
391
+ clear : $clearWhat;
392
+ }
393
+ }
394
+ }
395
+
396
+
397
+ //
398
+ // Align :
399
+ //
400
+ @mixin _gridle_common_row_align(
401
+ $state : default
402
+ ) {
403
+ }
404
+
405
+ @mixin gridle_row_align(
406
+ $align : middle
407
+ ) {
408
+ @include _gridle_call(row-align) {
409
+ // need to change the way grids items are layed out
410
+ @if in-map($align, top) of in-map($align, middle) or in-map($align, bottom) {
411
+ font-size:0;
412
+ clear:both;
413
+
414
+ > * {
415
+ float:none !important;
416
+ vertical-align:$align;
417
+ font-size:1rem;
418
+ }
419
+
420
+ }
421
+
422
+ @each $a in $align {
423
+ @if $align == left {
424
+ text-align: left;
425
+ } @else if $align == center {
426
+ text-align: center;
427
+ } @else if $align == right {
428
+ text-align: right;
429
+ } @else if $align == top {
430
+ vertical-align: top;
431
+ } @else if $align == middle {
432
+ vertical-align: middle;
433
+ } @else if $align == bottom {
434
+ vertical-align: bottom;
435
+ }
436
+ }
437
+
438
+ @if in-map($align, center) or in-map($align, right) {
439
+ // restore text align of the grid items
440
+ > * {
441
+ text-align: left;
442
+ }
443
+ }
444
+ }
445
+ }
@@ -0,0 +1,418 @@
1
+ //
2
+ // Row
3
+ //
4
+ @mixin _gridle_common_row(
5
+ $state : default
6
+ ) {
7
+ @include flexbox;
8
+ @include flex-wrap(wrap);
9
+ @include flex(0 1 auto);
10
+ }
11
+ @mixin gridle_row(
12
+ $reverse : false
13
+ ) {
14
+ @include _gridle_call(row) {
15
+ @if $reverse {
16
+ @include flex-direction(row-reverse);
17
+ } @else {
18
+ @include flex-direction(row);
19
+ }
20
+ padding-left: 0 !important;
21
+ padding-right: 0 !important;
22
+ }
23
+ }
24
+
25
+
26
+ //
27
+ // Col
28
+ //
29
+ @mixin _gridle_common_col(
30
+ $state : default
31
+ ) {
32
+ }
33
+ @mixin gridle_col(
34
+ $reverse : false
35
+ ) {
36
+ @include _gridle_call(col) {
37
+ @if $reverse {
38
+ @include flex-direction(column-reverse);
39
+ } @else {
40
+ @include flex-direction(column);
41
+ }
42
+ padding-left: 0 !important;
43
+ padding-right: 0 !important;
44
+ }
45
+ }
46
+
47
+
48
+ //
49
+ // Nowrap
50
+ //
51
+ @mixin _gridle_common_nowrap(
52
+ $state : default
53
+ ) {
54
+ @include flex-wrap(nowrap);
55
+ white-space:nowrap;
56
+
57
+ > * {
58
+ white-space: normal;
59
+ }
60
+ }
61
+ @mixin gridle_nowrap() {
62
+ @include _gridle_call(nowrap) {
63
+ }
64
+ }
65
+
66
+
67
+ //
68
+ // Wrap
69
+ //
70
+ @mixin _gridle_common_wrap(
71
+ $state : default
72
+ ) {
73
+ @include flex-wrap(wrap);
74
+ white-space:normal;
75
+ }
76
+ @mixin gridle_wrap() {
77
+ @include _gridle_call(wrap) {
78
+ }
79
+ }
80
+
81
+
82
+ //
83
+ // Grid
84
+ //
85
+ @mixin _gridle_common_grid(
86
+ $state : default
87
+ ) {
88
+ // @include flexbox;
89
+ @include flex(0,0,auto);
90
+ @include flex-direction(column); // reset direction for inner elements
91
+ @include gridle_gutter(top right bottom left);
92
+ display: block;
93
+ @include gridle_gutter();
94
+
95
+ }
96
+ @mixin gridle(
97
+ $columns,
98
+ $context : null
99
+ ) {
100
+ @if $columns == grow {
101
+ @include gridle_grid_grow();
102
+ } @else if $columns == adapt {
103
+ @include gridle_grow_adapt();
104
+ } @else {
105
+
106
+ @include _gridle_call(grid) {
107
+
108
+ // vars
109
+ $name : gridle_get_state_var(name);
110
+ @if type-of($context) != number {
111
+ $context : gridle_get_state_var(context);
112
+ }
113
+ $name-multiplicator : gridle_get_state_var(name-multiplicator);
114
+ $gutter-left : gridle_get_state_var(gutter-left);
115
+ $gutter-right : gridle_get_state_var(gutter-right);
116
+
117
+ // manage columns
118
+ @if type-of($columns) != number and map-has-key($_gridle_columns, $columns) {
119
+ // the columns is a saved one, get the context and column value
120
+ $column : map-get($_gridle_columns, $columns);
121
+ $context : map-get($column, context);
122
+ $columns : map-get($column, columns);
123
+ } @else if type-of($columns) == number {
124
+ $columns : $columns / $name-multiplicator;
125
+ } @else {
126
+ @error "the column #{$columns} does not exist...";
127
+ }
128
+
129
+ // width :
130
+ $width : percentage(1 / $context * $columns);
131
+
132
+ // if flex
133
+ @include flex-basis($width);
134
+ max-width : $width;
135
+ }
136
+
137
+ }
138
+ }
139
+ // alias to gridle
140
+ @mixin gridle_grid(
141
+ $columns,
142
+ $context : null
143
+ ) {
144
+ @include gridle($columns, $context);
145
+ }
146
+
147
+
148
+ //
149
+ // Grid table
150
+ //
151
+ @mixin _gridle_common_grid_table(
152
+ $state : default
153
+ ) {
154
+ }
155
+ @mixin gridle_grid_table(
156
+ ) {
157
+ @include _gridle_call(grid-table) {
158
+ }
159
+ }
160
+
161
+
162
+ //
163
+ // Row full
164
+ //
165
+ @mixin _gridle_common_row_full(
166
+ $state : default
167
+ ) {
168
+ }
169
+ @mixin gridle_row_full(
170
+ ) {
171
+ @include _gridle_call(row-full) {
172
+ $direction : gridle_get_state_var(direction);
173
+ width: 100vw;
174
+ @if $direction == rtl {
175
+ margin-right:50% !important;
176
+ margin-left:0 !important;
177
+ @if $gridle-vendor-prefix {
178
+ -webkit-transform: translateX(50%);
179
+ -moz-transition: translateX(50%);
180
+ -ms-transform: translateX(50%);
181
+ -o-transform: translateX(50%);
182
+ }
183
+ transform: translateX(50%);
184
+ } @else {
185
+ margin-left:50% !important;
186
+ margin-right:0 !important;
187
+ @if $gridle-vendor-prefix {
188
+ -webkit-transform: translateX(-50%);
189
+ -moz-transition: translateX(-50%);
190
+ -ms-transform: translateX(-50%);
191
+ -o-transform: translateX(-50%);
192
+ }
193
+ transform: translateX(-50%);
194
+ }
195
+ }
196
+ }
197
+
198
+
199
+ //
200
+ // grid adapt
201
+ //
202
+ @mixin _gridle_common_grid_adapt(
203
+ $state : default
204
+ ) {
205
+ max-width: 100%;
206
+ @include flexbox;
207
+ @include flex(0,1,auto);
208
+ @include flex-direction(column); // reset direction for inner elements
209
+ @include gridle_gutter();
210
+ }
211
+ @mixin gridle_grid_adapt(
212
+ ) {
213
+ @include _gridle_call(grid-adapt) {
214
+ }
215
+ }
216
+
217
+
218
+ //
219
+ // Grow
220
+ //
221
+ @mixin _gridle_common_grid_grow(
222
+ $state : default
223
+ ) {
224
+ max-width: 100%;
225
+ @include flexbox;
226
+ @include flex(1,1,auto);
227
+ @include flex-direction(column); // reset direction for inner elements
228
+ @include gridle_gutter();
229
+
230
+ }
231
+ @mixin gridle_grid_grow(
232
+ ) {
233
+ @include _gridle_call(grid-grow) {
234
+ }
235
+ }
236
+
237
+
238
+ //
239
+ // Push
240
+ //
241
+ @mixin _gridle_common_push(
242
+ $state : default
243
+ ) {
244
+ // css
245
+ position:relative;
246
+ }
247
+ @mixin gridle_push(
248
+ $columns,
249
+ $context : null
250
+ ) {
251
+ @include _gridle_call(push) {
252
+ // variables :
253
+ @if type-of($context) != number {
254
+ $context : gridle_get_state_var(context);
255
+ }
256
+ $direction : gridle_get_state_var(direction);
257
+ $name-multiplicator : gridle_get_state_var(name-multiplicator);
258
+
259
+ // vars :
260
+ $width : percentage(1 / $context) * ($columns / $name-multiplicator);
261
+ @if $direction == rtl { $width : $width*-1; }
262
+ left:$width;
263
+ }
264
+ }
265
+
266
+
267
+ //
268
+ // Pull
269
+ //
270
+ @mixin _gridle_common_pull(
271
+ $state : default
272
+ ) {
273
+ // css
274
+ position:relative;
275
+ }
276
+ @mixin gridle_pull(
277
+ $columns,
278
+ $context : null
279
+ ) {
280
+ @include _gridle_call(pull) {
281
+ // variables :
282
+ @if type-of($context) != number {
283
+ $context : gridle_get_state_var(context);
284
+ }
285
+ $direction : gridle_get_state_var(direction);
286
+ $name-multiplicator : gridle_get_state_var(name-multiplicator);
287
+
288
+ // vars :
289
+ $width : percentage(1 / $context) * ($columns / $name-multiplicator);
290
+ @if $direction == rtl { $width : $width*-1; }
291
+ right:$width;
292
+ }
293
+ }
294
+
295
+
296
+ //
297
+ // Prefix
298
+ //
299
+ @mixin _gridle_common_prefix(
300
+ $state : default
301
+ ) {
302
+ }
303
+ @mixin gridle_prefix(
304
+ $columns,
305
+ $context : null
306
+ ) {
307
+ @include _gridle_call(prefix) {
308
+ // vars :
309
+ @if type-of($context) != number {
310
+ $context : gridle_get_state_var(context);
311
+ }
312
+ $direction : gridle_get_state_var(direction);
313
+ $name-multiplicator : gridle_get_state_var(name-multiplicator);
314
+
315
+ // vars :
316
+ $width : percentage(1 / $context) * ($columns / $name-multiplicator);
317
+
318
+ // set value :
319
+ @if $direction == rtl { margin-right:$width; }
320
+ @else { margin-left:$width; }
321
+ }
322
+ }
323
+
324
+
325
+ //
326
+ // Suffix
327
+ //
328
+ @mixin _gridle_common_suffix(
329
+ $state : default
330
+ ) {
331
+ }
332
+ @mixin gridle_suffix(
333
+ $columns,
334
+ $context : null
335
+ ) {
336
+ @include _gridle_call(suffix) {
337
+ // vars :
338
+ @if type-of($context) != number {
339
+ $context : gridle_get_state_var(context);
340
+ }
341
+ $direction : gridle_get_state_var(direction);
342
+ $name-multiplicator : gridle_get_state_var(name-multiplicator);
343
+
344
+ // vars :
345
+ $width : percentage(1 / $context) * ($columns / $name-multiplicator);
346
+
347
+ // set value :
348
+ @if $direction == rtl { margin-left:$width; }
349
+ @else { margin-right:$width; }
350
+ }
351
+ }
352
+
353
+
354
+ //
355
+ // Order
356
+ //
357
+ @mixin _gridle_common_order(
358
+ $state : default
359
+ ) {
360
+ }
361
+ @mixin gridle_order(
362
+ $position
363
+ ) {
364
+ @include _gridle_call(order) {
365
+ @include order($position);
366
+ }
367
+ }
368
+
369
+
370
+ //
371
+ // Clear each
372
+ //
373
+ @mixin _gridle_common_clear_each(
374
+ $state : default
375
+ ) {
376
+ }
377
+ @mixin gridle_clear_each(
378
+ $clearEach,
379
+ $clearWhat : both
380
+ ) {
381
+ @include _gridle_call(clear-each) {
382
+ }
383
+ }
384
+
385
+
386
+ //
387
+ // Align :
388
+ //
389
+ @mixin _gridle_common_row_align(
390
+ $state : default
391
+ ) {
392
+ }
393
+
394
+ @mixin gridle_row_align(
395
+ $align : middle
396
+ ) {
397
+ @include _gridle_call(row-align) {
398
+ @each $al in $align {
399
+ @if $al == around {
400
+ @include justify-content(space-around);
401
+ } @else if $al == between {
402
+ @include justify-content(space-between);
403
+ } @else if $al == left {
404
+ @include justify-content(flex-start);
405
+ } @else if $al == center {
406
+ @include justify-content(center);
407
+ } @else if $al == right {
408
+ @include justify-content(flex-end);
409
+ } @else if $al == top {
410
+ @include align-items(flex-start);
411
+ } @else if $al == middle {
412
+ @include align-items(center);
413
+ } @else if $al == bottom {
414
+ @include align-items(flex-end);
415
+ }
416
+ }
417
+ }
418
+ }