gerillass 1.6.0 → 1.6.1
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.
- package/SKILL.md +9 -0
- package/gerillass.json +52 -17
- package/package.json +1 -1
- package/scss/_gerillass-prefix.scss +42 -6
- package/scss/library/_after.scss +3 -1
- package/scss/library/_background-dots.scss +3 -0
- package/scss/library/_background-stripes.scss +6 -0
- package/scss/library/_before.scss +3 -1
- package/scss/library/_breakpointer.scss +3 -0
- package/scss/library/_escape-to-parent.scss +3 -0
- package/scss/library/_font-face.scss +4 -0
- package/scss/library/_linear-gradient.scss +2 -2
- package/scss/library/_radial-gradient.scss +6 -0
- package/scss/library/_text-gradient.scss +2 -2
- package/scss/library/_text-shadow.scss +7 -0
- package/scss/utilities/_clear-whitespace.scss +3 -0
- package/scss/utilities/_convert-to-number.scss +4 -0
- package/scss/utilities/_null.scss +3 -0
- package/scss/utilities/_pixelify.scss +3 -0
- package/scss/utilities/_validate-length.scss +17 -5
- package/scss/utilities/_validate-scissors.scss +6 -0
package/SKILL.md
CHANGED
|
@@ -65,20 +65,27 @@ a dropped declaration rather than an error.
|
|
|
65
65
|
|
|
66
66
|
| Mixin | Rejects, for example |
|
|
67
67
|
|---|---|
|
|
68
|
+
| `after` | `.a { @include after(42) { color: red; } }` |
|
|
68
69
|
| `all-buttons` | `@include all-buttons(nonsense) { color: red; }` |
|
|
69
70
|
| `all-text-inputs` | `@include all-text-inputs(nonsense) { color: red; }` |
|
|
70
71
|
| `antialias` | `@include antialias(only);` |
|
|
71
72
|
| `background-dots` | `.a { @include background-dots(red, 1em, 5em, maybe); }` |
|
|
72
73
|
| `background-image` | `.a { @include background-image("/img/a.png", (red, blue), sideways); }` |
|
|
74
|
+
| `background-stripes` | `.a { @include background-stripes(red, 2em, nonsense); }` |
|
|
75
|
+
| `before` | `.a { @include before(42) { color: red; } }` |
|
|
73
76
|
| `border-box` | `@include border-box(only);` |
|
|
74
77
|
| `border-radius` | `.a { @include border-radius(1px, 2px, 3px); }` |
|
|
78
|
+
| `breakpointer` | `.a { @include breakpointer(42); }` |
|
|
75
79
|
| `center` | `.modal { @include center(diagonal); }` |
|
|
76
80
|
| `columnizer` | `.grid { @include columnizer(3, 20px, true, 9); }` |
|
|
81
|
+
| `escape-to-parent` | `.a { @include escape-to-parent(42) { color: red; } }` |
|
|
77
82
|
| `except` | `.a { @include except(#ff0000) { margin: 0; } }` |
|
|
78
83
|
| `font-face` | `.a { @include font-face("Inter", "/fonts/inter"); }` |
|
|
79
84
|
| `hide` | `.a { @include hide(nonsense); }` |
|
|
85
|
+
| `linear-gradient` | `.a { @include linear-gradient(sideways, (red, blue)); }` |
|
|
80
86
|
| `loadify` | `@include loadify(nonsense);` |
|
|
81
87
|
| `only` | `.a { @include only(#ff0000) { margin: 0; } }` |
|
|
88
|
+
| `radial-gradient` | `.a { @include radial-gradient(42, "center", (red, blue)); }` |
|
|
82
89
|
| `ratio-box` | `.hero { @include ratio-box(16 9); }` |
|
|
83
90
|
| `remove` | `.a { @include remove(a, b, c); }` |
|
|
84
91
|
| `reset-css` | `.a { @include reset-css; }` |
|
|
@@ -88,7 +95,9 @@ a dropped declaration rather than an error.
|
|
|
88
95
|
| `sprite` | `.icon { @include sprite("/img/sprite.txt"); }` |
|
|
89
96
|
| `stretched-link` | `.card a { @include stretched-link(middle); }` |
|
|
90
97
|
| `tablet` | `.a { @include tablet(Surface) { display: none; } }` |
|
|
98
|
+
| `text-gradient` | `.a { @include text-gradient(sideways, (red, blue)); }` |
|
|
91
99
|
| `text-selection` | `.a { @include text-selection(bogus) { background: yellow; } }` |
|
|
100
|
+
| `text-shadow` | `.a { @include text-shadow(42); }` |
|
|
92
101
|
| `triangle` | `.caret { @include triangle(sideways); }` |
|
|
93
102
|
|
|
94
103
|
## Mixins
|
package/gerillass.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gerillass",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Gerillass is an open-source toolkit that contains a set of Sass mixins to help designers and developers to create better, faster and consistent user interfaces.",
|
|
5
5
|
"homepage": "https://gerillass.com",
|
|
6
6
|
"documentation": "https://docs.gerillass.com",
|
|
@@ -54,7 +54,10 @@
|
|
|
54
54
|
".a { @include after(\"data-label\") { color: red; } }",
|
|
55
55
|
".a { @include after { content: \"x\"; } }"
|
|
56
56
|
],
|
|
57
|
-
"rejects": [
|
|
57
|
+
"rejects": [
|
|
58
|
+
".a { @include after(42) { color: red; } }",
|
|
59
|
+
".a { @include after(16 9) { color: red; } }"
|
|
60
|
+
]
|
|
58
61
|
},
|
|
59
62
|
{
|
|
60
63
|
"name": "all-buttons",
|
|
@@ -188,7 +191,8 @@
|
|
|
188
191
|
".a { @include background-dots(red, 1em, 5em, false); }"
|
|
189
192
|
],
|
|
190
193
|
"rejects": [
|
|
191
|
-
".a { @include background-dots(red, 1em, 5em, maybe); }"
|
|
194
|
+
".a { @include background-dots(red, 1em, 5em, maybe); }",
|
|
195
|
+
".a { @include background-dots(red, 1em, 5em, true, 42); }"
|
|
192
196
|
]
|
|
193
197
|
},
|
|
194
198
|
{
|
|
@@ -272,7 +276,10 @@
|
|
|
272
276
|
".a { @include background-stripes; }",
|
|
273
277
|
".a { @include background-stripes(red, 2em, -30deg); }"
|
|
274
278
|
],
|
|
275
|
-
"rejects": [
|
|
279
|
+
"rejects": [
|
|
280
|
+
".a { @include background-stripes(red, 2em, nonsense); }",
|
|
281
|
+
".a { @include background-stripes(red, 2em, -45deg, 42); }"
|
|
282
|
+
]
|
|
276
283
|
},
|
|
277
284
|
{
|
|
278
285
|
"name": "before",
|
|
@@ -295,7 +302,9 @@
|
|
|
295
302
|
".a { @include before(\"→\") { color: red; } }",
|
|
296
303
|
".a { @include before(\"data-label\") { color: red; } }"
|
|
297
304
|
],
|
|
298
|
-
"rejects": [
|
|
305
|
+
"rejects": [
|
|
306
|
+
".a { @include before(42) { color: red; } }"
|
|
307
|
+
]
|
|
299
308
|
},
|
|
300
309
|
{
|
|
301
310
|
"name": "border-box",
|
|
@@ -428,7 +437,9 @@
|
|
|
428
437
|
"@include breakpointer;",
|
|
429
438
|
".a { @include breakpointer; }"
|
|
430
439
|
],
|
|
431
|
-
"rejects": [
|
|
440
|
+
"rejects": [
|
|
441
|
+
".a { @include breakpointer(42); }"
|
|
442
|
+
]
|
|
432
443
|
},
|
|
433
444
|
{
|
|
434
445
|
"name": "center",
|
|
@@ -584,7 +595,9 @@
|
|
|
584
595
|
"examples": [
|
|
585
596
|
".a { @include escape-to-parent(\".theme-dark\") { color: white; } }"
|
|
586
597
|
],
|
|
587
|
-
"rejects": [
|
|
598
|
+
"rejects": [
|
|
599
|
+
".a { @include escape-to-parent(42) { color: red; } }"
|
|
600
|
+
]
|
|
588
601
|
},
|
|
589
602
|
{
|
|
590
603
|
"name": "except",
|
|
@@ -661,7 +674,9 @@
|
|
|
661
674
|
"@include font-face(\"Inter\", \"/fonts/inter\", italic, 700, woff2 woff);"
|
|
662
675
|
],
|
|
663
676
|
"rejects": [
|
|
664
|
-
".a { @include font-face(\"Inter\", \"/fonts/inter\"); }"
|
|
677
|
+
".a { @include font-face(\"Inter\", \"/fonts/inter\"); }",
|
|
678
|
+
"@include font-face(42, \"/fonts/x\");",
|
|
679
|
+
"@include font-face(\"Inter\", 42);"
|
|
665
680
|
]
|
|
666
681
|
},
|
|
667
682
|
{
|
|
@@ -715,7 +730,10 @@
|
|
|
715
730
|
".a { @include linear-gradient(\"top\", (red, blue)); }",
|
|
716
731
|
".a { @include linear-gradient(45deg, (red, blue)); }"
|
|
717
732
|
],
|
|
718
|
-
"rejects": [
|
|
733
|
+
"rejects": [
|
|
734
|
+
".a { @include linear-gradient(sideways, (red, blue)); }",
|
|
735
|
+
".a { @include linear-gradient(true, (red, blue)); }"
|
|
736
|
+
]
|
|
719
737
|
},
|
|
720
738
|
{
|
|
721
739
|
"name": "loadify",
|
|
@@ -853,7 +871,10 @@
|
|
|
853
871
|
"examples": [
|
|
854
872
|
".a { @include radial-gradient(circle, \"center\", (red, blue)); }"
|
|
855
873
|
],
|
|
856
|
-
"rejects": [
|
|
874
|
+
"rejects": [
|
|
875
|
+
".a { @include radial-gradient(42, \"center\", (red, blue)); }",
|
|
876
|
+
".a { @include radial-gradient(circle, 42, (red, blue)); }"
|
|
877
|
+
]
|
|
857
878
|
},
|
|
858
879
|
{
|
|
859
880
|
"name": "ratio-box",
|
|
@@ -1021,7 +1042,8 @@
|
|
|
1021
1042
|
".a { @include scissors(4px 8px 12px 16px); }"
|
|
1022
1043
|
],
|
|
1023
1044
|
"rejects": [
|
|
1024
|
-
".a { @include scissors(5px 10px); }"
|
|
1045
|
+
".a { @include scissors(5px 10px); }",
|
|
1046
|
+
".a { @include scissors(nonsense); }"
|
|
1025
1047
|
]
|
|
1026
1048
|
},
|
|
1027
1049
|
{
|
|
@@ -1214,7 +1236,9 @@
|
|
|
1214
1236
|
"examples": [
|
|
1215
1237
|
".a { @include text-gradient(\"top\", (red, blue)); }"
|
|
1216
1238
|
],
|
|
1217
|
-
"rejects": [
|
|
1239
|
+
"rejects": [
|
|
1240
|
+
".a { @include text-gradient(sideways, (red, blue)); }"
|
|
1241
|
+
]
|
|
1218
1242
|
},
|
|
1219
1243
|
{
|
|
1220
1244
|
"name": "text-image",
|
|
@@ -1278,7 +1302,10 @@
|
|
|
1278
1302
|
"examples": [
|
|
1279
1303
|
".a { @include text-shadow(bottom-right red 5px); }"
|
|
1280
1304
|
],
|
|
1281
|
-
"rejects": [
|
|
1305
|
+
"rejects": [
|
|
1306
|
+
".a { @include text-shadow(42); }",
|
|
1307
|
+
".a { @include text-shadow(top red); }"
|
|
1308
|
+
]
|
|
1282
1309
|
},
|
|
1283
1310
|
{
|
|
1284
1311
|
"name": "text-stroke",
|
|
@@ -1405,7 +1432,9 @@
|
|
|
1405
1432
|
"examples": [
|
|
1406
1433
|
".a { content: __clearWhitespace(\"a b c\"); }"
|
|
1407
1434
|
],
|
|
1408
|
-
"rejects": [
|
|
1435
|
+
"rejects": [
|
|
1436
|
+
".a { --x: #{__clearWhitespace(42)}; }"
|
|
1437
|
+
]
|
|
1409
1438
|
},
|
|
1410
1439
|
{
|
|
1411
1440
|
"name": "__convertToEm",
|
|
@@ -1445,7 +1474,9 @@
|
|
|
1445
1474
|
"examples": [
|
|
1446
1475
|
".a { z-index: __convertToNumber(\"42\"); }"
|
|
1447
1476
|
],
|
|
1448
|
-
"rejects": [
|
|
1477
|
+
"rejects": [
|
|
1478
|
+
".a { --x: #{__convertToNumber(42)}; }"
|
|
1479
|
+
]
|
|
1449
1480
|
},
|
|
1450
1481
|
{
|
|
1451
1482
|
"name": "__darken",
|
|
@@ -1690,7 +1721,9 @@
|
|
|
1690
1721
|
"examples": [
|
|
1691
1722
|
".a { margin: __null(1px null 3px null, space); }"
|
|
1692
1723
|
],
|
|
1693
|
-
"rejects": [
|
|
1724
|
+
"rejects": [
|
|
1725
|
+
".a { --x: #{__null(1px null, nonsense)}; }"
|
|
1726
|
+
]
|
|
1694
1727
|
},
|
|
1695
1728
|
{
|
|
1696
1729
|
"name": "__pixelify",
|
|
@@ -1710,7 +1743,9 @@
|
|
|
1710
1743
|
"examples": [
|
|
1711
1744
|
".a { width: __pixelify(24); }"
|
|
1712
1745
|
],
|
|
1713
|
-
"rejects": [
|
|
1746
|
+
"rejects": [
|
|
1747
|
+
".a { --x: #{__pixelify(nonsense)}; }"
|
|
1748
|
+
]
|
|
1714
1749
|
},
|
|
1715
1750
|
{
|
|
1716
1751
|
"name": "__pseudoSelector",
|
package/package.json
CHANGED
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
&::after {
|
|
18
18
|
@if $content == null {
|
|
19
19
|
@content;
|
|
20
|
-
} @else if $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 {
|
|
21
23
|
$data: str-slice($content, 1, 5);
|
|
22
24
|
@if $data == "data-" {
|
|
23
25
|
content: attr(#{$content});
|
|
@@ -107,6 +109,9 @@
|
|
|
107
109
|
$diagonal: true,
|
|
108
110
|
$image: null
|
|
109
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
|
+
}
|
|
110
115
|
@if $diagonal != true and $diagonal != false {
|
|
111
116
|
@error "`#{$diagonal}` is not a valid $diagonal for `background-dots`. Pass `true` or `false`.";
|
|
112
117
|
}
|
|
@@ -233,6 +238,12 @@
|
|
|
233
238
|
$rotation: -45deg,
|
|
234
239
|
$image: null
|
|
235
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
|
+
}
|
|
236
247
|
$validate-unit: if(not index("deg", unit($rotation)), $rotation + deg, $rotation);
|
|
237
248
|
$get-image: if($image, unquote(", ") + url(unquote($image)), unquote(""));
|
|
238
249
|
@if not $color {
|
|
@@ -284,7 +295,9 @@
|
|
|
284
295
|
&::before {
|
|
285
296
|
@if $content == null {
|
|
286
297
|
@content;
|
|
287
|
-
} @else if $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 {
|
|
288
301
|
$data: str-slice($content, 1, 5);
|
|
289
302
|
@if $data == "data-" {
|
|
290
303
|
content: attr(#{$content});
|
|
@@ -473,6 +486,9 @@
|
|
|
473
486
|
|
|
474
487
|
|
|
475
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
|
+
}
|
|
476
492
|
@if & {
|
|
477
493
|
&::before {
|
|
478
494
|
@content;
|
|
@@ -663,6 +679,9 @@
|
|
|
663
679
|
|
|
664
680
|
|
|
665
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
|
+
}
|
|
666
685
|
@at-root #{$selector}#{&} {
|
|
667
686
|
@content;
|
|
668
687
|
}
|
|
@@ -732,6 +751,10 @@
|
|
|
732
751
|
) {
|
|
733
752
|
@if & {
|
|
734
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.";
|
|
735
758
|
} @else {
|
|
736
759
|
|
|
737
760
|
$list: ();
|
|
@@ -811,8 +834,8 @@
|
|
|
811
834
|
$list
|
|
812
835
|
);
|
|
813
836
|
} @else if not map-has-key($map-for-directions, $direction) {
|
|
814
|
-
@if not index("deg", unit($direction)) {
|
|
815
|
-
@error "
|
|
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)}.";
|
|
816
839
|
} @else {
|
|
817
840
|
background: linear-gradient($direction, $list);
|
|
818
841
|
}
|
|
@@ -963,6 +986,12 @@
|
|
|
963
986
|
|
|
964
987
|
|
|
965
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
|
+
}
|
|
966
995
|
$list: ();
|
|
967
996
|
$shape: unquote($shape);
|
|
968
997
|
$position: unquote($position);
|
|
@@ -1311,8 +1340,8 @@
|
|
|
1311
1340
|
$list
|
|
1312
1341
|
);
|
|
1313
1342
|
} @else if not map-has-key($map-for-directions, $direction) {
|
|
1314
|
-
@if not index("deg", unit($direction)) {
|
|
1315
|
-
@error "
|
|
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)}.";
|
|
1316
1345
|
} @else {
|
|
1317
1346
|
background: linear-gradient($direction, $list);
|
|
1318
1347
|
}
|
|
@@ -1369,6 +1398,13 @@
|
|
|
1369
1398
|
// Takes each items come from $params.
|
|
1370
1399
|
$item: nth($params, $i);
|
|
1371
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
|
+
|
|
1372
1408
|
// The first value comes from the $item is direction.
|
|
1373
1409
|
// This will be used in the @if, @else statements with $size to control the offset of the shadows.
|
|
1374
1410
|
$direction: nth($item, 1);
|
package/scss/library/_after.scss
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
&::after {
|
|
5
5
|
@if $content == null {
|
|
6
6
|
@content;
|
|
7
|
-
} @else if $content !=
|
|
7
|
+
} @else if type-of($content) != "string" {
|
|
8
|
+
@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.";
|
|
9
|
+
} @else {
|
|
8
10
|
$data: str-slice($content, 1, 5);
|
|
9
11
|
@if $data == "data-" {
|
|
10
12
|
content: attr(#{$content});
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
$diagonal: true,
|
|
8
8
|
$image: null
|
|
9
9
|
) {
|
|
10
|
+
@if $image != null and type-of($image) != "string" {
|
|
11
|
+
@error "`#{$image}` is not a valid $image for `background-dots`. Pass an image path as a string.";
|
|
12
|
+
}
|
|
10
13
|
@if $diagonal != true and $diagonal != false {
|
|
11
14
|
@error "`#{$diagonal}` is not a valid $diagonal for `background-dots`. Pass `true` or `false`.";
|
|
12
15
|
}
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
$rotation: -45deg,
|
|
7
7
|
$image: null
|
|
8
8
|
) {
|
|
9
|
+
@if type-of($rotation) != "number" {
|
|
10
|
+
@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.";
|
|
11
|
+
}
|
|
12
|
+
@if $image != null and type-of($image) != "string" {
|
|
13
|
+
@error "`#{$image}` is not a valid $image for `background-stripes`. Pass an image path as a string.";
|
|
14
|
+
}
|
|
9
15
|
$validate-unit: if(not index("deg", unit($rotation)), $rotation + deg, $rotation);
|
|
10
16
|
$get-image: if($image, unquote(", ") + url(unquote($image)), unquote(""));
|
|
11
17
|
@if not $color {
|
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
&::before {
|
|
5
5
|
@if $content == null {
|
|
6
6
|
@content;
|
|
7
|
-
} @else if $content !=
|
|
7
|
+
} @else if type-of($content) != "string" {
|
|
8
|
+
@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.";
|
|
9
|
+
} @else {
|
|
8
10
|
$data: str-slice($content, 1, 5);
|
|
9
11
|
@if $data == "data-" {
|
|
10
12
|
content: attr(#{$content});
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
2
|
|
|
3
3
|
@mixin breakpointer($selector: null) {
|
|
4
|
+
@if $selector != null and type-of($selector) != "string" {
|
|
5
|
+
@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.";
|
|
6
|
+
}
|
|
4
7
|
@if & {
|
|
5
8
|
&::before {
|
|
6
9
|
@content;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
2
|
|
|
3
3
|
@mixin escape-to-parent($selector: null) {
|
|
4
|
+
@if $selector != null and type-of($selector) != "string" {
|
|
5
|
+
@error "`#{$selector}` is not a valid $selector for `escape-to-parent`. Pass a selector as a string, such as `\".theme-dark\"`.";
|
|
6
|
+
}
|
|
4
7
|
@at-root #{$selector}#{&} {
|
|
5
8
|
@content;
|
|
6
9
|
}
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
) {
|
|
10
10
|
@if & {
|
|
11
11
|
@error "You must call the mixin at the root level of your style sheet, not in the `#{&+'{'+'}'}` selector.";
|
|
12
|
+
} @else if type-of($font-family) != "string" {
|
|
13
|
+
@error "`#{$font-family}` is not a valid $font-family for `font-face`. Pass the family name as a string, such as `\"Inter\"`.";
|
|
14
|
+
} @else if type-of($file-path) != "string" {
|
|
15
|
+
@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.";
|
|
12
16
|
} @else {
|
|
13
17
|
|
|
14
18
|
$list: ();
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
$list
|
|
12
12
|
);
|
|
13
13
|
} @else if not map-has-key($map-for-directions, $direction) {
|
|
14
|
-
@if not index("deg", unit($direction)) {
|
|
15
|
-
@error "
|
|
14
|
+
@if type-of($direction) != "number" or not index("deg", unit($direction)) {
|
|
15
|
+
@error "`#{$direction}` is not a valid $direction for `linear-gradient`. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
|
|
16
16
|
} @else {
|
|
17
17
|
background: linear-gradient($direction, $list);
|
|
18
18
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
2
|
|
|
3
3
|
@mixin radial-gradient($shape, $position, $colors) {
|
|
4
|
+
@if type-of($shape) != "string" {
|
|
5
|
+
@error "`#{$shape}` is not a valid $shape for `radial-gradient`. Pass `circle` or `ellipse`.";
|
|
6
|
+
}
|
|
7
|
+
@if type-of($position) != "string" {
|
|
8
|
+
@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.";
|
|
9
|
+
}
|
|
4
10
|
$list: ();
|
|
5
11
|
$shape: unquote($shape);
|
|
6
12
|
$position: unquote($position);
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
$list
|
|
12
12
|
);
|
|
13
13
|
} @else if not map-has-key($map-for-directions, $direction) {
|
|
14
|
-
@if not index("deg", unit($direction)) {
|
|
15
|
-
@error "
|
|
14
|
+
@if type-of($direction) != "number" or not index("deg", unit($direction)) {
|
|
15
|
+
@error "`#{$direction}` is not a valid $direction for `text-gradient`. Pass an angle such as `45deg`, or one of: #{map-keys($map-for-directions)}.";
|
|
16
16
|
} @else {
|
|
17
17
|
background: linear-gradient($direction, $list);
|
|
18
18
|
}
|
|
@@ -7,6 +7,13 @@
|
|
|
7
7
|
// Takes each items come from $params.
|
|
8
8
|
$item: nth($params, $i);
|
|
9
9
|
|
|
10
|
+
// Each group must carry at least a direction, a colour and a size. Without
|
|
11
|
+
// this the nth() calls below fail with "Invalid index", which says nothing
|
|
12
|
+
// about what the mixin wanted.
|
|
13
|
+
@if length($item) < 3 {
|
|
14
|
+
@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.";
|
|
15
|
+
}
|
|
16
|
+
|
|
10
17
|
// The first value comes from the $item is direction.
|
|
11
18
|
// This will be used in the @if, @else statements with $size to control the offset of the shadows.
|
|
12
19
|
$direction: nth($item, 1);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
2
|
|
|
3
3
|
@function __clearWhitespace($string) {
|
|
4
|
+
@if type-of($string) != "string" {
|
|
5
|
+
@error "`#{$string}` is not a valid $string for `__clearWhitespace`. Pass a string.";
|
|
6
|
+
}
|
|
4
7
|
@while (str-index($string, " ") != null) {
|
|
5
8
|
$index: str-index($string, " ");
|
|
6
9
|
$string: "#{str-slice($string, 0, $index - 1)}#{str-slice($string, $index + 1)}";
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
@function __convertToNumber($value) {
|
|
4
4
|
|
|
5
|
+
@if type-of($value) != "string" {
|
|
6
|
+
@error "`#{$value}` is not a valid $value for `__convertToNumber`. Pass a string made only of digits, such as `\"42\"`.";
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
$string-numerals: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9";
|
|
6
10
|
$calc: 0;
|
|
7
11
|
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
2
|
|
|
3
3
|
@function __null($value, $seperation: comma, $skip: false) {
|
|
4
|
+
@if not index("comma" "space" "slash", $seperation) {
|
|
5
|
+
@error "`#{$seperation}` is not a valid $seperation for `__null`. Pass `comma`, `space` or `slash`.";
|
|
6
|
+
}
|
|
4
7
|
$list: ();
|
|
5
8
|
@for $i from 1 through length($value) {
|
|
6
9
|
@if nth($value, $i) == null {
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
// This function checks if the argument has a px unit. If not, it adds a px unit to the end of the argument.
|
|
4
4
|
|
|
5
5
|
@function __pixelify($value) {
|
|
6
|
+
@if type-of($value) != "number" {
|
|
7
|
+
@error "`#{$value}` is not a valid $value for `__pixelify`. Pass a number, with or without a unit.";
|
|
8
|
+
}
|
|
6
9
|
@if unit($value) == "px" {
|
|
7
10
|
@return $value;
|
|
8
11
|
} @else if unit($value) != "px" {
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
2
|
|
|
3
3
|
@function __validateLength($value) {
|
|
4
|
-
$
|
|
5
|
-
|
|
4
|
+
$keywords: ("auto", "inherit", "initial", "unset", "revert", 0);
|
|
5
|
+
|
|
6
|
+
@if index($keywords, $value) {
|
|
7
|
+
@return $value;
|
|
8
|
+
}
|
|
9
|
+
@if type-of($value) == "number" and not unitless($value) {
|
|
6
10
|
@return $value;
|
|
7
|
-
}
|
|
11
|
+
}
|
|
12
|
+
// calc(), clamp(), min() and max() arrive as Sass calculations; var() and
|
|
13
|
+
// env() arrive as unquoted strings holding a parenthesis. Both are valid
|
|
14
|
+
// lengths, and warning about them means warning about correct modern CSS,
|
|
15
|
+
// which this function used to do.
|
|
16
|
+
@if type-of($value) == "calculation" {
|
|
8
17
|
@return $value;
|
|
9
|
-
}
|
|
10
|
-
|
|
18
|
+
}
|
|
19
|
+
@if type-of($value) == "string" and str-index(quote($value), "(") {
|
|
11
20
|
@return $value;
|
|
12
21
|
}
|
|
22
|
+
|
|
23
|
+
@warn "`#{$value}` does not look like a length. Pass a number with a unit such as `20px`, a CSS function such as `var(--gap)` or `calc(1rem + 2px)`, or one of: auto, inherit, initial, unset, revert, 0.";
|
|
24
|
+
@return $value;
|
|
13
25
|
}
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
@function __validateScissors($value) {
|
|
4
4
|
$list: ();
|
|
5
5
|
@for $i from 1 through length($value) {
|
|
6
|
+
$item: nth($value, $i);
|
|
7
|
+
// unitless() below throws on anything that is not a number, and its message
|
|
8
|
+
// names its own parameter rather than the corner that was wrong.
|
|
9
|
+
@if $item != null and type-of($item) != "number" {
|
|
10
|
+
@error "`#{$item}` is not a valid corner size. Pass a length such as `12px`, or a unitless number which is treated as pixels.";
|
|
11
|
+
}
|
|
6
12
|
@if nth($value, $i) == null {
|
|
7
13
|
$list: append($list, 0px, comma);
|
|
8
14
|
} @else if unitless(nth($value, $i)) {
|