gerillass 1.6.2 → 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.
Files changed (71) hide show
  1. package/README.md +20 -4
  2. package/SKILL.md +30 -32
  3. package/gerillass.json +188 -196
  4. package/package.json +2 -12
  5. package/scss/_gerillass.scss +8 -92
  6. package/scss/library/_adaptive.scss +4 -1
  7. package/scss/library/_after.scss +5 -2
  8. package/scss/library/_all-buttons.scss +6 -2
  9. package/scss/library/_all-text-inputs.scss +6 -2
  10. package/scss/library/_aspect-ratio.scss +27 -0
  11. package/scss/library/_background-dots.scss +12 -7
  12. package/scss/library/_background-image.scss +18 -11
  13. package/scss/library/_background-stripes.scss +14 -9
  14. package/scss/library/_before.scss +5 -2
  15. package/scss/library/_border-radius.scss +19 -15
  16. package/scss/library/_brand-logo.scss +3 -1
  17. package/scss/library/_breakpoint.scss +25 -20
  18. package/scss/library/_breakpointer.scss +4 -1
  19. package/scss/library/_center.scss +3 -1
  20. package/scss/library/_columnizer.scss +18 -13
  21. package/scss/library/_counter.scss +21 -18
  22. package/scss/library/_escape-to-parent.scss +3 -1
  23. package/scss/library/_except.scss +12 -8
  24. package/scss/library/_font-face.scss +17 -12
  25. package/scss/library/_index.scss +52 -0
  26. package/scss/library/_linear-gradient.scss +13 -7
  27. package/scss/library/_loadify.scss +15 -11
  28. package/scss/library/_only.scss +12 -8
  29. package/scss/library/_position.scss +10 -6
  30. package/scss/library/_radial-gradient.scss +15 -9
  31. package/scss/library/_remove.scss +17 -14
  32. package/scss/library/_reset-figure.scss +3 -1
  33. package/scss/library/_scissors.scss +24 -21
  34. package/scss/library/_smartphone.scss +10 -6
  35. package/scss/library/_sprite.scss +16 -12
  36. package/scss/library/_stretched-link.scss +3 -1
  37. package/scss/library/_tablet.scss +10 -6
  38. package/scss/library/_text-gradient.scss +13 -7
  39. package/scss/library/_text-shadow.scss +46 -40
  40. package/scss/library/_triangle.scss +15 -10
  41. package/scss/lists/_index.scss +8 -0
  42. package/scss/maps/_index.scss +8 -0
  43. package/scss/utilities/_clear-unit.scss +3 -1
  44. package/scss/utilities/_clear-whitespace.scss +9 -6
  45. package/scss/utilities/_convert-to-em.scss +5 -2
  46. package/scss/utilities/_convert-to-number.scss +10 -6
  47. package/scss/utilities/_fill-nulls.scss +18 -0
  48. package/scss/utilities/_font-sizer.scss +1 -1
  49. package/scss/utilities/_font-source.scss +15 -10
  50. package/scss/utilities/_index.scss +24 -0
  51. package/scss/utilities/_is-color.scss +8 -5
  52. package/scss/utilities/_is-gutter.scss +8 -5
  53. package/scss/utilities/_is-number.scss +4 -2
  54. package/scss/utilities/_is-time.scss +8 -3
  55. package/scss/utilities/_map-deep-get.scss +4 -2
  56. package/scss/utilities/_pixelify.scss +11 -7
  57. package/scss/utilities/_pseudo-selector.scss +4 -2
  58. package/scss/utilities/_remify.scss +3 -1
  59. package/scss/utilities/_shade.scss +10 -0
  60. package/scss/utilities/_shorthand-property.scss +13 -11
  61. package/scss/utilities/_tint.scss +10 -0
  62. package/scss/utilities/_validate-breakpoint.scss +9 -5
  63. package/scss/utilities/_validate-length.scss +10 -5
  64. package/scss/utilities/_validate-ratio.scss +27 -15
  65. package/scss/utilities/_validate-scissors.scss +16 -11
  66. package/scss/_gerillass-prefix.scss +0 -1586
  67. package/scss/library/_ratio-box.scss +0 -19
  68. package/scss/library/_responsive-video.scss +0 -19
  69. package/scss/utilities/_darken.scss +0 -7
  70. package/scss/utilities/_lighten.scss +0 -7
  71. package/scss/utilities/_null.scss +0 -16
@@ -1,1586 +0,0 @@
1
- @charset "UTF-8";
2
- @use "sass:math";
3
-
4
- @mixin gls-adaptive($gutter: 30px) {
5
- $actual-breakpoints: map-remove($map-for-breakpoints, "xsmall");
6
- margin: 0 auto;
7
- @each $item, $value in $actual-breakpoints {
8
- @media (min-width: #{$value}) {
9
- max-width: calc(#{$value} - (#{$gutter} * 2));
10
- }
11
- }
12
- }
13
-
14
-
15
-
16
- @mixin gls-after($content: null) {
17
- &::after {
18
- @if $content == null {
19
- @content;
20
- } @else if type-of($content) != "string" {
21
- @error "`#{$content}` is not a valid $content for `after`. Pass a string to use as the content value, a data- attribute name such as `\"data-label\"` to render it with attr(), or no argument at all and write the content yourself.";
22
- } @else {
23
- $data: str-slice($content, 1, 5);
24
- @if $data == "data-" {
25
- content: attr(#{$content});
26
- @content;
27
- } @else {
28
- content: "#{$content}";
29
- @content;
30
- }
31
- }
32
- }
33
- }
34
-
35
-
36
- @mixin gls-all-buttons($pseudo: null) {
37
- $list: "hover", "focus", "active", "disabled";
38
- @if not $pseudo {
39
- #{$list-of-buttons} {
40
- @content;
41
- }
42
- } @else if index($list, $pseudo) {
43
- $all-buttons: __pseudoSelector($list-of-buttons, $pseudo);
44
- #{$all-buttons} {
45
- @content;
46
- }
47
- } @else {
48
- @error "The argument must be `null` or one of the followings: #{$list}.";
49
- }
50
- }
51
-
52
-
53
- @mixin gls-all-text-inputs($pseudo: null) {
54
- $list: "hover", "focus", "active", "invalid", "required", "disabled";
55
- @if not $pseudo {
56
- #{$list-of-text-inputs} {
57
- @content;
58
- }
59
- } @else if index($list, $pseudo) {
60
- $all-text-inputs: __pseudoSelector($list-of-text-inputs, $pseudo);
61
- #{$all-text-inputs} {
62
- @content;
63
- }
64
- } @else {
65
- @error "The argument must be `null` or one of the followings: #{$list}";
66
- }
67
- }
68
-
69
-
70
-
71
- @mixin gls-antialias($value: null) {
72
- @if not & and $value == null {
73
- *,
74
- *::before,
75
- *::after {
76
- -webkit-font-smoothing: antialiased;
77
- -moz-osx-font-smoothing: grayscale;
78
- }
79
- } @else if & and $value == "only" {
80
- &,
81
- &::before,
82
- &::after {
83
- -webkit-font-smoothing: antialiased;
84
- -moz-osx-font-smoothing: grayscale;
85
- }
86
- } @else if & and $value == null {
87
- &,
88
- &::before,
89
- &::after,
90
- *,
91
- *::before,
92
- *::after {
93
- -webkit-font-smoothing: antialiased;
94
- -moz-osx-font-smoothing: grayscale;
95
- }
96
- } @else if not & and $value == "only" {
97
- @error "`only` has no meaning at the root of a stylesheet, because there is no selector to limit the effect to. Call `antialias(\"only\")` inside a selector, or pass no argument at all.";
98
- } @else {
99
- @error "`#{$value}` is not a valid argument for `antialias`. Pass `\"only\"` inside a selector to affect just that element, or pass no argument at all.";
100
- }
101
- }
102
-
103
-
104
-
105
- @mixin gls-background-dots(
106
- $color: null,
107
- $size: 1em,
108
- $gutter: $size * 5,
109
- $diagonal: true,
110
- $image: null
111
- ) {
112
- @if $image != null and type-of($image) != "string" {
113
- @error "`#{$image}` is not a valid $image for `background-dots`. Pass an image path as a string.";
114
- }
115
- @if $diagonal != true and $diagonal != false {
116
- @error "`#{$diagonal}` is not a valid $diagonal for `background-dots`. Pass `true` or `false`.";
117
- }
118
- @if not $color {
119
- $color: rgba(0, 0, 0, 0.1);
120
- @if $diagonal == true {
121
- background-image: radial-gradient($color $size, transparent 0),
122
- radial-gradient($color $size, transparent 0);
123
- background-position: math.div($gutter, 2) math.div($gutter, 2),
124
- ($gutter * 2) ($gutter * 2);
125
- } @else if $diagonal == false {
126
- background-image: radial-gradient($color $size, transparent 0);
127
- background-position: math.div($gutter, 2) math.div($gutter, 2);
128
- }
129
- } @else if $color {
130
- @if $diagonal == true {
131
- background-image: radial-gradient(nth($color, 1) $size, transparent 0),
132
- radial-gradient(nth($color, length($color)) $size, transparent 0);
133
- background-position: math.div($gutter, 2) math.div($gutter, 2),
134
- ($gutter * 2) ($gutter * 2);
135
- } @else if $diagonal == false {
136
- background-image: radial-gradient(nth($color, 1) $size, transparent 0);
137
- background-position: math.div($gutter, 2) math.div($gutter, 2);
138
- @if length($color) > 1 {
139
- @error "Please do not pass more than one argument when you disable 'diagonal' property! Simply remove the argument(s) after '#{nth($color, 1)}' to resolve the problem.";
140
- }
141
- }
142
- }
143
- background-size: $gutter $gutter;
144
- background-repeat: repeat;
145
- @if $image {
146
- position: relative;
147
- &::before {
148
- content: "";
149
- display: block;
150
- position: absolute;
151
- width: 100%;
152
- height: 100%;
153
- top: 0;
154
- left: 0;
155
- background-image: url(unquote($image));
156
- background-repeat: no-repeat;
157
- background-position: center;
158
- background-size: cover;
159
- z-index: -1;
160
- }
161
- }
162
- }
163
-
164
-
165
-
166
- @mixin gls-background-image(
167
- $image-url: null,
168
- $filter-color: null,
169
- $filter-direction: null
170
- ) {
171
- @if $image-url {
172
- @if $filter-color {
173
- @if length($filter-color) == 1 {
174
- background-image: linear-gradient(to top, $filter-color, $filter-color),
175
- url($image-url);
176
- } @else if length($filter-color) > 1 {
177
- $color-list: ();
178
- @for $i from 1 through length($filter-color) {
179
- $color-list: append($color-list, nth($filter-color, $i), comma);
180
- }
181
- @if $filter-direction {
182
- @if map-has-key($map-for-directions, $filter-direction) {
183
- background-image: linear-gradient(
184
- map-get($map-for-directions, $filter-direction),
185
- $color-list
186
- ),
187
- url($image-url);
188
- } @else {
189
- @if type-of($filter-direction) == "number" and index("deg", unit($filter-direction)) {
190
- background-image: linear-gradient($filter-direction, $color-list),
191
- url($image-url);
192
- } @else {
193
- @error "`#{$filter-direction}` is not a valid $filter-direction. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
194
- }
195
- }
196
- } @else {
197
- background-image: linear-gradient(to top, $color-list),
198
- url($image-url);
199
- }
200
- }
201
- } @else {
202
- background-image: url($image-url);
203
- }
204
- } @else {
205
- position: relative;
206
- &::after {
207
- content: "";
208
- display: block;
209
- position: absolute;
210
- left: 0;
211
- top: 0;
212
- width: 100%;
213
- height: 100%;
214
- @if length($filter-color) == 1 {
215
- background: $filter-color;
216
- } @else if length($filter-color) > 1 {
217
- @include gls-linear-gradient(
218
- if(not $filter-direction, "top", $filter-direction),
219
- $filter-color
220
- );
221
- }
222
- }
223
- & > * {
224
- position: relative;
225
- z-index: 1;
226
- }
227
- }
228
- background-position: center center;
229
- background-repeat: no-repeat;
230
- background-size: cover;
231
- }
232
-
233
-
234
-
235
- @mixin gls-background-stripes(
236
- $color: null,
237
- $thickness: 1em,
238
- $rotation: -45deg,
239
- $image: null
240
- ) {
241
- @if type-of($rotation) != "number" {
242
- @error "`#{$rotation}` is not a valid $rotation for `background-stripes`. Pass an angle such as `-45deg`, or a unitless number which is treated as degrees.";
243
- }
244
- @if $image != null and type-of($image) != "string" {
245
- @error "`#{$image}` is not a valid $image for `background-stripes`. Pass an image path as a string.";
246
- }
247
- $validate-unit: if(not index("deg", unit($rotation)), $rotation + deg, $rotation);
248
- $get-image: if($image, unquote(", ") + url(unquote($image)), unquote(""));
249
- @if not $color {
250
- $color: rgba(0, 0, 0, 0.1);
251
- background-image: repeating-linear-gradient(
252
- $validate-unit,
253
- $color 0,
254
- $color $thickness,
255
- transparent $thickness,
256
- transparent $thickness * 2
257
- ) + $get-image;
258
- @if $image {
259
- background-position: center;
260
- background-repeat: no-repeat;
261
- background-size: cover;
262
- }
263
- } @else if length($color) == 1 {
264
- background-image: repeating-linear-gradient(
265
- $validate-unit,
266
- $color 0,
267
- $color $thickness,
268
- transparent $thickness,
269
- transparent $thickness * 2
270
- ) + $get-image;
271
- @if $image {
272
- background-position: center;
273
- background-repeat: no-repeat;
274
- background-size: cover;
275
- }
276
- } @else if length($color) > 1 {
277
- $list: ();
278
- @for $i from 1 through length($color) {
279
- $index-color: nth($color, $i);
280
- $style-rule: $index-color ($thickness * $i) - $thickness, $index-color $thickness * $i;
281
- $list: append($list, $style-rule, comma);
282
- }
283
- background-image: repeating-linear-gradient($validate-unit, $list) + $get-image;
284
- @if $image {
285
- background-position: center;
286
- background-repeat: no-repeat;
287
- background-size: cover;
288
- }
289
- }
290
- }
291
-
292
-
293
-
294
- @mixin gls-before($content: null) {
295
- &::before {
296
- @if $content == null {
297
- @content;
298
- } @else if type-of($content) != "string" {
299
- @error "`#{$content}` is not a valid $content for `before`. Pass a string to use as the content value, a data- attribute name such as `\"data-label\"` to render it with attr(), or no argument at all and write the content yourself.";
300
- } @else {
301
- $data: str-slice($content, 1, 5);
302
- @if $data == "data-" {
303
- content: attr(#{$content});
304
- @content;
305
- } @else {
306
- content: "#{$content}";
307
- @content;
308
- }
309
- }
310
- }
311
- }
312
-
313
-
314
-
315
- @mixin gls-border-box($value: null) {
316
- @if not & and $value == null {
317
- *,
318
- *::before,
319
- *::after {
320
- box-sizing: border-box;
321
- }
322
- } @else if & and $value == "only" {
323
- &,
324
- &::before,
325
- &::after {
326
- box-sizing: border-box;
327
- }
328
- } @else if & and $value == null {
329
- &,
330
- &::before,
331
- &::after,
332
- *,
333
- *::before,
334
- *::after {
335
- box-sizing: border-box;
336
- }
337
- } @else if not & and $value == "only" {
338
- @error "`only` has no meaning at the root of a stylesheet, because there is no selector to limit the effect to. Call `border-box(\"only\")` inside a selector, or pass no argument at all.";
339
- } @else {
340
- @error "`#{$value}` is not a valid argument for `border-box`. Pass `\"only\"` inside a selector to affect just that element, or pass no argument at all.";
341
- }
342
- }
343
-
344
-
345
-
346
- @mixin gls-border-radius($args...) {
347
- $list: join($list-of-directions, ("cross-left", "cross-right", "all"));
348
- @if length($args) == 1 {
349
- $value: nth($args, 1);
350
- border-radius: __null($value, space);
351
- } @else if length($args) == 2 {
352
- $corner: nth($args, 1);
353
- $value: nth($args, 2);
354
- @if index($list, $corner) {
355
- @if $corner == "top" {
356
- border-top-left-radius: $value;
357
- border-top-right-radius: $value;
358
- } @else if $corner == "top-right" {
359
- border-top-right-radius: $value;
360
- } @else if $corner == "right" {
361
- border-top-right-radius: $value;
362
- border-bottom-right-radius: $value;
363
- } @else if $corner == "bottom-right" {
364
- border-bottom-right-radius: $value;
365
- } @else if $corner == "bottom" {
366
- border-bottom-left-radius: $value;
367
- border-bottom-right-radius: $value;
368
- } @else if $corner == "bottom-left" {
369
- border-bottom-left-radius: $value;
370
- } @else if $corner == "left" {
371
- border-top-left-radius: $value;
372
- border-bottom-left-radius: $value;
373
- } @else if $corner == "top-left" {
374
- border-top-left-radius: $value;
375
- } @else if $corner == "all" {
376
- border-radius: $value;
377
- } @else if $corner == "cross-left" {
378
- border-top-left-radius: $value;
379
- border-bottom-right-radius: $value;
380
- } @else if $corner == "cross-right" {
381
- border-top-right-radius: $value;
382
- border-bottom-left-radius: $value;
383
- }
384
- } @else {
385
- @error "Corner value must be one of the followings: #{$list}.";
386
- }
387
- } @else if length($args) == 4 {
388
- $args: __null($args, space, true);
389
- border-top-left-radius: nth($args, 1);
390
- border-top-right-radius: nth($args, 2);
391
- border-bottom-right-radius: nth($args, 3);
392
- border-bottom-left-radius: nth($args, 4);
393
- } @else {
394
- @error "`border-radius` takes 1, 2 or 4 arguments; you passed #{length($args)}. Use one radius for every corner, a corner name plus a radius, or four radii in top-left, top-right, bottom-right, bottom-left order.";
395
- }
396
- }
397
-
398
-
399
-
400
- @mixin gls-brand-logo($width, $height, $image-url: null) {
401
- display: inline-block;
402
- position: relative;
403
- width: $width;
404
- height: $height;
405
- @if $image-url {
406
- background-image: url($image-url);
407
- }
408
- background-position: center;
409
- background-repeat: no-repeat;
410
- background-size: 100%;
411
- a {
412
- display: block;
413
- width: 1px;
414
- height: 1px;
415
- overflow: hidden;
416
- text-indent: 100%;
417
- @include gls-stretched-link(after);
418
- }
419
- }
420
-
421
-
422
-
423
- @mixin gls-breakpoint($params...) {
424
- @if length($params) == 1 {
425
- $value: nth($params, 1);
426
- @if map-has-key($map-for-breakpoints, $value) {
427
- @media (width: map-get($map-for-breakpoints, $value)) {
428
- @content;
429
- }
430
- } @else {
431
- @media (width: $value) {
432
- @content;
433
- }
434
- }
435
- } @else if length($params) == 2 {
436
- @if not index("only" "min" "max" "between", nth($params, 1)) {
437
- $start: nth($params, 1);
438
- $end: nth($params, 2);
439
- @media (min-width: #{__validateBreakpoint($start)}) and (max-width: #{if(map-has-key($map-for-breakpoints, $end), __validateBreakpoint($end) - 1, $end)}) {
440
- @content;
441
- }
442
- } @else {
443
- $mode: nth($params, 1);
444
- $value: nth($params, 2);
445
- @if $mode == "only" {
446
- @if map-has-key($map-for-breakpoints, $value) {
447
- @media (width: map-get($map-for-breakpoints, $value)) {
448
- @content;
449
- }
450
- } @else {
451
- @media (width: $value) {
452
- @content;
453
- }
454
- }
455
- } @else if $mode == "min" {
456
- @if map-has-key($map-for-breakpoints, $value) {
457
- @media (min-width: map-get($map-for-breakpoints, $value)) {
458
- @content;
459
- }
460
- } @else {
461
- @media (min-width: $value) {
462
- @content;
463
- }
464
- }
465
- } @else if $mode == "max" {
466
- @if map-has-key($map-for-breakpoints, $value) {
467
- @media (max-width: map-get($map-for-breakpoints, $value)) {
468
- @content;
469
- }
470
- } @else {
471
- @media (max-width: $value) {
472
- @content;
473
- }
474
- }
475
- } @else if $mode == "between" {
476
- $start: nth($value, 1);
477
- $end: nth($value, 2);
478
- @media (min-width: #{__validateBreakpoint($start)}) and (max-width: #{if(map-has-key($map-for-breakpoints, $end), __validateBreakpoint($end) - 1, $end)}) {
479
- @content;
480
- }
481
- }
482
- }
483
- }
484
- }
485
-
486
-
487
-
488
- @mixin gls-breakpointer($selector: null) {
489
- @if $selector != null and type-of($selector) != "string" {
490
- @error "`#{$selector}` is not a valid $selector for `breakpointer`. Pass a selector as a string, such as `\".debug\"`, or no argument at all to attach it to body.";
491
- }
492
- @if & {
493
- &::before {
494
- @content;
495
- @each $key, $value in $map-for-breakpoints {
496
- @media (min-width: #{$value}) {
497
- content: "#{$key}";
498
- }
499
- }
500
- }
501
- } @else {
502
- @if $selector {
503
- #{$selector}::before {
504
- @content;
505
- @each $key, $value in $map-for-breakpoints {
506
- @media (min-width: #{$value}) {
507
- content: "#{$key}";
508
- }
509
- }
510
- }
511
- } @else {
512
- body::before {
513
- @content;
514
- @each $key, $value in $map-for-breakpoints {
515
- @media (min-width: #{$value}) {
516
- content: "#{$key}";
517
- }
518
- }
519
- }
520
- }
521
- }
522
- }
523
-
524
-
525
-
526
- @mixin gls-center($axis: "both") {
527
- @if not index("both" "horizontal" "vertical", $axis) {
528
- @error "`#{$axis}` is not a valid $axis for `center`. Pass one of: both, horizontal, vertical.";
529
- }
530
- @if $axis == "both" or $axis == "vertical" {
531
- top: 50%;
532
- }
533
- @if $axis == "both" or $axis == "horizontal" {
534
- left: 50%;
535
- }
536
- transform:
537
- if($axis == "horizontal", translateX(-50%), if($axis == "both", translateX(-50%), null))
538
- if($axis == "vertical", translateY(-50%), if($axis == "both", translateY(-50%), null))
539
- ;
540
- }
541
-
542
-
543
-
544
- @mixin gls-circle($size) {
545
- width: $size;
546
- height: $size;
547
- display: inline-block;
548
- border-radius: 100%;
549
- }
550
-
551
-
552
-
553
- @mixin gls-clearfix {
554
- &::after {
555
- content: "";
556
- display: block;
557
- clear: both;
558
- }
559
- }
560
-
561
-
562
-
563
- @mixin gls-columnizer($params...) {
564
- @if length($params) < 1 or length($params) > 3 {
565
- @error "`columnizer` takes 1 to 3 arguments; you passed #{length($params)}. Pass the column count, optionally a gutter length, and optionally a boolean telling the last row whether to fill.";
566
- }
567
- $columns: nth($params, 1);
568
- $gutter: null;
569
- $fill: false;
570
- display: flex;
571
- flex-wrap: wrap;
572
- @include border-box;
573
- > * {
574
- @if length($params) == 1 {
575
- flex: 0 0 calc(100% / #{$columns});
576
- margin-bottom: 0;
577
- &:not(:last-child) {
578
- margin-right: 0;
579
- }
580
- } @else if length($params) == 2 {
581
- @if type-of(nth($params, 2)) == bool {
582
- $fill: nth($params, length($params));
583
- flex-grow: #{if($fill == true, 1, 0)};
584
- flex-shrink: 0;
585
- flex-basis: calc(100% / #{$columns});
586
- margin-bottom: 0;
587
- &:not(:last-child) {
588
- margin-right: 0;
589
- }
590
- } @else if __isGutter(nth($params, 2)) {
591
- $gutter: nth($params, length($params));
592
- flex-grow: 0;
593
- flex-shrink: 0;
594
- flex-basis: calc((100% - (#{$columns} - 1) * #{$gutter}) / #{$columns});
595
- margin-bottom: $gutter;
596
- &:not(:last-child) {
597
- margin-right: $gutter;
598
- }
599
- &:nth-child(#{$columns}n) {
600
- margin-right: 0;
601
- }
602
- } @else {
603
- @error "`#{nth($params, 2)}` is not a valid second argument for `columnizer`. Pass a gutter length such as `20px` or `var(--gap)`, or a boolean telling the last row whether to fill.";
604
- }
605
- } @else if length($params) == 3 {
606
- $gutter: nth($params, 2);
607
- $fill: nth($params, length($params));
608
- flex-grow: if($fill == true, 1, 0);
609
- flex-shrink: 0;
610
- flex-basis: calc((100% - (#{$columns} - 1) * #{$gutter}) / #{$columns});
611
- margin-bottom: $gutter;
612
- &:not(:last-child) {
613
- margin-right: $gutter;
614
- }
615
- &:nth-child(#{$columns}n) {
616
- margin-right: 0;
617
- }
618
- }
619
- }
620
- }
621
-
622
-
623
-
624
- @mixin gls-counter($params...) {
625
- $counter: null;
626
- $counter-before: null;
627
- $counter-after: null;
628
-
629
- @if length($params) == 1 {
630
- @if index($list-of-counter-styles, nth($params, 1)) {
631
- $counter: nth($params, 1);
632
- } @else {
633
- $counter-after: nth($params, 1);
634
- }
635
- } @else if length($params) == 2 {
636
- @if index($list-of-counter-styles, nth($params, 1)) {
637
- $counter: nth($params, 1);
638
- $counter-after: nth($params, 2);
639
- } @else if index($list-of-counter-styles, nth($params, 2)) {
640
- $counter-before: nth($params, 1);
641
- $counter: nth($params, 2);
642
- } @else {
643
- $counter-before: nth($params, 1);
644
- $counter-after: nth($params, 2);
645
- }
646
- } @else if length($params) == 3 {
647
- @if index($list-of-counter-styles, nth($params, 2)) {
648
- $counter-before: nth($params, 1);
649
- $counter: nth($params, 2);
650
- $counter-after: nth($params, 3);
651
- }
652
- }
653
-
654
- &.counter-start {
655
- counter-reset: glsCounter;
656
- }
657
- &.counter-start .counter-item::before,
658
- &.counter-continue .counter-item::before {
659
- content: #{if($counter-before, '"' + $counter-before + '"' + " ", null)}counter(
660
- glsCounter#{if($counter, ", " + $counter, null)}
661
- )
662
- #{if($counter-after, " " + '"' + $counter-after + '"', null)};
663
- counter-increment: glsCounter;
664
- @content;
665
- }
666
- }
667
-
668
-
669
-
670
- @mixin gls-ellipsis($width: 100%, $display: inline-block) {
671
- display: $display;
672
- max-width: $width;
673
- text-overflow: ellipsis;
674
- white-space: nowrap;
675
- overflow: hidden;
676
- word-wrap: normal;
677
- }
678
-
679
-
680
-
681
- @mixin gls-escape-to-parent($selector: null) {
682
- @if $selector != null and type-of($selector) != "string" {
683
- @error "`#{$selector}` is not a valid $selector for `escape-to-parent`. Pass a selector as a string, such as `\".theme-dark\"`.";
684
- }
685
- @at-root #{$selector}#{&} {
686
- @content;
687
- }
688
- }
689
-
690
-
691
-
692
- @mixin gls-except($params...) {
693
- @if length($params) == 0 {
694
- @error "Please pass an argument. The argument must be either a negative or positive number or list of numbers. Or pass one of the following predefined string values: 'first', 'last', 'odd', 'even'.";
695
- } @else if length($params) == 1 {
696
- $value: nth($params, 1);
697
- @if type-of($value) == "number" {
698
- @if $value < 0 {
699
- &:not(:nth-last-of-type(#{$value * -1})) {
700
- @content;
701
- }
702
- } @else {
703
- &:not(:nth-of-type(#{$value})) {
704
- @content;
705
- }
706
- }
707
- } @else if type-of($value) == "string" {
708
- @if $value == "odd" {
709
- &:not(:nth-of-type(odd)) {
710
- @content;
711
- }
712
- } @else if $value == "even" {
713
- &:not(:nth-of-type(even)) {
714
- @content;
715
- }
716
- } @else if $value == "first" {
717
- &:not(:first-of-type) {
718
- @content;
719
- }
720
- } @else if $value == "last" {
721
- &:not(:last-of-type) {
722
- @content;
723
- }
724
- } @else {
725
- &:not(#{$value}) {
726
- @content;
727
- }
728
- }
729
- } @else {
730
- @error "`#{$value}` is not a valid argument for `except`. Pass a positive or negative number, one of `first`, `last`, `odd`, `even`, or a selector such as `.foo`.";
731
- }
732
- } @else if length($params) > 1 {
733
- $items: "";
734
- @for $i from 1 through length($params) {
735
- $items: $items + if(nth($params, $i) < 0, unquote(":not(:nth-last-of-type(#{nth($params, $i) * -1}))"), unquote(":not(:nth-of-type(#{nth($params, $i)}))"));
736
- }
737
- &#{$items} {
738
- @content;
739
- }
740
- }
741
- }
742
-
743
-
744
-
745
- @mixin gls-font-face(
746
- $font-family,
747
- $file-path,
748
- $font-style: normal,
749
- $font-weight: 400,
750
- $file-formats: eot woff2 woff ttf svg
751
- ) {
752
- @if & {
753
- @error "You must call the mixin at the root level of your style sheet, not in the `#{&+'{'+'}'}` selector.";
754
- } @else if type-of($font-family) != "string" {
755
- @error "`#{$font-family}` is not a valid $font-family for `font-face`. Pass the family name as a string, such as `\"Inter\"`.";
756
- } @else if type-of($file-path) != "string" {
757
- @error "`#{$file-path}` is not a valid $file-path for `font-face`. Pass the path to the font files without an extension, as a string.";
758
- } @else {
759
-
760
- $list: ();
761
-
762
- @if index(100 200 300 400 500 600 700 800 900, $font-style) {
763
- $font-weight: $font-style;
764
- $font-style: normal;
765
- } @else if not
766
- index("normal" "italic" "oblique", $font-style) and
767
- type-of($font-style) !=
768
- "number"
769
- {
770
- $font-style-list: ();
771
- @for $i from 1 through length($font-style) {
772
- $font-style-list: append($font-style-list, nth($font-style, $i), comma);
773
- }
774
- @for $i from 1 through length($font-style-list) {
775
- @if index("eot" "woff2" "woff" "ttf" "svg", nth($font-style-list, $i)) {
776
- $file-formats: $font-style-list;
777
- $font-style: normal;
778
- }
779
- }
780
- }
781
-
782
- @font-face {
783
- font-family: $font-family;
784
- @if index($file-formats, eot) {
785
- src: url("#{$file-path}.eot");
786
- }
787
- @for $i from 1 through length($file-formats) {
788
- $list: append($list, __fontSource($font-family, $file-path, nth($file-formats, $i)), comma);
789
- }
790
- src: $list;
791
- font-style: $font-style;
792
- font-weight: $font-weight;
793
- @content;
794
- }
795
- }
796
- }
797
-
798
-
799
-
800
- @mixin gls-hide($toggle: "hide") {
801
- @if $toggle == "hide" {
802
- position: absolute;
803
- width: 1px;
804
- height: 1px;
805
- padding: 0;
806
- border: 0;
807
- overflow: hidden;
808
- clip: rect(1px, 1px, 1px, 1px);
809
- clip-path: inset(100%);
810
- white-space: nowrap;
811
- } @else if $toggle == "unhide" {
812
- position: static;
813
- width: auto;
814
- height: auto;
815
- overflow: visible;
816
- clip: auto;
817
- clip-path: none;
818
- white-space: inherit;
819
- } @else if not index ("hide" "unhide", $toggle) {
820
- @error "#{$toggle} is not a valid value for the `$toggle` argument. The value must be either `hide` or `unhide`.";
821
- }
822
- }
823
-
824
-
825
-
826
- @mixin gls-linear-gradient($direction, $colors) {
827
- $list: ();
828
- @for $i from 1 through length($colors) {
829
- $list: append($list, nth($colors, $i), comma);
830
- }
831
- @if map-has-key($map-for-directions, $direction) {
832
- background: linear-gradient(
833
- map-get($map-for-directions, $direction),
834
- $list
835
- );
836
- } @else if not map-has-key($map-for-directions, $direction) {
837
- @if type-of($direction) != "number" or not index("deg", unit($direction)) {
838
- @error "`#{$direction}` is not a valid $direction for `linear-gradient`. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
839
- } @else {
840
- background: linear-gradient($direction, $list);
841
- }
842
- }
843
- }
844
-
845
-
846
-
847
- @mixin gls-loadify($params...) {
848
- @if not & {
849
- @if length($params) == 0 or (length($params) == 1 and nth($params, 1) == "init") {
850
- @keyframes loadify {
851
- to {
852
- opacity: 1;
853
- visibility: visible;
854
- backface-visibility: visible;
855
- }
856
- }
857
- %loadify {
858
- opacity: 0;
859
- visibility: hidden;
860
- backface-visibility: hidden;
861
- animation-name: loadify;
862
- animation-fill-mode: forwards;
863
- }
864
- } @else if (length($params) == 1 and nth($params, 1) != "init") or (length($params) == 1 and type-of(nth($params, 1)) != "string") {
865
- @error "#{nth($params, 1)} is not a valid argument. Please pass `init` as an argument to initialize the effect or do not pass any argument at all.";
866
- } @else if length($params) > 1 {
867
- @error "Only one argument is allowed when you call this mixin at the root of your stylesheet! Please pass `init` as an argument to initialize the effect or do not pass any argument at all.";
868
- }
869
- } @else if & {
870
- @extend %loadify;
871
- @if length($params) == 0 {
872
- animation-delay: 0.2s;
873
- animation-duration: 0.5s;
874
- } @else if length($params) == 1 {
875
- animation-delay: #{__isTime(nth($params, 1))};
876
- animation-duration: 0.5s;
877
- } @else if length($params) == 2 {
878
- animation-delay: #{__isTime(nth($params, 1))};
879
- animation-duration: #{__isTime(nth($params, 2))};
880
- } @else if length($params) > 2 {
881
- @error "You cannot pass more than two arguments.";
882
- }
883
- }
884
- }
885
-
886
-
887
-
888
- @mixin gls-only($params...) {
889
- @if length($params) == 0 {
890
- @error "Please pass an argument. The argument must be either a negative or positive number or list of numbers. Or pass one of the following predefined string values: 'first', 'last', 'odd', 'even'.";
891
- } @else if length($params) == 1 {
892
- $value: nth($params, 1);
893
- @if type-of($value) == "number" {
894
- @if $value < 0 {
895
- &:nth-last-of-type(#{$value * -1}) {
896
- @content;
897
- }
898
- } @else {
899
- &:nth-of-type(#{$value}) {
900
- @content;
901
- }
902
- }
903
- } @else if type-of($value) == "string" {
904
- @if $value == "odd" {
905
- &:nth-of-type(odd) {
906
- @content;
907
- }
908
- } @else if $value == "even" {
909
- &:nth-of-type(even) {
910
- @content;
911
- }
912
- } @else if $value == "first" {
913
- &:first-of-type {
914
- @content;
915
- }
916
- } @else if $value == "last" {
917
- &:last-of-type {
918
- @content;
919
- }
920
- } @else {
921
- // For class, id or attribute selectors.
922
- &#{$value} {
923
- @content;
924
- }
925
- }
926
- } @else {
927
- @error "`#{$value}` is not a valid argument for `only`. Pass a positive or negative number, one of `first`, `last`, `odd`, `even`, or a selector such as `.foo`.";
928
- }
929
- } @else if length($params) > 1 {
930
- $list: ();
931
- @for $i from 1 through length($params) {
932
- $list: append($list, if(nth($params, $i) < 0, unquote("&:nth-last-of-type(#{nth($params, $i) * -1})"), unquote("&:nth-of-type(#{nth($params, $i)})")), comma);
933
- }
934
- #{$list} {
935
- @content;
936
- }
937
- }
938
- }
939
-
940
-
941
-
942
- @mixin gls-placeholder-shown {
943
- &:placeholder-shown {
944
- @content;
945
- }
946
- }
947
-
948
-
949
-
950
- @mixin gls-placeholder {
951
- &::-webkit-input-placeholder {
952
- @content;
953
- }
954
- &::-moz-placeholder {
955
- @content;
956
- }
957
- &:-ms-input-placeholder {
958
- @content;
959
- }
960
- &:-moz-placeholder {
961
- @content;
962
- }
963
- &::placeholder {
964
- @content;
965
- }
966
- }
967
-
968
-
969
-
970
- @mixin gls-position($position: absolute, $offsets: 0) {
971
- $offsets: __shorthandProperty($offsets);
972
- $positioning-offsets: (
973
- top: nth($offsets, 1),
974
- right: nth($offsets, 2),
975
- bottom: nth($offsets, 3),
976
- left: nth($offsets, 4),
977
- );
978
- position: $position;
979
- @each $offset, $value in $positioning-offsets {
980
- @if __validateLength($value) {
981
- #{$offset}: $value;
982
- }
983
- }
984
- }
985
-
986
-
987
-
988
- @mixin gls-radial-gradient($shape, $position, $colors) {
989
- @if type-of($shape) != "string" {
990
- @error "`#{$shape}` is not a valid $shape for `radial-gradient`. Pass `circle` or `ellipse`.";
991
- }
992
- @if type-of($position) != "string" {
993
- @error "`#{$position}` is not a valid $position for `radial-gradient`. Pass a position name such as `center` or `top-left`, or a raw CSS position as a string.";
994
- }
995
- $list: ();
996
- $shape: unquote($shape);
997
- $position: unquote($position);
998
- @for $i from 1 through length($colors) {
999
- $list: append($list, nth($colors, $i), comma);
1000
- }
1001
- @if map-has-key($map-for-positions, $position) {
1002
- background: radial-gradient(
1003
- $shape map-get($map-for-positions, $position),
1004
- $list
1005
- );
1006
- } @else if not map-has-key($map-for-positions, $position) {
1007
- background: radial-gradient($shape $position, $list);
1008
- }
1009
- }
1010
-
1011
-
1012
-
1013
- @mixin gls-ratio-box($ratio: null) {
1014
- position: relative;
1015
- &::before {
1016
- content: "";
1017
- display: block;
1018
- padding-top: __validateRatio($ratio);
1019
- }
1020
- & > * {
1021
- width: 100%;
1022
- height: 100%;
1023
- position: absolute;
1024
- top: 0;
1025
- right: 0;
1026
- bottom: 0;
1027
- left: 0;
1028
- }
1029
- }
1030
-
1031
-
1032
-
1033
- @mixin gls-remove($params...) {
1034
- @if length($params) == 0 {
1035
- display: none;
1036
- } @else if length($params) == 1 {
1037
- $value: nth($params, 1);
1038
- @include gls-breakpoint($value) {
1039
- display: none;
1040
- }
1041
- } @else if length($params) == 2 {
1042
- @if index("min" "max", nth($params, 1)) {
1043
- $mode: nth($params, 1);
1044
- $value: nth($params, 2);
1045
- @if $mode == "min" {
1046
- @include gls-breakpoint(min, $value) {
1047
- display: none;
1048
- }
1049
- } @else if $mode == "max" {
1050
- @include gls-breakpoint(max, $value) {
1051
- display: none;
1052
- }
1053
- }
1054
- } @else {
1055
- $start: nth($params, 1);
1056
- $end: nth($params, 2);
1057
- @include gls-breakpoint($start, $end) {
1058
- display: none;
1059
- }
1060
- }
1061
- } @else {
1062
- @error "`remove` takes at most 2 arguments; you passed #{length($params)}. Pass nothing to hide the element outright, one breakpoint, `min`/`max` plus a breakpoint, or a start and an end breakpoint.";
1063
- }
1064
- }
1065
-
1066
-
1067
-
1068
- @mixin gls-reset-css {
1069
- @if & {
1070
- @error "Please call the mixin at the root of your style sheet.";
1071
- } @else {
1072
- /* http://meyerweb.com/eric/tools/css/reset/
1073
- v2.0 | 20110126
1074
- License: none (public domain)
1075
- */
1076
- html, body, div, span, applet, object, iframe,
1077
- h1, h2, h3, h4, h5, h6, p, blockquote, pre,
1078
- a, abbr, acronym, address, big, cite, code,
1079
- del, dfn, em, img, ins, kbd, q, s, samp,
1080
- small, strike, strong, sub, sup, tt, var,
1081
- b, u, i, center,
1082
- dl, dt, dd, ol, ul, li,
1083
- fieldset, form, label, legend,
1084
- table, caption, tbody, tfoot, thead, tr, th, td,
1085
- article, aside, canvas, details, embed,
1086
- figure, figcaption, footer, header, hgroup,
1087
- menu, nav, output, ruby, section, summary,
1088
- time, mark, audio, video {
1089
- margin: 0;
1090
- padding: 0;
1091
- border: 0;
1092
- font-size: 100%;
1093
- font: inherit;
1094
- vertical-align: baseline;
1095
- }
1096
- /* HTML5 display-role reset for older browsers */
1097
- article, aside, details, figcaption, figure,
1098
- footer, header, hgroup, menu, main, nav, section {
1099
- display: block;
1100
- }
1101
- body {
1102
- line-height: 1;
1103
- }
1104
- ol, ul {
1105
- list-style: none;
1106
- }
1107
- blockquote, q {
1108
- quotes: none;
1109
- }
1110
- blockquote:before, blockquote:after,
1111
- q:before, q:after {
1112
- content: '';
1113
- content: none;
1114
- }
1115
- table {
1116
- border-collapse: collapse;
1117
- border-spacing: 0;
1118
- }
1119
- }
1120
- }
1121
-
1122
-
1123
- @mixin gls-reset-figure {
1124
- margin: 0;
1125
- img {
1126
- @include gls-responsive-image;
1127
- }
1128
- }
1129
-
1130
-
1131
-
1132
- @mixin gls-resizable($direction: both, $overflow: auto) {
1133
- resize: $direction;
1134
- overflow: $overflow;
1135
- max-width: 100%;
1136
- }
1137
-
1138
-
1139
-
1140
- @mixin gls-responsive-image {
1141
- display: block;
1142
- width: 100%;
1143
- }
1144
-
1145
-
1146
-
1147
- @mixin gls-responsive-video($ratio: null) {
1148
- position: relative;
1149
- &::before {
1150
- content: "";
1151
- display: block;
1152
- padding-top: __validateRatio($ratio);
1153
- }
1154
- & > * {
1155
- width: 100%;
1156
- height: 100%;
1157
- position: absolute;
1158
- top: 0;
1159
- right: 0;
1160
- bottom: 0;
1161
- left: 0;
1162
- }
1163
- }
1164
-
1165
-
1166
-
1167
- @mixin gls-scissors($corners) {
1168
- @if length($corners) == 1 {
1169
- $corners: __validateScissors($corners);
1170
- clip-path: polygon(
1171
- 0 #{nth($corners, 1)},
1172
- #{nth($corners, 1)} 0,
1173
- calc(100% - #{nth($corners, 1)}) 0,
1174
- 100% #{nth($corners, 1)},
1175
- 100% calc(100% - #{nth($corners, 1)}),
1176
- calc(100% - #{nth($corners, 1)}) 100%,
1177
- #{nth($corners, 1)} 100%,
1178
- 0 calc(100% - #{nth($corners, 1)})
1179
- );
1180
- } @else if length($corners) == 4 {
1181
- $corners: __validateScissors($corners);
1182
- clip-path: polygon(
1183
- 0 #{nth($corners, 1)},
1184
- #{nth($corners, 1)} 0,
1185
- calc(100% - #{nth($corners, 2)}) 0,
1186
- 100% #{nth($corners, 2)},
1187
- 100% calc(100% - #{nth($corners, 3)}),
1188
- calc(100% - #{nth($corners, 3)}) 100%,
1189
- #{nth($corners, 4)} 100%,
1190
- 0 calc(100% - #{nth($corners, 4)})
1191
- );
1192
- } @else {
1193
- @error "`scissors` takes either 1 corner size or 4; you passed #{length($corners)}. Pass one length to cut every corner equally, or four lengths in top-left, top-right, bottom-right, bottom-left order.";
1194
- }
1195
- }
1196
-
1197
-
1198
-
1199
- @mixin gls-screen-agent($resolution) {
1200
- @if $resolution == "1x" {
1201
- @media (min-resolution: 96dpi) {
1202
- @content;
1203
- }
1204
- } @else if $resolution == "2x" {
1205
- @media (min-resolution: 192dpi) {
1206
- @content;
1207
- }
1208
- } @else if $resolution == "3x" {
1209
- @media (min-resolution: 288dpi) {
1210
- @content;
1211
- }
1212
- } @else {
1213
- @media (min-resolution: #{$resolution}) {
1214
- @content;
1215
- }
1216
- }
1217
- }
1218
-
1219
-
1220
-
1221
- @mixin gls-sizer($width, $height: $width) {
1222
- width: $width;
1223
- height: $height;
1224
- }
1225
-
1226
-
1227
-
1228
- @mixin gls-smartphone($device, $orientation: null) {
1229
- @if map-has-key($map-for-smartphones, $device) {
1230
- @if $orientation == portrait or $orientation == null {
1231
- @media only screen
1232
- and (device-width: __mapDeepGet($map-for-smartphones, $device, 'width'))
1233
- and (device-height: __mapDeepGet($map-for-smartphones, $device, 'height'))
1234
- and (orientation: portrait) {
1235
- @content;
1236
- }
1237
- } @else if $orientation == landscape {
1238
- @media only screen
1239
- and (device-width: __mapDeepGet($map-for-smartphones, $device, 'height'))
1240
- and (device-height: __mapDeepGet($map-for-smartphones, $device, 'width'))
1241
- and (orientation: landscape) {
1242
- @content;
1243
- }
1244
- } @else {
1245
- @error "`#{$orientation}` is not a valid $orientation for `smartphone`. Pass `portrait`, `landscape`, or no orientation at all.";
1246
- }
1247
- } @else {
1248
- @error "`#{$device}` is not a device known to `smartphone`. Pass one of: #{map-keys($map-for-smartphones)}.";
1249
- }
1250
- }
1251
-
1252
-
1253
-
1254
- @mixin gls-sprite($params...) {
1255
- @if length($params) == 1 {
1256
- @if type-of(nth($params, 1)) == "string" {
1257
- $str-length: str-length(nth($params, 1));
1258
- $str-end: str-slice(nth($params, 1), $str-length - 3);
1259
- @if index(".png" ".jpg" ".svg", $str-end) {
1260
- $image-url: nth($params, 1);
1261
- display: inline-block;
1262
- background-image: url($image-url);
1263
- background-repeat: no-repeat;
1264
- } @else {
1265
- @error "`#{nth($params, 1)}` is not a valid image path for `sprite`. The path must end in .png, .jpg or .svg.";
1266
- }
1267
- } @else {
1268
- $position: nth($params, 1);
1269
- background-position: $position;
1270
- }
1271
- } @else if length($params) == 2 {
1272
- $image-url: nth($params, 1);
1273
- $position: nth($params, 2);
1274
- display: inline-block;
1275
- background-image: url($image-url);
1276
- background-position: $position;
1277
- background-repeat: no-repeat;
1278
- } @else {
1279
- @error "`sprite` takes 1 or 2 arguments; you passed #{length($params)}. Pass an image path, a background position, or both in that order.";
1280
- }
1281
- @content;
1282
- }
1283
-
1284
-
1285
-
1286
- @mixin gls-stretched-link($value: "before") {
1287
- @if index("before" "after", $value) {
1288
- &#{"::" + $value} {
1289
- content: "";
1290
- position: absolute;
1291
- pointer-events: auto;
1292
- background-color: rgba(0, 0, 0, 0);
1293
- top: 0;
1294
- right: 0;
1295
- bottom: 0;
1296
- left: 0;
1297
- z-index: 1;
1298
- }
1299
- } @else {
1300
- @error "'#{$value}' is a wrong argument. This mixin accepts 'before' or 'after' as an argument. If you don't pass any argument default it will target the '::before' pseudo-element of the selected element.";
1301
- }
1302
- }
1303
-
1304
-
1305
-
1306
- @mixin gls-tablet($device, $orientation: null) {
1307
- @if map-has-key($map-for-tablets, $device) {
1308
- @if $orientation == portrait or $orientation == null {
1309
- @media only screen
1310
- and (device-width: __mapDeepGet($map-for-tablets, $device, 'width'))
1311
- and (device-height: __mapDeepGet($map-for-tablets, $device, 'height'))
1312
- and (orientation: portrait) {
1313
- @content;
1314
- }
1315
- } @else if $orientation == landscape {
1316
- @media only screen
1317
- and (device-width: __mapDeepGet($map-for-tablets, $device, 'height'))
1318
- and (device-height: __mapDeepGet($map-for-tablets, $device, 'width'))
1319
- and (orientation: landscape) {
1320
- @content;
1321
- }
1322
- } @else {
1323
- @error "`#{$orientation}` is not a valid $orientation for `tablet`. Pass `portrait`, `landscape`, or no orientation at all.";
1324
- }
1325
- } @else {
1326
- @error "`#{$device}` is not a device known to `tablet`. Pass one of: #{map-keys($map-for-tablets)}.";
1327
- }
1328
- }
1329
-
1330
-
1331
-
1332
- @mixin gls-text-gradient($direction, $colors) {
1333
- $list: ();
1334
- @for $i from 1 through length($colors) {
1335
- $list: append($list, nth($colors, $i), comma);
1336
- }
1337
- @if map-has-key($map-for-directions, $direction) {
1338
- background: linear-gradient(
1339
- map-get($map-for-directions, $direction),
1340
- $list
1341
- );
1342
- } @else if not map-has-key($map-for-directions, $direction) {
1343
- @if type-of($direction) != "number" or not index("deg", unit($direction)) {
1344
- @error "`#{$direction}` is not a valid $direction for `text-gradient`. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
1345
- } @else {
1346
- background: linear-gradient($direction, $list);
1347
- }
1348
- }
1349
- -webkit-background-clip: text;
1350
- -webkit-text-fill-color: transparent;
1351
- background-clip: text;
1352
- color: transparent;
1353
- }
1354
-
1355
-
1356
-
1357
- @mixin gls-text-image($image: null) {
1358
- @if $image {
1359
- background-image: url($image);
1360
- }
1361
- background-size: cover;
1362
- background-position: center;
1363
- -webkit-background-clip: text;
1364
- -webkit-text-fill-color: transparent;
1365
- background-clip: text;
1366
- color: transparent;
1367
- }
1368
-
1369
-
1370
-
1371
- @mixin gls-text-selection($value: null) {
1372
- @if not & and $value == null {
1373
- ::selection {
1374
- @content;
1375
- }
1376
- } @else if & and $value == "only" {
1377
- &::selection {
1378
- @content;
1379
- }
1380
- } @else if & and $value == null {
1381
- &::selection,
1382
- *::selection {
1383
- @content;
1384
- }
1385
- } @else if not & and $value == "only" {
1386
- @error "`only` has no meaning at the root of a stylesheet, because there is no selector to limit the effect to. Call `text-selection(\"only\")` inside a selector, or pass no argument at all.";
1387
- } @else {
1388
- @error "`#{$value}` is not a valid argument for `text-selection`. Pass `\"only\"` inside a selector to affect just that element, or pass no argument at all.";
1389
- }
1390
- }
1391
-
1392
-
1393
-
1394
- @mixin gls-text-shadow($params...) {
1395
- $value: ();
1396
-
1397
- @for $i from 1 through length($params) {
1398
- // Takes each items come from $params.
1399
- $item: nth($params, $i);
1400
-
1401
- // Each group must carry at least a direction, a colour and a size. Without
1402
- // this the nth() calls below fail with "Invalid index", which says nothing
1403
- // about what the mixin wanted.
1404
- @if length($item) < 3 {
1405
- @error "`#{$item}` is not a valid shadow for `text-shadow`. Each group needs a direction, a colour and a size, such as `bottom-right red 5px`. An optional blur and a fill flag may follow.";
1406
- }
1407
-
1408
- // The first value comes from the $item is direction.
1409
- // This will be used in the @if, @else statements with $size to control the offset of the shadows.
1410
- $direction: nth($item, 1);
1411
-
1412
- // Second value is the color.
1413
- $color: nth($item, 2);
1414
-
1415
- // The third value is the actual offset value of the shadows.
1416
- $size: nth($item, 3);
1417
-
1418
- // Takes the unit of the $size value to use it later to increment the amount of shadow based on the unit.
1419
- $sizeUnit: unit($size);
1420
-
1421
- // The $blur argument is optional. It controls the size of the blur.
1422
- $blur: null;
1423
-
1424
- // The $fill argument is optional. This makes shadow fill the gap between the actual text and shadow's end-point. The default value is set to false.
1425
- $fill: null;
1426
-
1427
- // Assigns the optional sub-arguments to the actual argument.
1428
- @if length($item) == 4 and type-of(nth($item, 4)) == number {
1429
- $blur: nth($item, length($item));
1430
- } @else if length($item) == 4 and type-of(nth($item, 4)) == bool {
1431
- $fill: nth($item, length($item));
1432
- } @else if length($item) == 5 {
1433
- $blur: nth($item, 4);
1434
- $fill: nth($item, length($item));
1435
- }
1436
-
1437
- // The code below changes the angle of $direction of the shadow based on the predefined values.
1438
- @if $direction == "top" {
1439
- @if $fill == true {
1440
- // The __clearUnit(); function is used here due to it is not possible to count $size with a unit. First, it clears the unit from the $size argument and then adds it back again in the @for loop.
1441
- @for $i from 1 through __clearUnit($size) {
1442
- $increase: $i * 1 + $sizeUnit;
1443
- $shadow: 0 -#{$increase} $blur $color;
1444
- $value: append($value, $shadow, comma);
1445
- }
1446
- } @else {
1447
- $shadow: 0 -#{$size} $blur $color;
1448
- $value: append($value, $shadow, comma);
1449
- }
1450
- } @else if $direction == "top-left" {
1451
- @if $fill == true {
1452
- @for $i from 1 through __clearUnit($size) {
1453
- $increase: $i * 1 + $sizeUnit;
1454
- $shadow: -#{$increase} -#{$increase} $blur $color;
1455
- $value: append($value, $shadow, comma);
1456
- }
1457
- } @else {
1458
- $shadow: -#{$size} -#{$size} $blur $color;
1459
- $value: append($value, $shadow, comma);
1460
- }
1461
- } @else if $direction == "top-right" {
1462
- @if $fill == true {
1463
- @for $i from 1 through __clearUnit($size) {
1464
- $increase: $i * 1 + $sizeUnit;
1465
- $shadow: #{$increase} -#{$increase} $blur $color;
1466
- $value: append($value, $shadow, comma);
1467
- }
1468
- } @else {
1469
- $shadow: #{$size} -#{$size} $blur $color;
1470
- $value: append($value, $shadow, comma);
1471
- }
1472
- } @else if $direction == "bottom" {
1473
- @if $fill == true {
1474
- @for $i from 1 through __clearUnit($size) {
1475
- $increase: $i * 1 + $sizeUnit;
1476
- $shadow: 0 #{$increase} $blur $color;
1477
- $value: append($value, $shadow, comma);
1478
- }
1479
- } @else {
1480
- $shadow: 0 #{$size} $blur $color;
1481
- $value: append($value, $shadow, comma);
1482
- }
1483
- } @else if $direction == "bottom-left" {
1484
- @if $fill == true {
1485
- @for $i from 1 through __clearUnit($size) {
1486
- $increase: $i * 1 + $sizeUnit;
1487
- $shadow: -#{$increase} #{$increase} $blur $color;
1488
- $value: append($value, $shadow, comma);
1489
- }
1490
- } @else {
1491
- $shadow: -#{$size} #{$size} $blur $color;
1492
- $value: append($value, $shadow, comma);
1493
- }
1494
- } @else if $direction == "bottom-right" {
1495
- @if $fill == true {
1496
- @for $i from 1 through __clearUnit($size) {
1497
- $increase: $i * 1 + $sizeUnit;
1498
- $shadow: #{$increase} #{$increase} $blur $color;
1499
- $value: append($value, $shadow, comma);
1500
- }
1501
- } @else {
1502
- $shadow: #{$size} #{$size} $blur $color;
1503
- $value: append($value, $shadow, comma);
1504
- }
1505
- } @else if $direction == "left" {
1506
- @if $fill == true {
1507
- @for $i from 1 through __clearUnit($size) {
1508
- $increase: $i * 1 + $sizeUnit;
1509
- $shadow: -#{$increase} 0 $blur $color;
1510
- $value: append($value, $shadow, comma);
1511
- }
1512
- } @else {
1513
- $shadow: -#{$size} 0 $blur $color;
1514
- $value: append($value, $shadow, comma);
1515
- }
1516
- } @else if $direction == "right" {
1517
- @if $fill == true {
1518
- @for $i from 1 through __clearUnit($size) {
1519
- $increase: $i * 1 + $sizeUnit;
1520
- $shadow: #{$increase} 0 $blur $color;
1521
- $value: append($value, $shadow, comma);
1522
- }
1523
- } @else {
1524
- $shadow: #{$size} 0 $blur $color;
1525
- $value: append($value, $shadow, comma);
1526
- }
1527
- }
1528
- }
1529
- text-shadow: $value;
1530
- }
1531
-
1532
-
1533
-
1534
- @mixin gls-text-stroke(
1535
- $fallback-color: black,
1536
- $color: transparent,
1537
- $stroke-color: black,
1538
- $stroke-width: 1px
1539
- ) {
1540
- color: $fallback-color;
1541
- -webkit-text-fill-color: $color;
1542
- -webkit-text-stroke-color: $stroke-color;
1543
- -webkit-text-stroke-width: $stroke-width;
1544
- }
1545
-
1546
-
1547
-
1548
- @mixin gls-triangle($direction: "bottom", $color: black, $size: 10px 8px) {
1549
- @if index($list-of-directions, $direction) {
1550
- @if __isColor($color){
1551
- content: "";
1552
- height: 0;
1553
- width: 0;
1554
- display: inline-block;
1555
- border-style: solid;
1556
- @if $direction == "top"{
1557
- border-color: transparent transparent $color;
1558
- border-width: 0 math.div(nth($size, 1), 2) if(length($size) == 2, nth($size, 2), nth($size, 1));
1559
- } @else if $direction == "top-right" {
1560
- border-color: transparent $color transparent transparent;
1561
- border-width: 0 nth($size, 1) nth($size, 1) 0;
1562
- } @else if $direction == "right" {
1563
- border-color: transparent transparent transparent $color;
1564
- border-width: math.div(if(length($size) == 2, nth($size, 2), nth($size, 1)), 2) 0 math.div(if(length($size) == 2, nth($size, 2), nth($size, 1)), 2) nth($size, 1);
1565
- } @else if $direction == "bottom-right" {
1566
- border-color: transparent transparent $color;
1567
- border-width: 0 0 nth($size, 1) nth($size, 1);
1568
- } @else if $direction == "bottom" {
1569
- border-color: $color transparent transparent;
1570
- border-width: if(length($size) == 2, nth($size, 2), nth($size, 1)) math.div(nth($size, 1), 2) 0;
1571
- } @else if $direction == "bottom-left" {
1572
- border-color: transparent transparent transparent $color;
1573
- border-width: nth($size, 1) 0 0 nth($size, 1);
1574
- } @else if $direction == "left" {
1575
- border-color: transparent $color transparent transparent;
1576
- border-width: math.div(if(length($size) == 2, nth($size, 2), nth($size, 1)), 2) nth($size, 1) math.div(if(length($size) == 2, nth($size, 2), nth($size, 1)), 2) 0;
1577
- } @else if $direction == "top-left" {
1578
- border-color: $color transparent transparent;
1579
- border-width: nth($size, 1) nth($size, 1) 0 0;
1580
- }
1581
- @content;
1582
- }
1583
- } @else {
1584
- @error "The argument for direction must be one of the followings: #{$list-of-directions}";
1585
- }
1586
- }